Shun Miyazawa 4 лет назад
Родитель
Сommit
5fe2dd9573

+ 7 - 1
packages/app/src/components/Common/Dropdown/PageItemControl.tsx

@@ -31,6 +31,7 @@ type CommonProps = {
   pageInfo?: IPageInfoAll,
   isEnableActions?: boolean,
   forceHideMenuItems?: ForceHideMenuItems,
+  dataTestId?: string
 
   onClickBookmarkMenuItem?: (pageId: string, newValue?: boolean) => Promise<void>,
   onClickDuplicateMenuItem?: (pageId: string) => Promise<void> | void,
@@ -50,6 +51,7 @@ const PageItemControlDropdownMenu = React.memo((props: DropdownMenuProps): JSX.E
   const { t } = useTranslation('');
 
   const {
+    dataTestId,
     pageId, isLoading,
     pageInfo, isEnableActions, forceHideMenuItems,
     onClickBookmarkMenuItem, onClickDuplicateMenuItem, onClickRenameMenuItem, onClickDeleteMenuItem,
@@ -168,7 +170,11 @@ const PageItemControlDropdownMenu = React.memo((props: DropdownMenuProps): JSX.E
   }
 
   return (
-    <DropdownMenu positionFixed modifiers={{ preventOverflow: { boundariesElement: undefined } }}>
+    <DropdownMenu
+      data-testid={dataTestId || ''}
+      positionFixed
+      modifiers={{ preventOverflow: { boundariesElement: undefined } }}
+    >
       {contents}
     </DropdownMenu>
   );

+ 4 - 1
packages/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -71,7 +71,10 @@ const AdditionalMenuItems = (props: AdditionalMenuItemsProps): JSX.Element => {
   return (
     <>
       {/* Presentation */}
-      <DropdownItem onClick={() => openPresentationModal(hrefForPresentationModal)}>
+      <DropdownItem
+        onClick={() => openPresentationModal(hrefForPresentationModal)}
+        data-testid="open-presentation-modal-btn"
+      >
         <i className="icon-fw"><PresentationIcon /></i>
         { t('Presentation Mode') }
       </DropdownItem>

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

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

+ 32 - 0
packages/app/test/cypress/integration/2-basic-features/access-to-presentation.spec.ts

@@ -0,0 +1,32 @@
+
+context('Access to page', () => {
+  const ssPrefix = 'access-to-presentation-modal-';
+
+  let connectSid: string | undefined;
+
+  before(() => {
+    // login
+    cy.fixture("user-admin.json").then(user => {
+      cy.login(user.username, user.password);
+    });
+    cy.getCookie('connect.sid').then(cookie => {
+      connectSid = cookie?.value;
+    });
+  });
+
+  beforeEach(() => {
+    if (connectSid != null) {
+      cy.setCookie('connect.sid', connectSid);
+    }
+  });
+
+  it('Successfully loaded the presentation modal in /.', () => {
+    cy.visit('/');
+    cy.getByTestid('grw-subnav-container-page-item-control').click();
+    cy.getByTestid('open-presentation-modal-btn').click();
+    // eslint-disable-next-line cypress/no-unnecessary-waiting
+    cy.wait(1500);
+    cy.screenshot(`${ssPrefix}-sandbox-headers`, { capture: 'viewport' });
+  });
+
+});