mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-11 08:54:00 +00:00
test(): Nested domains cypress test (#8879)
This commit is contained in:
parent
c0feceb76f
commit
b191abbc5b
@ -191,7 +191,10 @@ export default function CreateDomainModal({ onClose, onCreate }: Props) {
|
||||
rules={[{ whitespace: true }, { min: 1, max: 500 }]}
|
||||
hasFeedback
|
||||
>
|
||||
<Input.TextArea placeholder="A description for your domain" />
|
||||
<Input.TextArea
|
||||
placeholder="A description for your domain"
|
||||
data-testid="create-domain-description"
|
||||
/>
|
||||
</FormItemNoMargin>
|
||||
</FormItemWithMargin>
|
||||
<Collapse ghost>
|
||||
|
@ -42,7 +42,12 @@ export default function ManageDomainsPageV2() {
|
||||
<OnboardingTour stepIds={[DOMAINS_INTRO_ID, DOMAINS_CREATE_DOMAIN_ID]} />
|
||||
<Header>
|
||||
<DomainsTitle />
|
||||
<Button type="primary" id={DOMAINS_CREATE_DOMAIN_ID} onClick={() => setIsCreatingDomain(true)}>
|
||||
<Button
|
||||
type="primary"
|
||||
id={DOMAINS_CREATE_DOMAIN_ID}
|
||||
onClick={() => setIsCreatingDomain(true)}
|
||||
data-testid="domains-new-domain-button"
|
||||
>
|
||||
<PlusOutlined /> New Domain
|
||||
</Button>
|
||||
</Header>
|
||||
|
@ -103,7 +103,7 @@ export default function DomainNode({ domain, numDomainChildren, domainUrnToHide,
|
||||
|
||||
return (
|
||||
<>
|
||||
<RowWrapper>
|
||||
<RowWrapper data-testid="domain-list-item">
|
||||
{hasDomainChildren && (
|
||||
<ButtonWrapper>
|
||||
<RotatingTriangle isOpen={isOpen && !isClosing} onClick={toggle} />
|
||||
|
@ -203,7 +203,7 @@ function EntityDropdown(props: Props) {
|
||||
disabled={isMoveDisabled(entityType, entityData, me.platformPrivileges)}
|
||||
onClick={() => setIsMoveModalVisible(true)}
|
||||
>
|
||||
<MenuItem>
|
||||
<MenuItem data-testid="entity-menu-move-button">
|
||||
<FolderOpenOutlined /> Move
|
||||
</MenuItem>
|
||||
</StyledMenuItem>
|
||||
@ -223,7 +223,7 @@ function EntityDropdown(props: Props) {
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<MenuItem>
|
||||
<MenuItem data-testid="entity-menu-delete-button">
|
||||
<DeleteOutlined /> Delete
|
||||
</MenuItem>
|
||||
</Tooltip>
|
||||
|
@ -67,6 +67,7 @@ function MoveDomainModal(props: Props) {
|
||||
return (
|
||||
<Modal
|
||||
title="Move"
|
||||
data-testid="move-domain-modal"
|
||||
visible
|
||||
onCancel={onClose}
|
||||
footer={
|
||||
@ -74,7 +75,9 @@ function MoveDomainModal(props: Props) {
|
||||
<Button onClick={onClose} type="text">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={moveDomain}>Move</Button>
|
||||
<Button onClick={moveDomain} data-testid="move-domain-modal-move-button">
|
||||
Move
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
|
@ -0,0 +1,53 @@
|
||||
const domainName = "CypressNestedDomain";
|
||||
const domainDescription = "CypressNestedDomainDescription";
|
||||
|
||||
describe("nested domains test", () => {
|
||||
|
||||
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);
|
||||
|
||||
// Ensure the new domain has no parent in the navigation sidebar
|
||||
cy.waitTextVisible(domainDescription);
|
||||
|
||||
// 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);
|
||||
|
||||
// Wnsure domain is no longer on the sidebar navigator at the top level but shows up under the parent
|
||||
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);
|
||||
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!");
|
||||
cy.ensureTextNotPresent(domainName);
|
||||
cy.ensureTextNotPresent(domainDescription);
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user