From 2bbeace7349e6d1cb289deb773e0b2f1ee8284fc Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 7 Nov 2025 12:49:44 +0530 Subject: [PATCH] PLAYWRIGHT: fix the tag playwright test (#24222) * fix the tag playwright test * minor changes --- .../ui/playwright/e2e/Pages/Tag.spec.ts | 109 ++++++++++++------ 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tag.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tag.spec.ts index 4473767ee18..6801f312d20 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tag.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Tag.spec.ts @@ -47,20 +47,6 @@ const dataConsumerUser = new UserClass(); const dataStewardUser = new UserClass(); const limitedAccessUser = new UserClass(); -const classification = new ClassificationClass({ - provider: 'system', - mutuallyExclusive: true, -}); -const tag = new TagClass({ - classification: classification.data.name, -}); -const classification1 = new ClassificationClass(); -const tag1 = new TagClass({ - classification: classification1.data.name, -}); -const user1 = new UserClass(); -const domain = new Domain(); - const test = base.extend<{ adminPage: Page; dataConsumerPage: Page; @@ -101,33 +87,37 @@ base.beforeAll('Setup pre-requests', async ({ browser }) => { await dataStewardUser.create(apiContext); await dataStewardUser.setDataStewardRole(apiContext); await limitedAccessUser.create(apiContext); - await classification.create(apiContext); - await classification1.create(apiContext); - await tag.create(apiContext); - await tag1.create(apiContext); - await user1.create(apiContext); - await domain.create(apiContext); - await afterAction(); -}); - -base.afterAll('Cleanup', async ({ browser }) => { - const { apiContext, afterAction } = await performAdminLogin(browser); - await adminUser.delete(apiContext); - await dataConsumerUser.delete(apiContext); - await dataStewardUser.delete(apiContext); - await limitedAccessUser.delete(apiContext); - await classification.delete(apiContext); - await classification1.delete(apiContext); - await tag.delete(apiContext); - await tag1.delete(apiContext); - await user1.delete(apiContext); - await domain.delete?.(apiContext); await afterAction(); }); test.describe('Tag Page with Admin Roles', () => { + const classification = new ClassificationClass({ + provider: 'system', + mutuallyExclusive: true, + }); + const tag = new TagClass({ + classification: classification.data.name, + }); + const classification1 = new ClassificationClass(); + const tag1 = new TagClass({ + classification: classification1.data.name, + }); + const user1 = new UserClass(); + const domain = new Domain(); + test.slow(true); + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + await classification.create(apiContext); + await classification1.create(apiContext); + await tag.create(apiContext); + await tag1.create(apiContext); + await user1.create(apiContext); + await domain.create(apiContext); + await afterAction(); + }); + test('Verify Tag UI', async ({ adminPage }) => { await verifyTagPageUI(adminPage, classification.data.name, tag); }); @@ -328,6 +318,21 @@ test.describe('Tag Page with Admin Roles', () => { test.describe('Tag Page with Data Consumer Roles', () => { test.slow(true); + const classification = new ClassificationClass({ + provider: 'system', + mutuallyExclusive: true, + }); + const tag = new TagClass({ + classification: classification.data.name, + }); + + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + await classification.create(apiContext); + await tag.create(apiContext); + await afterAction(); + }); + test('Verify Tag UI for Data Consumer', async ({ dataConsumerPage }) => { await verifyTagPageUI( dataConsumerPage, @@ -346,7 +351,7 @@ test.describe('Tag Page with Data Consumer Roles', () => { test('Edit Tag Description for Data Consumer', async ({ dataConsumerPage, }) => { - await editTagPageDescription(dataConsumerPage, tag1); + await editTagPageDescription(dataConsumerPage, tag); }); test('Add and Remove Assets for Data Consumer', async ({ @@ -370,6 +375,21 @@ test.describe('Tag Page with Data Consumer Roles', () => { test.describe('Tag Page with Data Steward Roles', () => { test.slow(true); + const classification = new ClassificationClass({ + provider: 'system', + mutuallyExclusive: true, + }); + const tag = new TagClass({ + classification: classification.data.name, + }); + + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + await classification.create(apiContext); + await tag.create(apiContext); + await afterAction(); + }); + test('Verify Tag UI for Data Steward', async ({ dataStewardPage }) => { await verifyTagPageUI(dataStewardPage, classification.data.name, tag, true); }); @@ -381,7 +401,7 @@ test.describe('Tag Page with Data Steward Roles', () => { }); test('Edit Tag Description for Data Steward', async ({ dataStewardPage }) => { - await editTagPageDescription(dataStewardPage, tag1); + await editTagPageDescription(dataStewardPage, tag); }); test('Add and Remove Assets for Data Steward', async ({ @@ -405,6 +425,21 @@ test.describe('Tag Page with Data Steward Roles', () => { test.describe('Tag Page with Limited EditTag Permission', () => { test.slow(true); + const classification = new ClassificationClass({ + provider: 'system', + mutuallyExclusive: true, + }); + const tag = new TagClass({ + classification: classification.data.name, + }); + + test.beforeAll('Setup pre-requests', async ({ browser }) => { + const { apiContext, afterAction } = await performAdminLogin(browser); + await classification.create(apiContext); + await tag.create(apiContext); + await afterAction(); + }); + test('Add and Remove Assets and Check Restricted Entity', async ({ adminPage, limitedAccessPage,