From cfda5f820a9283fa17a70ab969e15edaf316b1c0 Mon Sep 17 00:00:00 2001 From: gmandakini <45559635+gmandakini@users.noreply.github.com> Date: Thu, 31 Jan 2019 09:31:23 +0000 Subject: [PATCH] [ADF-3810] Should rearrange toolbar actions in Viewer (#4199) * in progress * done * done * moved all the expect statements into a single method 'checkButtonOrderInViewerToolbar' in viewerPage.ts * lint fixes * code review comments - updated the button list to fetch the last button in the toolbar and asserting that the last button is the 'More Actions' menu button. * code review comments * linting fixes * updated the right test case id --- .../viewer-content-services-component.e2e.ts | 11 +++++++++++ e2e/pages/adf/viewerPage.ts | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/e2e/core/viewer/viewer-content-services-component.e2e.ts b/e2e/core/viewer/viewer-content-services-component.e2e.ts index 57ff5cb710..5fb8438603 100644 --- a/e2e/core/viewer/viewer-content-services-component.e2e.ts +++ b/e2e/core/viewer/viewer-content-services-component.e2e.ts @@ -271,6 +271,17 @@ describe('Content Services Viewer', () => { viewerPage.clickCloseButton(); }); + it('[C291903] Should display the buttons in order in the adf viewer toolbar', () => { + viewerPage.viewFile(pdfFile.name); + viewerPage.checkLeftSideBarIsNotDisplayed(); + viewerPage.clickLeftSidebarButton(); + viewerPage.checkLeftSideBarIsDisplayed(); + viewerPage.enableMoreActionsMenu(); + viewerPage.checkToolbarIsDisplayed(); + expect(viewerPage.getLastButtonTitle()).toEqual(viewerPage.getMoreActionsMenuTitle()); + viewerPage.clickCloseButton(); + }); + it('[C260053] Should display first page, toolbar and pagination when opening a .docx file', () => { viewerPage.viewFile(docxFile.name); viewerPage.checkZoomInButtonIsDisplayed(); diff --git a/e2e/pages/adf/viewerPage.ts b/e2e/pages/adf/viewerPage.ts index 1b9a8ba69f..14beeb6aa4 100644 --- a/e2e/pages/adf/viewerPage.ts +++ b/e2e/pages/adf/viewerPage.ts @@ -62,12 +62,16 @@ export class ViewerPage { activeTab = element(by.css('div[class*="mat-tab-label-active"]')); toolbarSwitch = element(by.id('adf-switch-toolbar')); toolbar = element(by.id('adf-viewer-toolbar')); + lastButton = element.all(by.css('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]')).last(); datatableHeader = element(by.css('div.adf-datatable-header')); goBackSwitch = element(by.id('adf-switch-goback')); openWithSwitch = element(by.id('adf-switch-openwith')); openWith = element(by.id('adf-viewer-openwith')); + moreActionsMenuSwitch = element(by.id('adf-switch-moreactionsmenu')); + moreActionsMenu = element(by.css('button[data-automation-id="adf-toolbar-more-actions"]')); + customNameSwitch = element(by.id('adf-switch-custoname')); customToolbarToggle = element(by.id('adf-toggle-custom-toolbar')); customToolbar = element(by.css('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]')); @@ -87,9 +91,6 @@ export class ViewerPage { allowSidebarSwitch = element(by.id('adf-switch-allowsidebar')); allowLeftSidebarSwitch = element(by.id('adf-switch-allowLeftSidebar')); - shareSwitch = element(by.id('adf-switch-share')); - shareButton = element(by.id('adf-viewer-share')); - uploadButton = element(by.id('adf-viewer-upload')); timeButton = element(by.id('adf-viewer-time')); bugButton = element(by.id('adf-viewer-bug')); @@ -185,6 +186,14 @@ export class ViewerPage { Util.waitUntilElementIsVisible(this.closeButton); } + getLastButtonTitle() { + return this.lastButton.getAttribute('title'); + } + + getMoreActionsMenuTitle() { + return this.moreActionsMenu.getAttribute('title'); + } + checkDownloadButtonIsDisplayed() { Util.waitUntilElementIsVisible(this.downloadButton); } @@ -545,6 +554,10 @@ export class ViewerPage { this.formControllersPage.enableToggle(this.moreActionsSwitch); } + enableMoreActionsMenu() { + this.formControllersPage.enableToggle(this.moreActionsMenuSwitch); + } + disableCustomToolbar() { this.formControllersPage.disableToggle(this.customToolbarToggle); return this;