fix: update E2E test selectors and improve login stability
- Fix selectors to use config keys instead of Chinese labels - Add page load waiting and element visibility checks - Improve global setup with better error handling - Update all config-linkage tests with correct selectors
This commit is contained in:
@@ -17,7 +17,7 @@ test.describe('前后台配置联动测试', () => {
|
||||
await adminPage.goto('/admin/settings');
|
||||
await adminPage.waitForLoadState('networkidle');
|
||||
|
||||
const servicesConfig = adminPage.locator('text=服务模块配置').locator('..').locator('..');
|
||||
const servicesConfig = adminPage.locator('text=feature_services').locator('..').locator('..');
|
||||
await servicesConfig.locator('input[type="checkbox"]').first().check();
|
||||
await servicesConfig.locator('button:has-text("保存")').click();
|
||||
await adminPage.waitForSelector('text=保存成功', { timeout: 5000 });
|
||||
@@ -53,7 +53,7 @@ test.describe('前后台配置联动测试', () => {
|
||||
await adminPage.goto('/admin/settings');
|
||||
await adminPage.waitForLoadState('networkidle');
|
||||
|
||||
const productsConfig = adminPage.locator('text=产品模块配置').locator('..').locator('..');
|
||||
const productsConfig = adminPage.locator('text=feature_products').locator('..').locator('..');
|
||||
await productsConfig.locator('input[type="checkbox"]').first().check();
|
||||
await productsConfig.locator('button:has-text("保存")').click();
|
||||
await adminPage.waitForSelector('text=保存成功', { timeout: 5000 });
|
||||
@@ -89,7 +89,7 @@ test.describe('前后台配置联动测试', () => {
|
||||
await adminPage.goto('/admin/settings');
|
||||
await adminPage.waitForLoadState('networkidle');
|
||||
|
||||
const newsConfig = adminPage.locator('text=新闻模块配置').locator('..').locator('..');
|
||||
const newsConfig = adminPage.locator('text=feature_news').locator('..').locator('..');
|
||||
await newsConfig.locator('input[type="checkbox"]').first().check();
|
||||
await newsConfig.locator('button:has-text("保存")').click();
|
||||
await adminPage.waitForSelector('text=保存成功', { timeout: 5000 });
|
||||
|
||||
Reference in New Issue
Block a user