fix(ci): Fixing broken Domains Test (#7746)

This commit is contained in:
John Joyce 2023-04-04 01:06:34 -07:00 committed by GitHub
parent f780da4c0a
commit 3609167086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 19 deletions

View File

@ -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>
</>
@ -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) => {
@ -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>

View File

@ -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", () => {
@ -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()
})
@ -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", () => {
@ -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)
})
});