[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
This commit is contained in:
gmandakini
2019-01-31 09:31:23 +00:00
committed by Eugenio Romano
parent f77764bc21
commit cfda5f820a
2 changed files with 27 additions and 3 deletions

View File

@@ -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();

View File

@@ -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;