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

Use data-testids for glossary_navigation and dataset_ownership tests #9033

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
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function CreateGlossaryEntityModal(props: Props) {
<Button onClick={onClose} type="text">
Cancel
</Button>
<Button onClick={createGlossaryEntity} disabled={createButtonDisabled}>
<Button
onClick={createGlossaryEntity}
disabled={createButtonDisabled}
data-testid="glossary-entity-modal-create-button"
>
Create
</Button>
</>
Expand All @@ -130,6 +134,7 @@ function CreateGlossaryEntityModal(props: Props) {
>
<Form.Item label={<Typography.Text strong>Name</Typography.Text>}>
<StyledItem
data-testid="create-glossary-entity-modal-name"
name="name"
rules={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ function EntityDropdown(props: Props) {
)}
{!isDomainMoveHidden && menuItems.has(EntityMenuItems.MOVE) && (
<StyledMenuItem
data-testid="entity-menu-move-button"
key="4"
disabled={isMoveDisabled(entityType, entityData, me.platformPrivileges)}
onClick={() => setIsMoveModalVisible(true)}
>
<MenuItem data-testid="entity-menu-move-button">
<MenuItem>
<FolderOpenOutlined /> &nbsp;Move
</MenuItem>
</StyledMenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function MoveGlossaryEntityModal(props: Props) {

return (
<Modal
data-testid="move-glossary-entity-modal"
title="Move"
visible
onCancel={onClose}
Expand All @@ -72,7 +73,9 @@ function MoveGlossaryEntityModal(props: Props) {
<Button onClick={onClose} type="text">
Cancel
</Button>
<Button onClick={moveGlossaryEntity}>Move</Button>
<Button onClick={moveGlossaryEntity} data-testid="glossary-entity-modal-move-button">
Move
</Button>
</>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export const SidebarOwnerSection = ({ properties, readOnly }: Props) => {
</Typography.Paragraph>
)}
{!readOnly && (
<Button type={ownersEmpty ? 'default' : 'text'} onClick={() => setShowAddModal(true)}>
<Button
type={ownersEmpty ? 'default' : 'text'}
onClick={() => setShowAddModal(true)}
data-testid="add-owners-button"
>
<PlusOutlined /> Add Owners
</Button>
)}
Expand Down
4 changes: 3 additions & 1 deletion datahub-web-react/src/app/glossary/BusinessGlossaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ function BusinessGlossaryPage() {
{(termsError || nodesError) && (
<Message type="error" content="Failed to load glossary! An unexpected error occurred." />
)}
<MainContentWrapper>
<MainContentWrapper data-testid="glossary-entities-list">
<HeaderWrapper>
<Typography.Title level={3}>Business Glossary</Typography.Title>
<div>
<Button
data-testid="add-term-button"
id={BUSINESS_GLOSSARY_CREATE_TERM_ID}
disabled={!canManageGlossaries}
type="text"
Expand All @@ -105,6 +106,7 @@ function BusinessGlossaryPage() {
<PlusOutlined /> Add Term
</Button>
<Button
data-testid="add-term-group-button"
id={BUSINESS_GLOSSARY_CREATE_TERM_GROUP_ID}
disabled={!canManageGlossaries}
type="text"
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/glossary/GlossarySidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function GlossarySidebar() {

return (
<>
<SidebarWrapper width={browserWidth}>
<SidebarWrapper width={browserWidth} data-testid="glossary-browser-sidebar">
<GlossarySearch />
<GlossaryBrowser openToEntity />
</SidebarWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,48 @@ const glossaryParentGroup = "Cypress";

describe("glossary sidebar navigation test", () => {
it("create term and term parent group, move and delete term group", () => {
//create a new term group and term, move term to the group

// Create a new term group and term, move term to the group
cy.loginWithCredentials();
cy.goToGlossaryList();
cy.clickOptionWithText("Add Term Group");
cy.clickOptionWithTestId("add-term-group-button");
cy.waitTextVisible("Create Term Group");
cy.get(".ant-input-affix-wrapper > input[type='text']").first().type(glossaryTermGroup);
cy.get(".ant-modal-footer > button:last-child").click();
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTermGroup).should("be.visible");
cy.clickOptionWithText("Add Term");
cy.enterTextInTestId("create-glossary-entity-modal-name", glossaryTermGroup);
cy.clickOptionWithTestId("glossary-entity-modal-create-button");
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryTermGroup).should("be.visible");
cy.clickOptionWithTestId("add-term-button");
cy.waitTextVisible("Created Term Group!");
cy.waitTextVisible("Create Glossary Term");
cy.get(".ant-input-affix-wrapper > input[type='text']").first().type(glossaryTerm);
cy.get(".ant-modal-footer > button:last-child").click();
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTerm).click();
cy.waitTextVisible("No documentation yet");
cy.enterTextInTestId("create-glossary-entity-modal-name", glossaryTerm);
cy.clickOptionWithTestId("glossary-entity-modal-create-button");
cy.waitTextVisible("Created Glossary Term!");
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryTerm).click().wait(3000);
cy.openThreeDotDropdown();
cy.clickOptionWithText("Move");
cy.get('[role="dialog"]').contains(glossaryTermGroup).click({force: true});
cy.get('[role="dialog"]').contains(glossaryTermGroup).should("be.visible");
cy.get("button").contains("Move").click();
cy.clickOptionWithTestId("entity-menu-move-button")
cy.get('[data-testid="move-glossary-entity-modal"]').contains(glossaryTermGroup).click({force: true});
cy.get('[data-testid="move-glossary-entity-modal"]').contains(glossaryTermGroup).should("be.visible");
cy.clickOptionWithTestId("glossary-entity-modal-move-button");
cy.waitTextVisible("Moved Glossary Term!");
//ensure the new term is under the parent term group in the navigation sidebar
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryTermGroup).click();

// Ensure the new term is under the parent term group in the navigation sidebar
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryTermGroup).click();
cy.get('*[class^="GlossaryEntitiesList"]').contains(glossaryTerm).should("be.visible");
//move a term group from the root level to be under a parent term group

// Move a term group from the root level to be under a parent term group
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryTermGroup);
cy.openThreeDotDropdown();
cy.clickOptionWithText("Move");
cy.get('[role="dialog"]').contains(glossaryParentGroup).click({force: true});
cy.get('[role="dialog"]').contains(glossaryParentGroup).should("be.visible");
cy.get("button").contains("Move").click();
cy.get('[data-testid="move-glossary-entity-modal"]').contains(glossaryParentGroup).click({force: true});
cy.get('[data-testid="move-glossary-entity-modal"]').contains(glossaryParentGroup).should("be.visible");
cy.clickOptionWithTestId("glossary-entity-modal-move-button");
cy.waitTextVisible("Moved Term Group!");
//ensure it is no longer on the sidebar navigator at the top level but shows up under the new parent
cy.get('*[class^="GlossaryBrowser"]').contains(glossaryParentGroup).click();

// Ensure it is no longer on the sidebar navigator at the top level but shows up under the new parent
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryParentGroup).click();
cy.get('*[class^="GlossaryEntitiesList"]').contains(glossaryTermGroup).should("be.visible");
//delete a term group

// Delete a term group
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryParentGroup);
cy.clickOptionWithText(glossaryTermGroup);
Expand All @@ -50,7 +56,8 @@ describe("glossary sidebar navigation test", () => {
cy.clickOptionWithText(glossaryTermGroup).wait(3000);
cy.deleteFromDropdown();
cy.waitTextVisible("Deleted Term Group!");
//ensure it is no longer in the sidebar navigator

// Ensure it is no longer in the sidebar navigator
cy.ensureTextNotPresent(glossaryTerm);
cy.ensureTextNotPresent(glossaryTermGroup);
});
Expand Down
2 changes: 0 additions & 2 deletions smoke-test/tests/cypress/cypress/e2e/lineage/lineage_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const TASKS_ENTITY_TYPE = 'tasks';
const DATASET_URN = 'urn:li:dataset:(urn:li:dataPlatform:kafka,SampleCypressKafkaDataset,PROD)';
const JAN_1_2021_TIMESTAMP = 1609553357755;
const JAN_1_2022_TIMESTAMP = 1641089357755;
const TIMESTAMP_MILLIS_EIGHT_DAYS_AGO = getTimestampMillisNumDaysAgo(8);
const TIMESTAMP_MILLIS_ONE_DAY_AGO = getTimestampMillisNumDaysAgo(1);
const TIMESTAMP_MILLIS_14_DAYS_AGO = getTimestampMillisNumDaysAgo(14);
const TIMESTAMP_MILLIS_7_DAYS_AGO = getTimestampMillisNumDaysAgo(7);
const TIMESTAMP_MILLIS_NOW = getTimestampMillisNumDaysAgo(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const password = "Example password";
const group_name = `Test group ${test_id}`;

const addOwner = (owner, type, elementId) => {
cy.clickOptionWithText("Add Owners");
cy.clickOptionWithTestId("add-owners-button");
cy.contains("Search for users or groups...").click({ force: true });
cy.focused().type(owner);
cy.clickOptionWithText(owner);
Expand Down
1 change: 1 addition & 0 deletions smoke-test/tests/cypress/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Cypress.Commands.add("logout", () => {
Cypress.Commands.add("goToGlossaryList", () => {
cy.visit("/glossary");
cy.waitTextVisible("Glossary");
cy.wait(3000);
});

Cypress.Commands.add("goToDomainList", () => {
Expand Down
Loading