Skip to content

Commit 6261dd5

Browse files
authored
tests: fix flaky SystemCertificationTags test where Gold tag missing from dropdown after classification re-enable (#27415)
* tests: fix flaky SystemCertificationTags test where Gold tag missing from dropdown after classification re-enable * nit
1 parent 3129a14 commit 6261dd5

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/SystemCertificationTags.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { TableClass } from '../../support/entity/TableClass';
1515
import {
1616
closeCertificationDropdown,
1717
openCertificationDropdown,
18-
setAllSystemCertificationTagsDisabled,
18+
restoreCertificationState,
1919
setCertificationClassificationDisabled,
2020
setTagDisabledByFqn,
2121
SYSTEM_CERTIFICATION_TAGS,
@@ -38,15 +38,13 @@ test.describe.serial('System Level Certification Tags', () => {
3838
test.beforeAll(async ({ browser }) => {
3939
const { apiContext, afterAction } = await createNewPage(browser);
4040
await table.create(apiContext);
41-
await setCertificationClassificationDisabled(apiContext, false);
42-
await setAllSystemCertificationTagsDisabled(apiContext, false);
41+
await restoreCertificationState(apiContext);
4342
await afterAction();
4443
});
4544

4645
test.afterAll(async ({ browser }) => {
4746
const { apiContext, afterAction } = await createNewPage(browser);
48-
await setCertificationClassificationDisabled(apiContext, false);
49-
await setAllSystemCertificationTagsDisabled(apiContext, false);
47+
await restoreCertificationState(apiContext);
5048
await table.delete(apiContext);
5149
await afterAction();
5250
});
@@ -103,7 +101,7 @@ test.describe.serial('System Level Certification Tags', () => {
103101

104102
await closeCertificationDropdown(page);
105103
} finally {
106-
await setCertificationClassificationDisabled(apiContext, false);
104+
await restoreCertificationState(apiContext);
107105
await afterAction();
108106
}
109107
});
@@ -125,8 +123,7 @@ test.describe.serial('System Level Certification Tags', () => {
125123
}
126124

127125
await closeCertificationDropdown(page);
128-
129-
await setCertificationClassificationDisabled(apiContext, false);
126+
await restoreCertificationState(apiContext);
130127

131128
await redirectToHomePage(page);
132129
await table.visitEntityPage(page);
@@ -138,7 +135,7 @@ test.describe.serial('System Level Certification Tags', () => {
138135

139136
await closeCertificationDropdown(page);
140137
} finally {
141-
await setCertificationClassificationDisabled(apiContext, false);
138+
await restoreCertificationState(apiContext);
142139
await afterAction();
143140
}
144141
});

openmetadata-ui/src/main/resources/ui/playwright/utils/certification.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,20 @@ export const setAllSystemCertificationTagsDisabled = async (
5656
await setTagDisabledByFqn(apiContext, tagFqn, disabled);
5757
}
5858
};
59+
60+
/**
61+
* Restores the Certification classification and all system certification tags
62+
* (Gold, Silver, Bronze) to an enabled state.
63+
*
64+
* Disabling a classification can cascade and mark individual tags as
65+
* disabled=true at the tag level. Re-enabling the classification alone does NOT
66+
* reverse that cascade. This helper must be used instead of
67+
* setCertificationClassificationDisabled(false) in any finally/cleanup block to
68+
* guarantee a clean state for subsequent tests.
69+
*/
70+
export const restoreCertificationState = async (
71+
apiContext: APIRequestContext
72+
) => {
73+
await setCertificationClassificationDisabled(apiContext, false);
74+
await setAllSystemCertificationTagsDisabled(apiContext, false);
75+
};

0 commit comments

Comments
 (0)