mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:06:06 +00:00
chore(e2e): make e2e more stable
This commit is contained in:
parent
a03f459177
commit
0dc49d32e4
@ -19,10 +19,13 @@ test.describe('auth', () => {
|
||||
});
|
||||
|
||||
test('register', async ({ page }) => {
|
||||
// Generate a random username
|
||||
const username = `zidonghuaceshi${Math.random().toString(36).substring(2, 15)}`;
|
||||
|
||||
await page.goto('/');
|
||||
await page.getByRole('link', { name: 'Create an account' }).click();
|
||||
await page.getByPlaceholder('Username').click();
|
||||
await page.getByPlaceholder('Username').fill('zidonghuaceshi');
|
||||
await page.getByPlaceholder('Username').fill(username);
|
||||
await page.getByPlaceholder('Password', { exact: true }).click();
|
||||
await page.getByPlaceholder('Password', { exact: true }).fill('zidonghuaceshi123');
|
||||
await page.getByPlaceholder('Confirm password').click();
|
||||
@ -31,14 +34,14 @@ test.describe('auth', () => {
|
||||
|
||||
await expect(page.getByText('Sign up successfully, and automatically jump to the sign in page')).toBeVisible();
|
||||
|
||||
// 用新账户登录
|
||||
// Sign in with the new account
|
||||
await page.getByPlaceholder('Username/Email').click();
|
||||
await page.getByPlaceholder('Username/Email').fill('zidonghuaceshi');
|
||||
await page.getByPlaceholder('Username/Email').fill(username);
|
||||
await page.getByPlaceholder('Password').click();
|
||||
await page.getByPlaceholder('Password').fill('zidonghuaceshi123');
|
||||
await page.getByRole('button', { name: 'Sign in' }).click();
|
||||
|
||||
await page.getByTestId('user-center-button').hover();
|
||||
await expect(page.getByText('zidonghuaceshi')).toBeVisible();
|
||||
await expect(page.getByText(username)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
@ -192,14 +192,18 @@ test.describe('form item & edit form', () => {
|
||||
).toBeDisabled();
|
||||
},
|
||||
expectEasyReading: async () => {
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-general-form-general.checkbox-checkbox').getByRole('checkbox'),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.getByLabel('block-item-CollectionField-general-form-general.checkbox-checkbox')
|
||||
.getByRole('img', { name: 'check' }),
|
||||
).toBeVisible({ visible: record.checkbox });
|
||||
if (record.checkbox) {
|
||||
await expect(
|
||||
page
|
||||
.getByLabel('block-item-CollectionField-general-form-general.checkbox-checkbox')
|
||||
.getByRole('img', { name: 'check' }),
|
||||
).toBeVisible({ visible: record.checkbox });
|
||||
} else {
|
||||
// 未选中状态会显示一个禁用的 checkbox
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-general-form-general.checkbox-checkbox').getByRole('checkbox'),
|
||||
).toBeDisabled();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -22,7 +22,6 @@ test.describe('file manager', () => {
|
||||
|
||||
// 2、测试步骤:进入“文件管理器”-“新建”按钮,填写表单,点击“确定”按钮
|
||||
await page.goto('/admin/settings/file-manager');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.getByRole('button', { name: 'plus Add new' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Local storage' }).click();
|
||||
const createLocalStorage = new CreateLocalStorage(page);
|
||||
|
Loading…
Reference in New Issue
Block a user