From e95f4ab123585c0928d5ae9e9b3fb46fa306bba5 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 27 Mar 2024 14:34:59 +0800 Subject: [PATCH] fix: acl e2e failed (#3835) * test: acl e2e test * refactor: test: acle e2e test fix --- .../plugin-acl/src/client/__e2e__/configure.test.ts | 2 +- .../plugin-acl/src/client/__e2e__/menu.test.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/configure.test.ts b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/configure.test.ts index 718dc650c..b84d78a38 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/configure.test.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/configure.test.ts @@ -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.*'], diff --git a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/menu.test.ts b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/menu.test.ts index 192ab4d78..deb78f6a9 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/menu.test.ts +++ b/packages/plugins/@nocobase/plugin-acl/src/client/__e2e__/menu.test.ts @@ -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}`);