Skip to content

Commit

Permalink
fix(test): fix flakiness of glossary test (#9611)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal-kankriya authored Jan 12, 2024
1 parent b0426ae commit 600ca1c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 38 deletions.
25 changes: 9 additions & 16 deletions smoke-test/tests/cypress/cypress/e2e/glossary/glossary.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
describe("glossary", () => {
it("go to glossary page, create terms, term group", () => {
const urn = "urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)";
const datasetName = "cypress_logging_events";
const glossaryTerm = "CypressGlosssaryTerm";
const glossaryTermGroup = "CypressGlossaryGroup";

const urn = "urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)";
const datasetName = "cypress_logging_events";
const glossaryTerm = "CypressGlosssaryTerm";
const glossaryTermGroup = "CypressGlossaryGroup";
describe("glossary", () => {
it("go to glossary page, create terms, term group", () => {
cy.loginWithCredentials();
cy.goToGlossaryList();

cy.clickOptionWithText("Add Term");
cy.addViaModal(glossaryTerm, "Create Glossary Term", "Created Glossary Term!");

cy.addViaModal(glossaryTerm, "Create Glossary Term", glossaryTerm);
cy.clickOptionWithText("Add Term Group");
cy.addViaModal(glossaryTermGroup, "Create Term Group", "Created Term Group!");

cy.addViaModal(glossaryTermGroup, "Create Term Group", glossaryTermGroup);
cy.addTermToDataset(urn, datasetName, glossaryTerm);
cy.waitTextVisible('Added Terms!')

cy.waitTextVisible(glossaryTerm)
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryTerm);
cy.deleteFromDropdown();

cy.goToDataset(urn, datasetName);
cy.ensureTextNotPresent(glossaryTerm);

cy.goToGlossaryList();
cy.clickOptionWithText(glossaryTermGroup);
cy.deleteFromDropdown();

cy.goToGlossaryList();
cy.ensureTextNotPresent(glossaryTermGroup);
});
Expand Down
40 changes: 20 additions & 20 deletions smoke-test/tests/cypress/cypress/e2e/glossary/glossaryTerm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const glossaryTerms = {
glossaryTermUrl:"/glossaryTerm/urn:li:glossaryTerm:CypressNode.CypressColumnInfoType/Related%20Entities",
SampleCypressHdfsDataset:"SampleCypressHdfsDataset"
hdfsDataset:"SampleCypressHdfsDataset",
hiveDataset:"cypress_logging_events"
};

const applyTagFilter = (tag) => {
Expand Down Expand Up @@ -55,48 +56,47 @@ describe("glossaryTerm", () => {
cy.visit(glossaryTerms.glossaryTermUrl);
});

it("can visit related entities", () => {
cy.contains("of 0").should("not.exist");
cy.waitTextVisible(/of [0-9]+/);
});

it("can search related entities by query", () => {
cy.get('[placeholder="Filter entities..."]').click().type("logging{enter}");
cy.contains("of 0").should("not.exist");
cy.waitTextVisible(/of 1/);
cy.waitTextVisible("cypress_logging_events");
cy.contains(glossaryTerms.SampleCypressHdfsDataset).should("not.exist");
cy.get('[placeholder="Filter entities..."]').should("be.visible").click().type("logging{enter}");
cy.waitTextVisible(glossaryTerms.hiveDataset);
cy.contains(glossaryTerms.hdfsDataset).should("not.exist");
});

it("can apply filters on related entities", () => {
cy.waitTextVisible(glossaryTerms.hiveDataset);
applyTagFilter("urn:li:tag:Cypress2");
cy.contains("cypress_logging_events").should("not.exist");
cy.waitTextVisible(glossaryTerms.SampleCypressHdfsDataset);
cy.contains(glossaryTerms.hiveDataset).should("not.exist");
cy.waitTextVisible(glossaryTerms.hdfsDataset);
});

it("can search related entities by a specific tag using advanced search", () => {
cy.waitTextVisible(glossaryTerms.hdfsDataset);
applyAdvancedSearchFilter("Tag", "Cypress2");
cy.waitTextVisible(glossaryTerms.SampleCypressHdfsDataset);
cy.waitTextVisible("of 1");
cy.waitTextVisible(glossaryTerms.hdfsDataset);
cy.clickOptionWithText(glossaryTerms.hdfsDataset)
cy.waitTextVisible("Cypress 2");
});

it("can search related entities by AND-ing two concepts using search", () => {
cy.waitTextVisible(glossaryTerms.hdfsDataset);
applyAdvancedSearchFilter();
cy.clickOptionWithText('Add Filter');
cy.get('[data-testid="adv-search-add-filter-description"]').click({
force: true,
});
cy.get('[data-testid="edit-text-input"]').type("my hdfs");
cy.get('[data-testid="edit-text-input"]').type("my hdfs dataset");
cy.get('[data-testid="edit-text-done-btn"]').click({ force: true });
cy.waitTextVisible(glossaryTerms.SampleCypressHdfsDataset);
cy.waitTextVisible("of 1");
cy.waitTextVisible(glossaryTerms.hdfsDataset);
cy.clickOptionWithText(glossaryTerms.hdfsDataset)
cy.waitTextVisible("my hdfs dataset");
});

it("can search related entities by OR-ing two concepts using search", () => {
cy.waitTextVisible(glossaryTerms.hdfsDataset);
applyAdvancedSearchFilter("Description", "single log event");
applyBasicSearchFilter("Tag", "Cypress2");
searchByConceptsWithLogicalOperator("Cypress", "Tag", "any filter");
cy.waitTextVisible(glossaryTerms.SampleCypressHdfsDataset);
cy.waitTextVisible("cypress_logging_events");
cy.waitTextVisible(glossaryTerms.hdfsDataset);
cy.waitTextVisible(glossaryTerms.hiveDataset);
});
});
4 changes: 2 additions & 2 deletions smoke-test/tests/cypress/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ Cypress.Commands.add("addViaFormModal", (text, modelHeader) => {
cy.get(".ant-modal-footer > button:nth-child(2)").click();
});

Cypress.Commands.add("addViaModal", (text, modelHeader,verifyMessage) => {
Cypress.Commands.add("addViaModal", (text, modelHeader,value) => {
cy.waitTextVisible(modelHeader);
cy.get(".ant-input-affix-wrapper > input[type='text']").first().type(text);
cy.get(".ant-modal-footer > button:nth-child(2)").click();
cy.contains(verifyMessage).should('be.visible');
cy.contains(value).should('be.visible');
});

Cypress.Commands.add("ensureTextNotPresent", (text) => {
Expand Down

0 comments on commit 600ca1c

Please sign in to comment.