Skip to content

Commit

Permalink
fix: cypress test fix for glossary_navifation
Browse files Browse the repository at this point in the history
  • Loading branch information
Salman-Apptware committed Nov 30, 2023
1 parent c0a9b4d commit 04bdeff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useUpdateParentNodeMutation } from '../../../../graphql/glossary.genera
import NodeParentSelect from './NodeParentSelect';
import { useGlossaryEntityData } from '../GlossaryEntityContext';
import { getGlossaryRootToUpdate, getParentNodeToUpdate, updateGlossarySidebar } from '../../../glossary/utils';
import { getModalDomContainer } from '../../../../utils/focus';

const StyledItem = styled(Form.Item)`
margin-bottom: 0;
Expand Down Expand Up @@ -68,6 +69,7 @@ function MoveGlossaryEntityModal(props: Props) {
title="Move"
visible
onCancel={onClose}
getContainer={getModalDomContainer}
footer={
<>
<Button onClick={onClose} type="text">
Expand All @@ -92,6 +94,7 @@ function MoveGlossaryEntityModal(props: Props) {
selectedParentUrn={selectedParentUrn}
setSelectedParentUrn={setSelectedParentUrn}
isMoving
autoFocus
/>
</StyledItem>
</Form.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface Props {
selectedParentUrn: string;
setSelectedParentUrn: (parent: string) => void;
isMoving?: boolean;
autoFocus?: boolean;
}

function NodeParentSelect(props: Props) {
Expand Down Expand Up @@ -56,6 +57,7 @@ function NodeParentSelect(props: Props) {
return (
<ClickOutside onClickOutside={() => setIsFocusedOnInput(false)}>
<Select
autoFocus={props?.autoFocus}
showSearch
allowClear
filterOption={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ describe("glossary sidebar navigation test", () => {
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryTermGroup).click().wait(3000);
cy.get('*[class^="GlossaryEntitiesList"]').contains(glossaryTerm).should("be.visible");

// create glossaryParentGroup
cy.goToGlossaryList();
cy.clickOptionWithTestId("add-term-group-button");
cy.waitTextVisible("Create Term Group");
cy.enterTextInTestId("create-glossary-entity-modal-name", glossaryParentGroup);
cy.clickOptionWithTestId("glossary-entity-modal-create-button");
cy.get('[data-testid="glossary-browser-sidebar"]').contains(glossaryParentGroup).should("be.visible");


// Move a term group from the root level to be under a parent term group
cy.goToGlossaryList();
cy.clickOptionWithText(glossaryTermGroup);
Expand All @@ -55,9 +64,14 @@ describe("glossary sidebar navigation test", () => {
cy.clickOptionWithText(glossaryTermGroup).wait(3000);
cy.deleteFromDropdown();
cy.waitTextVisible("Deleted Term Group!");
cy.clickOptionWithText(glossaryParentGroup);
cy.deleteFromDropdown();
cy.waitTextVisible("Deleted Term Group!");

// Ensure it is no longer in the sidebar navigator
cy.ensureTextNotPresent(glossaryTerm);
cy.ensureTextNotPresent(glossaryTermGroup);
cy.ensureTextNotPresent(glossaryParentGroup);

});
});

0 comments on commit 04bdeff

Please sign in to comment.