Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): add cypress tests for glossary and deprecation #6249

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions smoke-test/tests/cypress/cypress/integration/glossary/glossary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 glossaryTerm = "CypressGlosssaryTerm";
const glossaryTermGroup = "CypressGlosssaryGroup";
cy.login();
cy.goToGlossaryList();

cy.clickOptionWithText("Add Term");
cy.addViaModel(glossaryTerm);

cy.contains("Add Term Group").click();
cy.addViaModel(glossaryTermGroup);

cy.addTermToDataset(urn, glossaryTerm);

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

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

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

cy.goToGlossaryList();
cy.ensureTextNotPresent(glossaryTermGroup);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe("deprecation", () => {
it("go to dataset and check deprecation works", () => {
const urn = "urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)";
cy.login();

cy.goToDataset(urn);
cy.openThreeDotDropdown();
cy.clickOptionWithText("Mark as deprecated");
cy.addViaModel("test deprecation");

cy.goToDataset(urn);
cy.contains("Deprecated");

cy.openThreeDotDropdown();
cy.clickOptionWithText("Mark as un-deprecated");
cy.ensureTextNotPresent("Deprecated");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe("mutations", () => {
it("can create and add a tag to dataset and visit new tag page", () => {
cy.deleteUrn("urn:li:tag:CypressTestAddTag");
cy.login();
cy.visit(
"/dataset/urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)"
);
cy.goToDataset("urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)");
cy.contains("cypress_logging_events");

cy.contains("Add Tag").click({ force: true });
Expand Down Expand Up @@ -62,25 +60,10 @@ describe("mutations", () => {

it("can add and remove terms from a dataset", () => {
cy.login();
cy.visit(
"/dataset/urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)"
);
cy.contains("cypress_logging_events");

cy.contains("Add Term").click();

cy.focused().type("CypressTerm");

cy.get(".ant-select-item-option-content").within(() =>
cy.contains("CypressTerm").click({ force: true })
);

cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
force: true,
});
cy.get('[data-testid="add-tag-term-from-modal-btn"]').should("not.exist");

cy.contains("CypressTerm");
cy.addTermToDataset(
"urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)",
"CypressTerm"
)
Comment on lines +63 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding these !!


cy.get(
'a[href="/glossaryTerm/urn:li:glossaryTerm:CypressNode.CypressTerm"]'
Expand All @@ -93,9 +76,7 @@ describe("mutations", () => {
it("can add and remove tags from a dataset field", () => {
cy.login();
cy.viewport(2000, 800);
cy.visit(
"/dataset/urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)"
);
cy.goToDataset("urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)");
cy.get('[data-testid="schema-field-event_name-tags"]').trigger(
"mouseover",
{ force: true }
Expand Down Expand Up @@ -155,9 +136,7 @@ describe("mutations", () => {
cy.login();
// make space for the glossary term column
cy.viewport(2000, 800);
cy.visit(
"/dataset/urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)"
);
cy.goToDataset("urn:li:dataset:(urn:li:dataPlatform:hive,cypress_logging_events,PROD)");
cy.get('[data-testid="schema-field-event_name-terms"]').trigger(
"mouseover",
{ force: true }
Expand Down
50 changes: 50 additions & 0 deletions smoke-test/tests/cypress/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,56 @@ Cypress.Commands.add('deleteUrn', (urn) => {
"Content-Type": "application/json",
}})
})

Cypress.Commands.add("goToGlossaryList", () => {
cy.visit("/glossary");
cy.contains("Glossary");
});

Cypress.Commands.add("goToDataset", (urn) => {
cy.visit(
"/dataset/" + urn
);
})

Cypress.Commands.add("openThreeDotDropdown", () => {
cy.get('div[class^="EntityHeader__SideHeaderContent-"] > div > .ant-dropdown-trigger').click();
});

Cypress.Commands.add("clickOptionWithText", (text) => {
cy.contains(text).click();
});

Cypress.Commands.add("deleteFromDropdown", () => {
cy.openThreeDotDropdown();
cy.clickOptionWithText("Delete");
cy.clickOptionWithText("Yes");
});

Cypress.Commands.add("addViaModel", (text) => {
cy.get(".ant-form-item-control-input-content > input[type='text']").type(text);
cy.get(".ant-modal-footer > button:nth-child(2)").click();
});

Cypress.Commands.add("ensureTextNotPresent", (text) => {
cy.contains(text).should("not.exist");
});

Cypress.Commands.add('addTermToDataset', (urn, term) => {
cy.goToDataset(urn);
cy.clickOptionWithText("Add Term");
cy.focused().type(term);
cy.get(".ant-select-item-option-content").within(() =>
cy.contains(term).click({ force: true })
);
cy.get('[data-testid="add-tag-term-from-modal-btn"]').click({
force: true,
});
cy.get('[data-testid="add-tag-term-from-modal-btn"]').should("not.exist");

cy.contains(term);
});

//
//
// -- This is a child command --
Expand Down