Skip to content

Commit

Permalink
fix expand all operation on terms page (#17733)
Browse files Browse the repository at this point in the history
(cherry picked from commit bd93a2f)
  • Loading branch information
karanh37 committed Sep 6, 2024
1 parent 50ebdcb commit 7db60da
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,45 @@ test.describe('Glossary tests', () => {
await afterAction();
});

test('Verify Expand All For Nested Glossary Terms', async ({ browser }) => {
const { page, afterAction, apiContext } = await performAdminLogin(browser);
const glossary1 = new Glossary();
const glossaryTerm1 = new GlossaryTerm(glossary1);
await glossary1.create(apiContext);
await glossaryTerm1.create(apiContext);
const glossaryTerm2 = new GlossaryTerm(
glossary1,
glossaryTerm1.responseData.fullyQualifiedName
);
await glossaryTerm2.create(apiContext);
const glossaryTerm3 = new GlossaryTerm(
glossary1,
glossaryTerm2.responseData.fullyQualifiedName
);
await glossaryTerm3.create(apiContext);

try {
await sidebarClick(page, SidebarItem.GLOSSARY);
await selectActiveGlossary(page, glossary1.data.displayName);
await selectActiveGlossaryTerm(page, glossaryTerm1.data.displayName);
await page.getByTestId('terms').click();
await page.getByTestId('expand-collapse-all-button').click();

await expect(
page.getByRole('cell', { name: glossaryTerm2.data.displayName })
).toBeVisible();
await expect(
page.getByRole('cell', { name: glossaryTerm3.data.displayName })
).toBeVisible();
} finally {
await glossaryTerm3.delete(apiContext);
await glossaryTerm2.delete(apiContext);
await glossaryTerm1.delete(apiContext);
await glossary1.delete(apiContext);
await afterAction();
}
});

test.afterAll(async ({ browser }) => {
const { afterAction, apiContext } = await performAdminLogin(browser);
await user1.delete(apiContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ export type GlossaryTermData = {
owners?: UserTeamRef[];
fullyQualifiedName: string;
reviewers: UserTeamRef[];
parent?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ export class GlossaryTerm {

responseData: GlossaryTermResponseDataType;

constructor(glossary: Glossary, name?: string) {
constructor(glossary: Glossary, parent?: string, name?: string) {
this.data.glossary = glossary.data.name;
if (parent) {
this.data.parent = parent;
}

this.data.name = name ?? this.data.name;
// eslint-disable-next-line no-useless-escape
this.data.fullyQualifiedName = `\"${this.data.glossary}\".\"${this.data.name}\"`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,9 @@ const GlossaryTermTab = ({

const fetchAllTerms = async () => {
setIsTableLoading(true);
const key = isGlossary ? 'glossary' : 'parent';
const { data } = await getGlossaryTerms({
glossary: activeGlossary?.id || '',
[key]: activeGlossary?.id || '',
limit: API_RES_MAX_SIZE,
fields: [
TabSpecificField.OWNERS,
Expand Down

0 comments on commit 7db60da

Please sign in to comment.