fix(test): flaky Domain.spec and Roles.spec (#21950)

* fix domain.spec

* fix delete role test

* minor fix
This commit is contained in:
Pranita Fulsundar 2025-06-25 18:19:33 +05:30 committed by GitHub
parent 35215762cb
commit a2154df0ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -90,6 +90,8 @@ test.describe('Domains', () => {
test.slow(true); test.slow(true);
test.beforeAll('Setup pre-requests', async ({ browser }) => { test.beforeAll('Setup pre-requests', async ({ browser }) => {
test.slow(true);
const { apiContext, afterAction } = await performAdminLogin(browser); const { apiContext, afterAction } = await performAdminLogin(browser);
await user.create(apiContext); await user.create(apiContext);
await classification.create(apiContext); await classification.create(apiContext);
@ -116,6 +118,8 @@ test.describe('Domains', () => {
}); });
test.afterAll('Cleanup', async ({ browser }) => { test.afterAll('Cleanup', async ({ browser }) => {
test.slow(true);
const { apiContext, afterAction } = await performAdminLogin(browser); const { apiContext, afterAction } = await performAdminLogin(browser);
await user.delete(apiContext); await user.delete(apiContext);
await classification.delete(apiContext); await classification.delete(apiContext);
@ -899,6 +903,10 @@ test.describe('Data Consumer Domain Ownership', () => {
await sidebarClick(dataConsumerPage, SidebarItem.DOMAIN); await sidebarClick(dataConsumerPage, SidebarItem.DOMAIN);
await selectDomain(dataConsumerPage, testResources.domainForTest.data); await selectDomain(dataConsumerPage, testResources.domainForTest.data);
await dataConsumerPage.locator('[data-testid="loader"]').waitFor({
state: 'detached',
});
await dataConsumerPage.getByTestId('domain-details-add-button').click(); await dataConsumerPage.getByTestId('domain-details-add-button').click();
// check Data Products menu item is visible // check Data Products menu item is visible

View File

@ -47,13 +47,14 @@ test.use({ storageState: 'playwright/.auth/admin.json' });
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await redirectToHomePage(page); await redirectToHomePage(page);
await settingClick(page, GlobalSettingOptions.ROLES);
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
}); });
test('Roles page should work properly', async ({ page }) => { test('Roles page should work properly', async ({ page }) => {
test.slow(true); test.slow(true);
await test.step('Add new role and check all tabs data', async () => { await test.step('Add new role and check all tabs data', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);
await page.locator('[data-testid="add-role"]').click(); await page.locator('[data-testid="add-role"]').click();
// Asserting navigation // Asserting navigation
@ -124,7 +125,6 @@ test('Roles page should work properly', async ({ page }) => {
}); });
await test.step('Add new role without selecting data', async () => { await test.step('Add new role without selecting data', async () => {
await settingClick(page, GlobalSettingOptions.ROLES);
await page.locator('[data-testid="add-role"]').click(); await page.locator('[data-testid="add-role"]').click();
// Asserting navigation // Asserting navigation
@ -299,7 +299,9 @@ test('Delete role action from manage button options', async ({ page }) => {
await role.create(apiContext, policies); await role.create(apiContext, policies);
await settingClick(page, GlobalSettingOptions.ROLES); await page.reload();
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await page.waitForLoadState('networkidle'); await page.waitForLoadState('networkidle');

View File

@ -140,6 +140,9 @@ export const selectSubDomain = async (
); );
await page.getByTestId(subDomain.name).click(); await page.getByTestId(subDomain.name).click();
await res; await res;
await page.waitForLoadState('networkidle');
await page.locator('[data-testid="loader"]').waitFor({ state: 'detached' });
}; };
export const selectDataProductFromTab = async ( export const selectDataProductFromTab = async (