Skip to content

Commit

Permalink
Glossary Navigation Cypress test (#8804)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkorchak authored Sep 8, 2023
1 parent 75252a3 commit aef0f27
Showing 1 changed file with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const glossaryTerm = "CypressGlosssaryNavigationTerm";
const glossaryTermGroup = "CypressGlosssaryNavigationGroup";
const glossaryParentGroup = "Cypress";

describe("glossary sidebar navigation test", () => {
it("create term and term parent group, move and delete term group", () => {
//create a new term group and term, move term to the group
cy.loginWithCredentials();
cy.goToGlossaryList();
cy.clickOptionWithText("Add Term Group");
cy.waitTextVisible("Create Term Group");
cy.get(".ant-input-affix-wrapper > input[type='text']").first().type(glossaryTermGroup);
cy.get(".ant-modal-footer > button:last-child").click();
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTermGroup).should("be.visible");
cy.clickOptionWithText("Add Term");
cy.waitTextVisible("Create Glossary Term");
cy.get(".ant-input-affix-wrapper > input[type='text']").first().type(glossaryTerm);
cy.get(".ant-modal-footer > button:last-child").click();
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTerm).click();
cy.waitTextVisible("No documentation yet");
cy.openThreeDotDropdown();
cy.clickOptionWithText("Move");
cy.get('[role="dialog"] [data-icon="close-circle"]').click({force: true});
cy.get('[role="dialog"]').contains(glossaryTermGroup).click();
cy.get('[role="dialog"]').contains(glossaryTermGroup).should("be.visible");
cy.get("button").contains("Move").click();
cy.waitTextVisible("Moved Glossary Term!");
//ensure the new term is under the parent term group in the navigation sidebar
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTermGroup).click();
cy.get('*[class^="GlossaryEntitiesList"]').contains(glossaryTerm).should("be.visible");
cy.get('*[class^="GlossaryBrowser"] [aria-label="down"]').click().wait(1000);
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTerm).should("not.exist");
//move a term group from the root level to be under a parent term group
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryTermGroup);
cy.openThreeDotDropdown();
cy.clickOptionWithText("Move");
cy.get('[role="dialog"] [data-icon="close-circle"]').click({force: true});
cy.get('[role="dialog"]').contains(glossaryParentGroup).click();
cy.get('[role="dialog"]').contains(glossaryParentGroup).should("be.visible");
cy.get("button").contains("Move").click();
cy.waitTextVisible("Moved Term Group!");
//ensure it is no longer on the sidebar navigator at the top level but shows up under the new parent
cy.get('*[class^="GlossaryBrowser"] [aria-label="down"]').click().wait(1000);
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTermGroup).should("not.exist");
//delete a term group
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryParentGroup);
cy.clickOptionWithText(glossaryTermGroup);
cy.clickOptionWithText(glossaryTerm).wait(3000);
cy.deleteFromDropdown();
cy.waitTextVisible("Deleted Glossary Term!");
cy.clickOptionWithText(glossaryParentGroup);
cy.clickOptionWithText(glossaryTermGroup).wait(3000);
cy.deleteFromDropdown();
cy.waitTextVisible("Deleted Term Group!");
//ensure it is no longer in the sidebar navigator
cy.ensureTextNotPresent(glossaryTerm);
cy.ensureTextNotPresent(glossaryTermGroup);
});
});

0 comments on commit aef0f27

Please sign in to comment.