forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'datahub-project:master' into master
- Loading branch information
Showing
3 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 77 additions & 36 deletions
113
smoke-test/tests/cypress/cypress/e2e/domains/nested_domains.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,94 @@ | ||
const domainName = "CypressNestedDomain"; | ||
const domainDescription = "CypressNestedDomainDescription"; | ||
|
||
describe("nested domains test", () => { | ||
const createDomain = () => { | ||
cy.clickOptionWithTestId("domains-new-domain-button"); | ||
cy.get('[data-testid="create-domain-name"]').click().type(domainName); | ||
cy.get('[data-testid="create-domain-description"]').click().type(domainDescription); | ||
cy.clickOptionWithTestId("create-domain-button"); | ||
cy.waitTextVisible("Created domain!"); | ||
} | ||
|
||
it("create a domain, move under parent, remove domain", () => { | ||
// Create a new domain without a parent | ||
cy.loginWithCredentials(); | ||
cy.goToDomainList(); | ||
cy.clickOptionWithTestId("domains-new-domain-button"); | ||
cy.get('[data-testid="create-domain-name"]').click().type(domainName); | ||
cy.get('[data-testid="create-domain-description"]').click().type(domainDescription); | ||
cy.clickOptionWithTestId("create-domain-button"); | ||
cy.waitTextVisible(domainName); | ||
const moveDomaintoRootLevel = () => { | ||
cy.clickOptionWithText(domainName); | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-move-button"); | ||
cy.get('[data-testid="move-domain-modal"]').contains("Marketing").click({force: true}); | ||
cy.waitTextVisible('Marketing') | ||
cy.clickOptionWithTestId("move-domain-modal-move-button") | ||
} | ||
|
||
// Ensure the new domain has no parent in the navigation sidebar | ||
cy.waitTextVisible(domainDescription); | ||
const moveDomaintoParent = () => { | ||
cy.get('[data-testid="domain-list-item"]').contains("Marketing").prev().click(); | ||
cy.clickOptionWithText(domainName); | ||
cy.waitTextVisible(domainName) | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-move-button"); | ||
cy.clickOptionWithTestId("move-domain-modal-move-button") | ||
} | ||
|
||
// Move a domain from the root level to be under a parent domain | ||
cy.clickOptionWithText(domainName); | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-move-button"); | ||
cy.get('[data-testid="move-domain-modal"]').contains("Marketing").click({force: true}); | ||
cy.get('[data-testid="move-domain-modal"]').contains("Marketing").should("be.visible"); | ||
cy.clickOptionWithTestId("move-domain-modal-move-button").wait(5000); | ||
const deleteFromDomainDropdown = () => { | ||
cy.clickOptionWithText('Filters') | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-delete-button"); | ||
cy.waitTextVisible("Are you sure you want to remove this Domain?"); | ||
cy.clickOptionWithText("Yes"); | ||
} | ||
|
||
// Wnsure domain is no longer on the sidebar navigator at the top level but shows up under the parent | ||
const deleteDomain = () => { | ||
cy.clickOptionWithText(domainName).waitTextVisible('Domains'); | ||
deleteFromDomainDropdown() | ||
} | ||
|
||
//Delete Unecessary Existing Domains | ||
const deleteExisitingDomain = () => { | ||
cy.get('a[href*="urn:li"] span[class^="ant-typography"]') | ||
.should('be.visible') | ||
.its('length') | ||
.then((length) => { | ||
for (let i = 0; i < length - 1; i++) { | ||
cy.get('a[href*="urn:li"] span[class^="ant-typography"]') | ||
.should('be.visible') | ||
.first() | ||
.click({ force: true }); | ||
deleteFromDomainDropdown(); | ||
} | ||
}); | ||
cy.waitTextVisible('My custom domain'); | ||
} | ||
|
||
describe("nested domains test", () => { | ||
beforeEach (() => { | ||
cy.loginWithCredentials(); | ||
cy.goToDomainList(); | ||
}); | ||
|
||
it("Create a new domain", () => { | ||
deleteExisitingDomain() | ||
createDomain(); | ||
cy.waitTextVisible("Domains"); | ||
}); | ||
|
||
it("Move domain root level to parent level", () => { | ||
cy.waitTextVisible(domainName) | ||
moveDomaintoRootLevel(); | ||
cy.waitTextVisible("Moved Domain!") | ||
cy.goToDomainList(); | ||
cy.ensureTextNotPresent(domainName); | ||
cy.ensureTextNotPresent(domainDescription); | ||
cy.waitTextVisible("1 sub-domain"); | ||
}); | ||
|
||
// Move a domain from under a parent domain to the root level | ||
cy.get('[data-testid="domain-list-item"]').contains("Marketing").prev().click(); | ||
cy.clickOptionWithText(domainName); | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-move-button"); | ||
cy.clickOptionWithTestId("move-domain-modal-move-button").wait(5000); | ||
it("Move domain parent level to root level", () => { | ||
moveDomaintoParent(); | ||
cy.waitTextVisible("Moved Domain!") | ||
cy.goToDomainList(); | ||
cy.waitTextVisible(domainName); | ||
cy.waitTextVisible(domainDescription); | ||
}); | ||
|
||
// Delete a domain | ||
cy.clickOptionWithText(domainName).wait(3000); | ||
cy.openThreeDotDropdown(); | ||
cy.clickOptionWithTestId("entity-menu-delete-button"); | ||
cy.waitTextVisible("Are you sure you want to remove this Domain?"); | ||
cy.clickOptionWithText("Yes"); | ||
cy.waitTextVisible("Deleted Domain!"); | ||
it("Remove the domain", () => { | ||
deleteDomain(); | ||
cy.goToDomainList(); | ||
cy.ensureTextNotPresent(domainName); | ||
cy.ensureTextNotPresent(domainDescription); | ||
}); | ||
}); | ||
}); |