chore(ui): fix flaky playwright (#23457)

* fix expand collapse test issue

* fix domain test
This commit is contained in:
Karan Hotchandani 2025-09-18 15:41:11 +05:30 committed by GitHub
parent 075b4ea6d6
commit 2d8d36c885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 47 deletions

View File

@ -174,9 +174,8 @@ test.describe('Domains', () => {
});
await test.step('Add assets to domain', async () => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.DOMAIN);
await addAssetsToDomain(page, domain, assets);
await page.getByTestId('assets').click();
await addAssetsToDomain(page, domain, assets, false);
});
await test.step('Delete domain using delete modal', async () => {

View File

@ -59,6 +59,7 @@ import {
filterStatus,
goToAssetsTab,
openColumnDropdown,
performExpandAll,
renameGlossaryTerm,
selectActiveGlossary,
selectActiveGlossaryTerm,
@ -823,11 +824,7 @@ test.describe('Glossary tests', () => {
})
).not.toBeVisible();
const termRes = page.waitForResponse('/api/v1/glossaryTerms?*');
// verify the term is moved under the parent term
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', {
@ -842,7 +839,7 @@ test.describe('Glossary tests', () => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.GLOSSARY);
await selectActiveGlossary(page, glossary1.data.displayName);
await page.getByTestId('expand-collapse-all-button').click();
await performExpandAll(page);
await dragAndDropTerm(
page,
@ -918,11 +915,7 @@ test.describe('Glossary tests', () => {
})
).not.toBeVisible();
const termRes = page.waitForResponse('/api/v1/glossaryTerms?*');
// verify the term is moved under the parent term
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', {
@ -971,11 +964,7 @@ test.describe('Glossary tests', () => {
})
).not.toBeVisible();
const termRes = page.waitForResponse('/api/v1/glossaryTerms?*');
// verify the term is moved under the parent term
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', {
@ -1029,12 +1018,7 @@ test.describe('Glossary tests', () => {
await selectActiveGlossary(page, glossary2.data.displayName);
const termRes = page.waitForResponse(
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
);
// verify the term is moved to the destination glossary
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', {
@ -1244,11 +1228,7 @@ test.describe('Glossary tests', () => {
await selectActiveGlossaryTerm(page, glossaryTerm1.data.displayName);
await page.getByTestId('terms').click();
const termRes = page.waitForResponse(
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
);
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', { name: glossaryTerm2.data.displayName })
@ -1440,11 +1420,7 @@ test.describe('Glossary tests', () => {
await sidebarClick(page, SidebarItem.GLOSSARY);
await selectActiveGlossary(page, glossary1.data.displayName);
const termRes = page.waitForResponse(
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers&limit=1000'
);
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
await performExpandAll(page);
await expect(
page.getByRole('cell', { name: glossaryTerm1.data.displayName })

View File

@ -10,18 +10,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import test, { APIRequestContext, expect, Page } from '@playwright/test';
import { get, isEmpty, isUndefined } from 'lodash';
import { SidebarItem } from '../constant/sidebar';

View File

@ -1682,3 +1682,11 @@ export const setupGlossaryDenyPermissionTest = async (
cleanup,
};
};
export const performExpandAll = async (page: Page) => {
const termRes = page.waitForResponse(
'/api/v1/glossaryTerms?directChildrenOf=*&fields=childrenCount%2Cowners%2Creviewers*'
);
await page.getByTestId('expand-collapse-all-button').click();
await termRes;
};