fix: acl e2e failed (#3835)

* test: acl e2e test

* refactor: test: acle e2e test fix
This commit is contained in:
katherinehhh 2024-03-27 14:34:59 +08:00 committed by GitHub
parent d3bd0c71dd
commit e95f4ab123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -70,7 +70,7 @@ test('allows to confgiure plugins ', async ({ page, mockPage, mockRole, updateRo
.locator('span')
.nth(1)
.click();
await expect(page.getByRole('tab').getByText('Plugin settings')).toBeVisible();
await expect(page.getByText('Plugin settings')).toBeVisible();
await updateRole({
name: roleData.name,
snippets: ['!pm.*'],

View File

@ -29,8 +29,10 @@ test('menu permission ', async ({ page, mockPage, mockRole, updateRole }) => {
.nth(1)
.click();
await page.getByRole('tab').getByText('Menu').click();
await page.waitForSelector('.ant-table');
await expect(page.getByRole('row', { name: 'page1' }).locator('.ant-checkbox-input')).toBeChecked({ checked: true });
await page.waitForTimeout(1000);
await expect(page.getByRole('row', { name: 'page1' }).locator('.ant-checkbox-input').last()).toBeChecked({
checked: true,
});
await expect(page.getByRole('row', { name: 'page2' }).locator('.ant-checkbox-input')).toBeChecked({ checked: false });
//修改菜单权限page1无权限,page2有权限
await updateRole({ name: roleData.name, menuUiSchemas: [uid2] });
@ -47,8 +49,10 @@ test('menu permission ', async ({ page, mockPage, mockRole, updateRole }) => {
.nth(1)
.click();
await page.getByRole('tab').getByText('Menu').click();
await page.waitForSelector('.ant-table');
await expect(page.getByRole('row', { name: 'page1' }).locator('.ant-checkbox-input')).toBeChecked({ checked: false });
await page.waitForTimeout(1000);
await expect(page.getByRole('row', { name: 'page1' }).locator('.ant-checkbox-input').last()).toBeChecked({
checked: false,
});
await expect(page.getByRole('row', { name: 'page2' }).locator('.ant-checkbox-input')).toBeChecked({ checked: true });
//通过路由访问无权限的菜单,跳到有权限的第一个菜单
await page.goto(`/admin/${uid1}`);