Shun Miyazawa 4 lat temu
rodzic
commit
0dab071c21

+ 2 - 4
packages/app/src/components/Common/Dropdown/PageItemControl.tsx

@@ -32,7 +32,6 @@ type CommonProps = {
   pageInfo?: IPageInfoAll,
   isEnableActions?: boolean,
   forceHideMenuItems?: ForceHideMenuItems,
-  dataTestId?: string
 
   onClickBookmarkMenuItem?: (pageId: string, newValue?: boolean) => Promise<void>,
   onClickDuplicateMenuItem?: (pageId: string) => Promise<void> | void,
@@ -203,8 +202,7 @@ type PageItemControlSubstanceProps = CommonProps & {
 export const PageItemControlSubstance = (props: PageItemControlSubstanceProps): JSX.Element => {
 
   const {
-    pageId, pageInfo: presetPageInfo, fetchOnInit,
-    children, dataTestId,
+    pageId, pageInfo: presetPageInfo, fetchOnInit, children,
     onClickBookmarkMenuItem, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
   } = props;
 
@@ -250,7 +248,7 @@ export const PageItemControlSubstance = (props: PageItemControlSubstanceProps):
   }, [onClickDeleteMenuItem, pageId, fetchedPageInfo, presetPageInfo]);
 
   return (
-    <Dropdown isOpen={isOpen} toggle={() => setIsOpen(!isOpen)} data-testid={dataTestId}>
+    <Dropdown isOpen={isOpen} toggle={() => setIsOpen(!isOpen)} data-testid="open-page-item-control-btn">
       { children ?? (
         <DropdownToggle color="transparent" className="border-0 rounded btn-page-item-control">
           <i className="icon-options text-muted"></i>

+ 0 - 1
packages/app/src/components/Navbar/SubNavButtons.tsx

@@ -171,7 +171,6 @@ const SubNavButtonsSubstance = (props: SubNavButtonsSubstanceProps): JSX.Element
       ) }
       { showPageControlDropdown && (
         <PageItemControl
-          dataTestId="open-page-item-control-button"
           pageId={pageId}
           pageInfo={pageInfo}
           isEnableActions={!isGuestUser}

+ 27 - 6
packages/app/test/cypress/integration/2-basic-features/open-presentation-modal.spec.ts

@@ -22,8 +22,15 @@ context('Open presentation modal', () => {
 
   it('PageCreateModal for "/" is shown successfully', () => {
     cy.visit('/');
-    cy.getByTestid('open-page-item-control-button').first().click({force: true});
-    cy.getByTestid('open-presentation-modal-btn').first().click({force: true});
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-page-item-control-btn').click({force: true})
+    });
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-presentation-modal-btn').click({force: true})
+    });
+
     // eslint-disable-next-line cypress/no-unnecessary-waiting
     cy.wait(1500);
     cy.screenshot(`${ssPrefix}-opne-top`, { capture: 'viewport' });
@@ -31,8 +38,15 @@ context('Open presentation modal', () => {
 
   it('PageCreateModal for "/Sandbox/Bootstrap4" is shown successfully', () => {
     cy.visit('/Sandbox/Bootstrap4');
-    cy.getByTestid('open-page-item-control-button').first().click({force: true});
-    cy.getByTestid('open-presentation-modal-btn').first().click({force: true});
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-page-item-control-btn').click({force: true})
+    });
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-presentation-modal-btn').click({force: true})
+    });
+
     // eslint-disable-next-line cypress/no-unnecessary-waiting
     cy.wait(1500);
     cy.screenshot(`${ssPrefix}-open-bootstrap4`, { capture: 'viewport' });
@@ -40,8 +54,15 @@ context('Open presentation modal', () => {
 
   it('PageCreateModal for /Sandbox/Bootstrap4#Cards" is shown successfully', () => {
     cy.visit('/Sandbox/Bootstrap4#Cards');
-    cy.getByTestid('open-page-item-control-button').first().click({force: true});
-    cy.getByTestid('open-presentation-modal-btn').first().click({force: true});
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-page-item-control-btn').click({force: true})
+    });
+
+    cy.get('#grw-subnav-container').within(() => {
+      cy.getByTestid('open-presentation-modal-btn').click({force: true})
+    });
+
     // eslint-disable-next-line cypress/no-unnecessary-waiting
     cy.wait(1500);
     cy.screenshot(`${ssPrefix}-open-bootstrap4-with-ancker-link`, { capture: 'viewport' });