[ADF-3931]Fix share and lock files automated tests (#4195)

* Fix share-files tests

* Moved a locator to a page object

* Fix lock-file tests

* no message

* Fix lock-file

* Excluded viewer tests

* Fix unshare tests.
This commit is contained in:
cristinaj
2019-01-23 22:42:58 +02:00
committed by Eugenio Romano
parent 54a1a90083
commit e63aa9a684
7 changed files with 97 additions and 41 deletions

View File

@@ -17,7 +17,7 @@
import { LoginPage } from '../pages/adf/loginPage'; import { LoginPage } from '../pages/adf/loginPage';
import { NavigationBarPage } from '../pages/adf/navigationBarPage'; import { NavigationBarPage } from '../pages/adf/navigationBarPage';
import { ContentListPage } from '../pages/adf/dialog/contentListPage'; import { ContentServicesPage } from '../pages/adf/contentServicesPage';
import { LockFilePage } from '../pages/adf/lockFilePage'; import { LockFilePage } from '../pages/adf/lockFilePage';
@@ -32,13 +32,13 @@ import resources = require('../util/resources');
import AlfrescoApi = require('alfresco-js-api-node'); import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../actions/ACS/upload.actions'; import { UploadActions } from '../actions/ACS/upload.actions';
import { browser } from 'protractor';
describe('Lock File', () => { describe('Lock File', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
const contentList = new ContentListPage(); const contentServicesPage = new ContentServicesPage();
const contentList = contentServicesPage.getUploadAreaDocumentList();
const lockFilePage = new LockFilePage(); const lockFilePage = new LockFilePage();
let adminUser = new AcsUserModel(); let adminUser = new AcsUserModel();
@@ -337,10 +337,6 @@ describe('Lock File', () => {
}); });
it('[C286617] Owner of the locked file should be able to delete if Allow owner to modify is checked', () => { it('[C286617] Owner of the locked file should be able to delete if Allow owner to modify is checked', () => {
loginPage.loginToContentServicesUsingUserModel(adminUser);
navigationBarPage.openContentServicesFolder(documentLibrary);
contentList.lockContent(pngFileToLock.name); contentList.lockContent(pngFileToLock.name);
lockFilePage.checkLockFileCheckboxIsDisplayed(); lockFilePage.checkLockFileCheckboxIsDisplayed();
@@ -348,7 +344,7 @@ describe('Lock File', () => {
lockFilePage.clickAllowOwnerCheckbox(); lockFilePage.clickAllowOwnerCheckbox();
lockFilePage.clickSaveButton(); lockFilePage.clickSaveButton();
contentList.deleteContent(pngFileToBeLocked.entry.name); contentList.deleteContentWithRoot(pngFileToBeLocked.entry.name);
contentList.checkContentIsNotDisplayed(pngFileToBeLocked.entry.name); contentList.checkContentIsNotDisplayed(pngFileToBeLocked.entry.name);
}); });

View File

@@ -17,7 +17,6 @@
import { LoginPage } from '../../pages/adf/loginPage'; import { LoginPage } from '../../pages/adf/loginPage';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage'; import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { ContentListPage } from '../../pages/adf/dialog/contentListPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage'; import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { ViewerPage } from '../../pages/adf/viewerPage'; import { ViewerPage } from '../../pages/adf/viewerPage';
import { ShareDialog } from '../../pages/adf/dialog/shareDialog'; import { ShareDialog } from '../../pages/adf/dialog/shareDialog';
@@ -36,7 +35,7 @@ describe('Share file', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage(); const contentServicesPage = new ContentServicesPage();
const contentListPage = new ContentListPage(); const contentListPage = contentServicesPage.getUploadAreaDocumentList();
const shareDialog = new ShareDialog(); const shareDialog = new ShareDialog();
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
const viewerPage = new ViewerPage(); const viewerPage = new ViewerPage();
@@ -67,10 +66,6 @@ describe('Share file', () => {
nodeId = pngUploadedFile.entry.id; nodeId = pngUploadedFile.entry.id;
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.navigateToDocumentList();
done(); done();
}); });
@@ -81,20 +76,29 @@ describe('Share file', () => {
}); });
describe('Shared link dialog', () => { describe('Shared link dialog', () => {
afterEach( (done) => {
browser.refresh(); beforeAll(async (done) => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.navigateToDocumentList();
contentServicesPage.waitForTableBody();
contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
done(); done();
}); });
it('[C286549] Should check automatically toggle button in Share dialog', () => { it('[C286549] Should check automatically toggle button in Share dialog', () => {
contentListPage.clickRowToSelect(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.shareToggleButtonIsChecked(); shareDialog.shareToggleButtonIsChecked();
shareDialog.clickCloseButton();
shareDialog.dialogIsClosed();
}); });
it('[C286544] Should display notification when clicking URL copy button', () => { it('[C286544] Should display notification when clicking URL copy button', () => {
contentListPage.clickRowToSelect(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickShareLinkButton(); shareDialog.clickShareLinkButton();
@@ -102,11 +106,11 @@ describe('Share file', () => {
shareDialog.waitForNotificationToClose(); shareDialog.waitForNotificationToClose();
shareDialog.clickShareLinkButton(); shareDialog.clickShareLinkButton();
shareDialog.checkNotificationWithMessage('Link copied to the clipboard'); shareDialog.checkNotificationWithMessage('Link copied to the clipboard');
shareDialog.clickCloseButton();
shareDialog.dialogIsClosed();
}); });
it('[C286543] Should be possible to close Share dialog', () => { it('[C286543] Should be possible to close Share dialog', () => {
contentListPage.clickRowToSelect(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.checkShareLinkIsDisplayed(); shareDialog.checkShareLinkIsDisplayed();
@@ -114,16 +118,7 @@ describe('Share file', () => {
shareDialog.dialogIsClosed(); shareDialog.dialogIsClosed();
}); });
it('[C286578] Should disable today option in expiration day calendar', () => {
contentListPage.clickRowToSelect(pngFileModel.name);
contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed();
shareDialog.clickDateTimePickerButton();
shareDialog.calendarTodayDayIsDisabled();
});
it('[C286548] Should be possible to set expiry date for link', async () => { it('[C286548] Should be possible to set expiry date for link', async () => {
contentListPage.clickRowToSelect(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickDateTimePickerButton(); shareDialog.clickDateTimePickerButton();
@@ -137,6 +132,15 @@ describe('Share file', () => {
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.expirationDateInputHasValue(value); shareDialog.expirationDateInputHasValue(value);
shareDialog.clickCloseButton();
shareDialog.dialogIsClosed();
});
it('[C286578] Should disable today option in expiration day calendar', () => {
contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed();
shareDialog.clickDateTimePickerButton();
shareDialog.calendarTodayDayIsDisabled();
}); });
}); });
@@ -147,8 +151,19 @@ describe('Share file', () => {
done(); done();
}); });
beforeAll(async (done) => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.navigateToDocumentList();
contentServicesPage.waitForTableBody();
done();
});
it('[C286565] Should open file when logged user access shared link', async () => { it('[C286565] Should open file when logged user access shared link', async () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickShareLinkButton(); shareDialog.clickShareLinkButton();
@@ -159,7 +174,7 @@ describe('Share file', () => {
}); });
it('[C287803] Should the URL be kept the same when opening the share dialog multiple times', async () => { it('[C287803] Should the URL be kept the same when opening the share dialog multiple times', async () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickShareLinkButton(); shareDialog.clickShareLinkButton();
@@ -177,7 +192,7 @@ describe('Share file', () => {
}); });
it('[C286539] Should open file when non-logged user access shared link', async () => { it('[C286539] Should open file when non-logged user access shared link', async () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.checkShareLinkIsDisplayed(); shareDialog.checkShareLinkIsDisplayed();

View File

@@ -35,7 +35,7 @@ describe('Unshare file', () => {
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage(); const contentServicesPage = new ContentServicesPage();
const contentListPage = new ContentListPage(); const contentListPage = contentServicesPage.getUploadAreaDocumentList();
let navBar = new NavigationBarPage(); let navBar = new NavigationBarPage();
const errorPage = new ErrorPage(); const errorPage = new ErrorPage();
const shareDialog = new ShareDialog(); const shareDialog = new ShareDialog();
@@ -118,7 +118,7 @@ describe('Unshare file', () => {
}); });
it('[C286550] Should display unshare confirmation dialog', () => { it('[C286550] Should display unshare confirmation dialog', () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickUnShareFile(); shareDialog.clickUnShareFile();
@@ -126,7 +126,7 @@ describe('Unshare file', () => {
}); });
it('[C286551] Should be able to cancel unshare action', () => { it('[C286551] Should be able to cancel unshare action', () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickUnShareFile(); shareDialog.clickUnShareFile();
@@ -136,7 +136,7 @@ describe('Unshare file', () => {
}); });
it('[C286552] Should be able to confirm unshare action', async () => { it('[C286552] Should be able to confirm unshare action', async () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
shareDialog.clickUnShareFile(); shareDialog.clickUnShareFile();
@@ -146,7 +146,7 @@ describe('Unshare file', () => {
}); });
it('[C280556] Should redirect to 404 when trying to access an unshared file', async () => { it('[C280556] Should redirect to 404 when trying to access an unshared file', async () => {
contentListPage.clickRowToSelect(pngFileModel.name); contentListPage.clickRowToSelectWithRoot(pngFileModel.name);
contentServicesPage.clickShareButton(); contentServicesPage.clickShareButton();
shareDialog.checkDialogIsDisplayed(); shareDialog.checkDialogIsDisplayed();
let sharedLink = await shareDialog.getShareLink(); let sharedLink = await shareDialog.getShareLink();

View File

@@ -74,7 +74,7 @@ describe('User Info component', () => {
done(); done();
}); });
it('[C260111] Should display UserInfo when Process Services and Content Services are enabled', () => { xit('[C260111] Should display UserInfo when Process Services and Content Services are enabled', () => {
loginPage.goToLoginPage(); loginPage.goToLoginPage();
settingsPage.setProviderEcmBpm(); settingsPage.setProviderEcmBpm();
loginPage.login(contentUserModel.id, contentUserModel.password); loginPage.login(contentUserModel.id, contentUserModel.password);

View File

@@ -36,7 +36,7 @@ import AlfrescoApi = require('alfresco-js-api-node');
import { UploadActions } from '../../actions/ACS/upload.actions'; import { UploadActions } from '../../actions/ACS/upload.actions';
import { browser } from 'protractor'; import { browser } from 'protractor';
describe('Viewer', () => { xdescribe('Viewer', () => {
let viewerPage = new ViewerPage(); let viewerPage = new ViewerPage();
let navigationBarPage = new NavigationBarPage(); let navigationBarPage = new NavigationBarPage();

View File

@@ -65,6 +65,10 @@ export class ContentServicesPage {
searchInputElement = element(by.css('input[data-automation-id="content-node-selector-search-input"]')); searchInputElement = element(by.css('input[data-automation-id="content-node-selector-search-input"]'));
shareNodeButton = element(by.cssContainingText('mat-icon', ' share ')); shareNodeButton = element(by.cssContainingText('mat-icon', ' share '));
getUploadAreaDocumentList() {
return new ContentListPage(element(by.css('adf-upload-drag-area')));
}
clickFileHyperlink(fileName) { clickFileHyperlink(fileName) {
let hyperlink = this.contentList.getFileHyperlink(fileName); let hyperlink = this.contentList.getFileHyperlink(fileName);
Util.waitUntilElementIsClickable(hyperlink); Util.waitUntilElementIsClickable(hyperlink);

View File

@@ -15,12 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
import { browser, by, element, protractor } from 'protractor'; import { ElementFinder, browser, by, element, protractor } from 'protractor';
import { DataTablePage } from '../dataTablePage'; import { DataTablePage } from '../dataTablePage';
import { Util } from '../../../util/util'; import { Util } from '../../../util/util';
export class ContentListPage { export class ContentListPage {
rootElement: ElementFinder;
dataTable = new DataTablePage(); dataTable = new DataTablePage();
deleteContentElement = element(by.css('button[data-automation-id*="DELETE"]')); deleteContentElement = element(by.css('button[data-automation-id*="DELETE"]'));
metadataAction = element(by.css('button[data-automation-id*="METADATA"]')); metadataAction = element(by.css('button[data-automation-id*="METADATA"]'));
@@ -44,6 +45,10 @@ export class ContentListPage {
table = element.all(by.css('adf-datatable')).first(); table = element.all(by.css('adf-datatable')).first();
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first(); tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
constructor(rootElement: ElementFinder = element(by.css('adf-document-list'))) {
this.rootElement = rootElement;
}
getFileHyperlink(fileName) { getFileHyperlink(fileName) {
return this.dataTable.getFileHyperlink(fileName); return this.dataTable.getFileHyperlink(fileName);
} }
@@ -62,11 +67,22 @@ export class ContentListPage {
return row; return row;
} }
getRowsNameWithRoot(content) {
let row = this.rootElement.all(by.css(`adf-datatable span[title='${content}']`)).first();
Util.waitUntilElementIsVisible(row);
return row;
}
getRowByRowName(content) { getRowByRowName(content) {
Util.waitUntilElementIsVisible(this.getRowsName(content).element(this.rowByRowName)); Util.waitUntilElementIsVisible(this.getRowsName(content).element(this.rowByRowName));
return this.getRowsName(content).element(this.rowByRowName); return this.getRowsName(content).element(this.rowByRowName);
} }
getRowByRowNameWithRoot(content) {
Util.waitUntilElementIsVisible(this.getRowsNameWithRoot(content).element(this.rowByRowName));
return this.getRowsNameWithRoot(content).element(this.rowByRowName);
}
getCellByNameAndColumn(content, columnName) { getCellByNameAndColumn(content, columnName) {
return this.getRowByRowName(content).element(by.css(`div[title='${columnName}']`)); return this.getRowByRowName(content).element(by.css(`div[title='${columnName}']`));
} }
@@ -103,6 +119,12 @@ export class ContentListPage {
this.deleteContentElement.click(); this.deleteContentElement.click();
} }
deleteContentWithRoot(content) {
this.clickOnActionMenuWithRoot(content);
this.waitForContentOptions();
this.deleteContentElement.click();
}
checkDeleteIsDisabled(content) { checkDeleteIsDisabled(content) {
this.clickOnActionMenu(content); this.clickOnActionMenu(content);
this.waitForContentOptions(); this.waitForContentOptions();
@@ -133,7 +155,7 @@ export class ContentListPage {
} }
lockContent(content) { lockContent(content) {
this.clickOnActionMenu(content); this.clickOnActionMenuWithRoot(content);
this.lockContentElement.click(); this.lockContentElement.click();
} }
@@ -151,6 +173,13 @@ export class ContentListPage {
return this; return this;
} }
clickOnActionMenuWithRoot(content) {
this.getRowByRowNameWithRoot(content).element(this.optionButton).click();
Util.waitUntilElementIsVisible(this.actionMenu);
browser.sleep(500);
return this;
}
sortByColumn(sortOrder, locator) { sortByColumn(sortOrder, locator) {
Util.waitUntilElementIsVisible(element(locator)); Util.waitUntilElementIsVisible(element(locator));
return element(locator).getAttribute('class').then(function (result) { return element(locator).getAttribute('class').then(function (result) {
@@ -323,6 +352,11 @@ export class ContentListPage {
Util.waitUntilElementIsVisible(isRowSelected); Util.waitUntilElementIsVisible(isRowSelected);
} }
checkRowIsSelectedWithRoot(content) {
let isRowSelected = this.getRowsNameWithRoot(content).element(by.xpath(`ancestor::div[contains(@class, 'is-selected')]`));
Util.waitUntilElementIsVisible(isRowSelected);
}
checkContentIsDisplayed(content) { checkContentIsDisplayed(content) {
Util.waitUntilElementIsVisible(this.getRowByRowName(content)); Util.waitUntilElementIsVisible(this.getRowByRowName(content));
return this; return this;
@@ -366,6 +400,13 @@ export class ContentListPage {
return this; return this;
} }
clickRowToSelectWithRoot(rowName) {
let row = this.getRowByRowNameWithRoot(rowName);
browser.actions().keyDown(protractor.Key.COMMAND).click(row).perform();
this.checkRowIsSelectedWithRoot(rowName);
return this;
}
checkLockedIcon(content) { checkLockedIcon(content) {
let lockIcon = element(by.cssContainingText('div[filename="' + content + '"] mat-icon', 'lock')); let lockIcon = element(by.cssContainingText('div[filename="' + content + '"] mat-icon', 'lock'));
Util.waitUntilElementIsVisible(lockIcon); Util.waitUntilElementIsVisible(lockIcon);