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

fix(ci): Fixing broken Domains Test #7746

Merged
merged 4 commits into from
Apr 4, 2023
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
11 changes: 8 additions & 3 deletions datahub-web-react/src/app/domain/CreateDomainModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ export default function CreateDomainModal({ onClose, onCreate }: Props) {
<Button onClick={onClose} type="text">
Cancel
</Button>
<Button id="createDomainButton" onClick={onCreateDomain} disabled={!createButtonEnabled}>
<Button
id="createDomainButton"
data-testid="create-domain-button"
onClick={onCreateDomain}
disabled={!createButtonEnabled}
>
Create
</Button>
</>
Expand Down Expand Up @@ -110,7 +115,7 @@ export default function CreateDomainModal({ onClose, onCreate }: Props) {
]}
hasFeedback
>
<Input placeholder="A name for your domain" />
<Input data-testid="create-domain-name" placeholder="A name for your domain" />
</Form.Item>
<SuggestedNamesGroup>
{SUGGESTED_DOMAIN_NAMES.map((name) => {
Expand Down Expand Up @@ -164,7 +169,7 @@ export default function CreateDomainModal({ onClose, onCreate }: Props) {
}),
]}
>
<Input placeholder="engineering" />
<Input data-testid="create-domain-id" placeholder="engineering" />
</Form.Item>
</Form.Item>
</Collapse.Panel>
Expand Down
32 changes: 16 additions & 16 deletions smoke-test/tests/cypress/cypress/e2e/mutations/domains.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const test_domain = "CypressDomainTest";
let domain_created_urn = ""
const test_domain_id = Math.floor(Math.random() * 100000);
const test_domain = `CypressDomainTest ${test_domain_id}`
const test_domain_urn = `urn:li:domain:${test_domain_id}`


describe("add remove domain", () => {
it("create domain", () => {
cy.login();
cy.goToDomainList();
cy.clickOptionWithText("New Domain");
cy.addViaModal(test_domain, "Create new Domain")
cy.waitTextVisible("Created domain!")
cy.waitTextVisible("Create new Domain");
cy.get('[data-testid="create-domain-name"]').click().type(test_domain)
cy.clickOptionWithText('Advanced')
cy.get('[data-testid="create-domain-id"]').click().type(test_domain_id)
cy.get('[data-testid="create-domain-button"]').click()
cy.waitTextVisible(test_domain)
.parents("[data-testid^='urn:li:domain:']")
.invoke('attr', 'data-testid')
.then((data_test_id) => {
domain_created_urn = data_test_id;
})
})

it("add entities to domain", () => {
Expand All @@ -23,8 +23,8 @@ describe("add remove domain", () => {
cy.waitTextVisible("Add assets")
cy.clickOptionWithText("Add assets")
cy.get(".ant-modal-content").within(() => {
cy.get('[data-testid="search-input"]').click().type("jaffle_shop")
cy.waitTextVisible("jaffle_shop")
cy.get('[data-testid="search-input"]').click().invoke("val", "cypress_project.jaffle_shop.").type("customer")
cy.contains("BigQuery")
cy.get(".ant-checkbox-input").first().click()
cy.get("#continueButton").click()
})
Expand All @@ -35,8 +35,8 @@ describe("add remove domain", () => {
cy.login();
cy.goToStarSearchList()
cy.waitTextVisible(test_domain)
cy.get('[data-testid="facet-domains-' + domain_created_urn + '"]').click()
cy.waitTextVisible("jaffle_shop")
cy.get('[data-testid="facet-domains-' + test_domain_urn + '"]').click()
cy.waitTextVisible("customers")
})

it("remove entity from domain", () => {
Expand All @@ -45,20 +45,20 @@ describe("add remove domain", () => {
cy.removeDomainFromDataset(
"urn:li:dataset:(urn:li:dataPlatform:bigquery,cypress_project.jaffle_shop.customers,PROD)",
"customers",
domain_created_urn
test_domain_urn
)
})

it("delete a domain and ensure dangling reference is deleted on entities", () => {
cy.login();
cy.goToDomainList();
cy.get('[data-testid="dropdown-menu-' + domain_created_urn + '"]').click();
cy.get('[data-testid="dropdown-menu-' + test_domain_urn + '"]').click();
cy.clickOptionWithText("Delete");
cy.clickOptionWithText("Yes");
cy.ensureTextNotPresent(test_domain)

cy.goToContainer("urn:li:container:348c96555971d3f5c1ffd7dd2e7446cb")
cy.waitTextVisible("jaffle_shop")
cy.waitTextVisible("customers")
cy.ensureTextNotPresent(test_domain)
})
});