TestElement prototype to greatly reduce e2e coding time (#6525)

* TestElement prototype

* introduce byText wrapper

* extend TestElement api

* cleanup tests a bit more

* cleanup e2e

* more e2e cleanup

* add missing CSS classes

* fix test
This commit is contained in:
Denys Vuika
2021-01-15 11:31:45 +00:00
committed by GitHub
parent 6f3ce8b6f3
commit c9705b06d5
30 changed files with 484 additions and 758 deletions

View File

@@ -68,38 +68,38 @@ describe('Create library directive', () => {
});
it('[C290158] Should display the Create Library defaults', async () => {
await expect(await createLibraryDialog.getTitle()).toMatch('Create Library');
await expect(await createLibraryDialog.isNameDisplayed()).toBe(true, 'Name input field is not displayed');
await expect(await createLibraryDialog.isLibraryIdDisplayed()).toBe(true, 'Library ID field is not displayed');
await expect(await createLibraryDialog.isDescriptionDisplayed()).toBe(true, 'Library description is not displayed');
await expect(await createLibraryDialog.isPublicDisplayed()).toBe(true, 'Public radio button is not displayed');
await expect(await createLibraryDialog.isPrivateDisplayed()).toBe(true, 'Private radio button is not displayed');
await expect(await createLibraryDialog.isModeratedDisplayed()).toBe(true, 'Moderated radio button is not displayed');
await expect(await createLibraryDialog.isCreateEnabled()).toBe(false, 'Create button is not disabled');
await expect(await createLibraryDialog.isCancelEnabled()).toBe(true, 'Cancel button is disabled');
await expect(await createLibraryDialog.libraryTitle.getText()).toMatch('Create Library');
await expect(await createLibraryDialog.libraryNameField.isDisplayed()).toBe(true, 'Name input field is not displayed');
await expect(await createLibraryDialog.libraryIdField.isDisplayed()).toBe(true, 'Library ID field is not displayed');
await expect(await createLibraryDialog.libraryDescriptionField.isDisplayed()).toBe(true, 'Library description is not displayed');
await expect(await createLibraryDialog.publicRadioButton.isDisplayed()).toBe(true, 'Public radio button is not displayed');
await expect(await createLibraryDialog.privateRadioButton.isDisplayed()).toBe(true, 'Private radio button is not displayed');
await expect(await createLibraryDialog.moderatedRadioButton.isDisplayed()).toBe(true, 'Moderated radio button is not displayed');
await expect(await createLibraryDialog.createButton.isEnabled()).toBe(false, 'Create button is not disabled');
await expect(await createLibraryDialog.cancelButton.isEnabled()).toBe(true, 'Cancel button is disabled');
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The default visibility is not public');
});
it('[C290159] Should close the dialog when clicking Cancel button', async () => {
const libraryName = 'cancelLibrary';
await createLibraryDialog.typeLibraryName(libraryName);
await createLibraryDialog.clickCancel();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.cancelButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
});
it('[C290160] Should create a public library', async () => {
const libraryName = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(libraryName);
await createLibraryDialog.typeLibraryDescription(libraryDescription);
await createLibraryDialog.selectPublic();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.publicRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The visibility is not public');
await createLibraryDialog.clickCreate();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
@@ -112,14 +112,14 @@ describe('Create library directive', () => {
const libraryName = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(libraryName);
await createLibraryDialog.typeLibraryDescription(libraryDescription);
await createLibraryDialog.selectPrivate();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.privateRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.private, 'The visibility is not private');
await createLibraryDialog.clickCreate();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
@@ -132,15 +132,15 @@ describe('Create library directive', () => {
const libraryName = StringUtil.generateRandomString();
const libraryId = StringUtil.generateRandomString();
const libraryDescription = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(libraryName);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.typeLibraryDescription(libraryDescription);
await createLibraryDialog.selectModerated();
await createLibraryDialog.libraryNameField.typeText(libraryName);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.moderatedRadioButton.click();
await expect(await createLibraryDialog.getSelectedRadio()).toMatch(visibility.moderated, 'The visibility is not moderated');
await createLibraryDialog.clickCreate();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await customSourcesPage.navigateToCustomSources();
await customSourcesPage.selectMySitesSourceType();
@@ -152,17 +152,17 @@ describe('Create library directive', () => {
it('[C290163] Should disable Create button when a mandatory field is not filled in', async () => {
const inputValue = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(inputValue);
await createLibraryDialog.clearLibraryId();
await expect(await createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.clearLibraryName();
await createLibraryDialog.libraryNameField.typeText(inputValue);
await createLibraryDialog.libraryIdField.clearInput();
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.libraryNameField.clearInput();
await createLibraryDialog.typeLibraryId(inputValue);
await expect(await createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.clearLibraryId();
await createLibraryDialog.libraryIdField.typeText(inputValue);
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.libraryIdField.clearInput();
await createLibraryDialog.typeLibraryDescription(inputValue);
await expect(await createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
await createLibraryDialog.libraryDescriptionField.typeText(inputValue);
await expect(await createLibraryDialog.createButton.isEnabled()).not.toBe(true, 'The Create button is enabled');
});
it('[C290164] Should auto-fill in the Library Id built from library name', async () => {
@@ -170,9 +170,9 @@ describe('Create library directive', () => {
const libraryId: string[] = ['abcd1234', 'ab-cd-12-34', 'ab-cd1234link'];
for (let i = 0; i < 3; i++) {
await createLibraryDialog.typeLibraryName(name[i]);
await createLibraryDialog.waitUntilLibraryIdTextHasValue(libraryId[i]);
await createLibraryDialog.clearLibraryName();
await createLibraryDialog.libraryNameField.typeText(name[i]);
await createLibraryDialog.libraryIdField.waitHasValue(libraryId[i]);
await createLibraryDialog.libraryNameField.clearInput();
}
});
@@ -180,12 +180,12 @@ describe('Create library directive', () => {
const name = 'My Library';
const libraryId: string[] = ['My New Library', 'My+New+Library123!', '<>'];
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.libraryNameField.typeText(name);
for (let i = 0; i < 3; i++) {
await createLibraryDialog.typeLibraryId(libraryId[i]);
await createLibraryDialog.waitErrorMessageIsDisplayed();
await expect(await createLibraryDialog.getErrorMessage()).toMatch('Use numbers and letters only');
await createLibraryDialog.libraryIdField.typeText(libraryId[i]);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('Use numbers and letters only');
}
});
@@ -193,52 +193,52 @@ describe('Create library directive', () => {
const name = 'x';
const libraryId = 'my-library-id';
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.waitErrorMessageIsDisplayed();
await expect(await createLibraryDialog.getErrorMessage()).toMatch('Title must be at least 2 characters long');
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch('Title must be at least 2 characters long');
});
it('[C291793] Should display error for Name field filled in with spaces only', async () => {
const name = ' ';
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.waitErrorMessageIsDisplayed();
await expect(await createLibraryDialog.getErrorMessage()).toMatch("Library name can't contain only spaces");
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch("Library name can't contain only spaces");
});
it('[C290177] Should not accept a duplicate Library Id', async () => {
const name = 'My Library';
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.clickCreate();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
await contentServicesPage.openCreateLibraryDialog();
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.waitErrorMessageIsDisplayed();
await expect(await createLibraryDialog.getErrorMessage()).toMatch("This Library ID isn't available. Try a different Library ID.");
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.errorMessage.waitVisible(60000);
await expect(await createLibraryDialog.errorMessage.getText()).toMatch("This Library ID isn't available. Try a different Library ID.");
});
it('[C290178] Should accept the same library name but different Library Ids', async () => {
const name = createSite.entry.title;
const libraryId = StringUtil.generateRandomString();
await createLibraryDialog.typeLibraryName(name.toUpperCase());
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.libraryNameField.typeText(name.toUpperCase());
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.waitForLibraryNameHint();
await expect(await createLibraryDialog.getLibraryNameHint()).toMatch('Library name already in use', 'The library name hint is wrong');
await createLibraryDialog.libraryNameHint.waitVisible();
await expect(await createLibraryDialog.libraryNameHint.getText()).toMatch('Library name already in use', 'The library name hint is wrong');
await createLibraryDialog.clickCreate();
await createLibraryDialog.waitForDialogToClose();
await createLibraryDialog.createButton.click();
await createLibraryDialog.libraryDialog.waitNotPresent(60000);
});
it('[C290179] Should not accept more than the expected characters for input fields', async () => {
@@ -246,11 +246,11 @@ describe('Create library directive', () => {
const libraryId = StringUtil.generateRandomString(73);
const libraryDescription = StringUtil.generateRandomString(513);
await createLibraryDialog.typeLibraryName(name);
await createLibraryDialog.typeLibraryId(libraryId);
await createLibraryDialog.typeLibraryDescription(libraryDescription);
await createLibraryDialog.libraryNameField.typeText(name);
await createLibraryDialog.libraryIdField.typeText(libraryId);
await createLibraryDialog.libraryDescriptionField.typeText(libraryDescription);
await createLibraryDialog.selectPublic();
await createLibraryDialog.publicRadioButton.click();
await expect(await createLibraryDialog.getErrorMessages(0)).toMatch('Use 256 characters or less for title');
await expect(await createLibraryDialog.getErrorMessages(1)).toMatch('Use 72 characters or less for the URL name');

View File

@@ -106,16 +106,16 @@ describe('Lock File', () => {
it('[C286604] Should be able to open Lock file option by clicking the lock image', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.checkCancelButtonIsDisplayed();
await lockFilePage.checkSaveButtonIsDisplayed();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.cancelButton.waitVisible();
await lockFilePage.saveButton.waitVisible();
});
it('[C286625] Should be able to click Cancel to cancel lock file operation', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickCancelButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.cancelButton.click();
await contentServices.checkUnlockedIcon(pngFileModel.name);
});
@@ -123,9 +123,9 @@ describe('Lock File', () => {
it('[C286603] Should be able to click on Lock file checkbox and lock a file', async () => {
await contentServices.lockContent(pngFileToLock.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkLockedIcon(pngFileToLock.name);
});
@@ -133,15 +133,15 @@ describe('Lock File', () => {
it('[C286618] Should be able to uncheck Lock file checkbox and unlock a file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkLockedIcon(pngFileModel.name);
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.checkUnlockedIcon(pngFileModel.name);
});
@@ -174,9 +174,9 @@ describe('Lock File', () => {
it('[C286610] Should not be able to delete a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.deleteNode(nodeId);
@@ -188,9 +188,9 @@ describe('Lock File', () => {
it('[C286611] Should not be able to rename a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
@@ -203,9 +203,9 @@ describe('Lock File', () => {
it('[C286612] Should not be able to move a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
@@ -218,9 +218,9 @@ describe('Lock File', () => {
it('[C286613] Should not be able to update a new version on a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
@@ -255,10 +255,10 @@ describe('Lock File', () => {
it('[C286614] Owner of the locked file should be able to rename if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
const response = await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
@@ -270,10 +270,10 @@ describe('Lock File', () => {
it('[C286615] Owner of the locked file should be able to update a new version if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
const response = await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
@@ -285,10 +285,10 @@ describe('Lock File', () => {
it('[C286616] Owner of the locked file should be able to move if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
try {
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
@@ -303,10 +303,10 @@ describe('Lock File', () => {
it('[C286617] Owner of the locked file should be able to delete if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileToLock.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
await lockFilePage.lockFileCheckboxText.waitVisible();
await lockFilePage.lockFileCheckbox.click();
await lockFilePage.allowOwnerCheckbox.click();
await lockFilePage.saveButton.click();
await contentServices.deleteContent(pngFileToBeLocked.entry.name);
await contentServices.checkContentIsNotDisplayed(pngFileToBeLocked.entry.name);

View File

@@ -15,42 +15,13 @@
* limitations under the License.
*/
import { element, by } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { TestElement } from '@alfresco/adf-testing';
export class LockFilePage {
cancelButton = element(by.css('button[data-automation-id="lock-dialog-btn-cancel"]'));
saveButton = element(by.cssContainingText('button span', 'Save'));
lockFileCheckboxText = element(by.cssContainingText('mat-checkbox label span', ' Lock file '));
lockFileCheckbox = element(by.css('mat-checkbox[data-automation-id="adf-lock-node-checkbox"]'));
allowOwnerCheckbox = element(by.cssContainingText('mat-checkbox[class*="adf-lock-file-name"] span', ' Allow the owner to modify this file '));
async checkLockFileCheckboxIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.lockFileCheckboxText);
}
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
async checkSaveButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveButton);
}
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async clickLockFileCheckbox(): Promise<void> {
await BrowserActions.click(this.lockFileCheckbox);
}
async clickSaveButton(): Promise<void> {
await BrowserActions.click(this.saveButton);
}
async clickAllowOwnerCheckbox(): Promise<void> {
await BrowserActions.click(this.allowOwnerCheckbox);
}
cancelButton = TestElement.byCss('button[data-automation-id="lock-dialog-btn-cancel"]');
saveButton = TestElement.byText('button span', 'Save');
lockFileCheckboxText = TestElement.byText('mat-checkbox label span', ' Lock file ');
lockFileCheckbox = TestElement.byCss('mat-checkbox[data-automation-id="adf-lock-node-checkbox"]');
allowOwnerCheckbox = TestElement.byText('mat-checkbox[class*="adf-lock-file-name"] span', ' Allow the owner to modify this file ');
}

View File

@@ -15,12 +15,7 @@
* limitations under the License.
*/
import {
DataTableComponentPage,
AddPermissionsDialogPage,
BrowserVisibility,
BrowserActions
} from '@alfresco/adf-testing';
import { DataTableComponentPage, AddPermissionsDialogPage, TestElement } from '@alfresco/adf-testing';
import { browser, by, element } from 'protractor';
export class PermissionsPage {
@@ -28,7 +23,7 @@ export class PermissionsPage {
dataTableComponentPage = new DataTableComponentPage();
addPermissionsDialog = new AddPermissionsDialogPage();
addPermissionButton = element(by.css("button[data-automation-id='adf-add-permission-button']"));
addPermissionButton = TestElement.byCss("button[data-automation-id='adf-add-permission-button']");
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
searchUserInput = element(by.id('searchInput'));
searchResults = element(by.css('#adf-add-permission-authority-results #adf-search-results-content'));
@@ -37,11 +32,7 @@ export class PermissionsPage {
noPermissions = element(by.id('adf-no-permissions-template'));
deletePermissionButton = element(by.css(`button[data-automation-id='adf-delete-permission-button']`));
permissionDisplayContainer = element(by.id('adf-permission-display-container'));
closeButton = element(by.id('add-permission-dialog-close-button'));
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
closeButton = TestElement.byCss('#add-permission-dialog-close-button');
async changePermission(name: string, role: string): Promise<void> {
await this.addPermissionsDialog.clickRoleDropdownByUserOrGroupName(name);
@@ -49,8 +40,4 @@ export class PermissionsPage {
await browser.sleep(500);
await this.dataTableComponentPage.checkRowIsNotSelected('Authority ID', name);
}
async checkAddPermissionButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionButton);
}
}

View File

@@ -15,29 +15,26 @@
* limitations under the License.
*/
import { Locator, element, by, protractor, browser } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { element, by, protractor, browser } from 'protractor';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export class TagPage {
addTagButton = element(by.id('add-tag'));
addTagButton = TestElement.byCss('#add-tag');
insertNodeIdElement = element(by.css('input[id="nodeId"]'));
newTagInput = element(by.css('input[id="new-tag-text"]'));
tagListRow = element(by.css('adf-tag-node-actions-list mat-list-item'));
tagListByNodeIdRow = element(by.css('adf-tag-node-list mat-chip'));
errorMessage = element(by.css('mat-hint[data-automation-id="errorMessage"]'));
tagListRowLocator: Locator = by.css('adf-tag-node-actions-list mat-list-item div');
tagListByNodeIdRowLocator: Locator = by.css('adf-tag-node-list mat-chip span');
tagListContentServicesRowLocator: Locator = by.css('div[class*="adf-list-tag"]');
showDeleteButton = element(by.id('adf-remove-button-tag'));
showMoreButton = element(by.css('button[data-automation-id="show-more-tags"]'));
showLessButton = element(by.css('button[data-automation-id="show-fewer-tags"]'));
newTagInput = TestElement.byCss('input[id="new-tag-text"]');
tagListRow = TestElement.byCss('adf-tag-node-actions-list mat-list-item');
tagListByNodeIdRow = TestElement.byCss('adf-tag-node-list mat-chip');
errorMessage = TestElement.byCss('mat-hint[data-automation-id="errorMessage"]');
tagListContentServicesRowLocator = by.css('div[class*="adf-list-tag"]');
showDeleteButton = TestElement.byCss('#adf-remove-button-tag');
showMoreButton = TestElement.byCss('button[data-automation-id="show-more-tags"]');
showLessButton = TestElement.byCss('button[data-automation-id="show-fewer-tags"]');
tagsOnPage = element.all(by.css('div[class*="adf-list-tag"]'));
confirmTag = element(by.id('adf-tag-node-send'));
confirmTag = TestElement.byCss('#adf-tag-node-send');
async getNodeId(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.insertNodeIdElement);
return this.insertNodeIdElement.getAttribute('value');
getNodeId(): Promise<string> {
return new TestElement(this.insertNodeIdElement).getAttribute('value');
}
async insertNodeId(nodeId) {
@@ -47,163 +44,48 @@ export class TagPage {
await this.insertNodeIdElement.sendKeys(' ');
await browser.sleep(200);
await this.insertNodeIdElement.sendKeys(protractor.Key.BACK_SPACE);
await this.clickConfirmTag();
}
async addNewTagInput(tag: string) {
await BrowserActions.clearSendKeys(this.newTagInput, tag);
await this.confirmTag.click();
}
async addTag(tag: string): Promise<void> {
await this.addNewTagInput(tag);
await BrowserActions.click(this.addTagButton);
await this.newTagInput.typeText(tag);
return this.addTagButton.click();
}
async deleteTagFromTagListByNodeId(name: string): Promise<void> {
const deleteChip = element(by.id('tag_chips_delete_' + name));
await BrowserActions.click(deleteChip);
deleteTagFromTagListByNodeId(name: string): Promise<void> {
return TestElement.byId('tag_chips_delete_' + name).click();
}
async deleteTagFromTagList(name: string): Promise<void> {
const deleteChip = element(by.id('tag_chips_delete_' + name));
await BrowserActions.click(deleteChip);
}
async getNewTagInput(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return this.newTagInput.getAttribute('value');
}
async getNewTagPlaceholder(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.newTagInput);
return this.newTagInput.getAttribute('data-placeholder');
deleteTagFromTagList(name: string): Promise<void> {
return TestElement.byId('tag_chips_delete_' + name).click();
}
async addTagButtonIsEnabled(): Promise<boolean> {
await BrowserVisibility.waitUntilElementIsVisible(this.addTagButton);
await this.addTagButton.waitVisible();
return this.addTagButton.isEnabled();
}
async checkTagIsDisplayedInTagList(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('div[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
checkTagIsDisplayedInTagList(tagName: string): Promise<void> {
return TestElement.byText('div[id*="tag_name"]', tagName).waitVisible();
}
async checkTagIsNotDisplayedInTagList(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('div[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
checkTagIsNotDisplayedInTagList(tagName: string): Promise<void> {
return TestElement.byText('div[id*="tag_name"]', tagName).waitNotVisible();
}
async checkTagIsNotDisplayedInTagListByNodeId(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsNotVisible(tag);
checkTagIsNotDisplayedInTagListByNodeId(tagName: string): Promise<void> {
return TestElement.byText('span[id*="tag_name"]', tagName).waitNotVisible();
}
async checkTagIsDisplayedInTagListByNodeId(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('span[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
checkTagIsDisplayedInTagListByNodeId(tagName: string): Promise<void> {
return TestElement.byText('span[id*="tag_name"]', tagName).waitVisible();
}
async checkTagListIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.tagListRow);
checkDeleteTagFromTagListByNodeIdIsDisplayed(name: string): Promise<void> {
return TestElement.byId('tag_chips_delete_' + name).waitVisible();
}
async checkTagListByNodeIdIsEmpty(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.tagListByNodeIdRow);
}
async checkTagIsDisplayedInTagListContentServices(tagName: string): Promise<void> {
const tag = element(by.cssContainingText('.adf-list-tag[id*="tag_name"]', tagName));
await BrowserVisibility.waitUntilElementIsVisible(tag);
}
async getErrorMessage(): Promise<string> {
return BrowserActions.getText(this.errorMessage);
}
async checkTagListIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListRowLocator);
}
async checkTagListByNodeIdIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListByNodeIdRowLocator);
}
async checkTagListContentServicesIsOrderedAscending(): Promise<any> {
await this.checkListIsSorted(false, this.tagListContentServicesRowLocator);
}
async checkListIsSorted(sortOrder, locator): Promise<boolean> {
const tagList = element.all(locator);
await BrowserVisibility.waitUntilElementIsVisible(tagList.first());
const initialList = [];
await tagList.each(async (currentElement) => {
const text = await BrowserActions.getText(currentElement);
initialList.push(text);
});
let sortedList = initialList;
sortedList = sortedList.sort();
if (sortOrder === false) {
sortedList = sortedList.reverse();
}
return initialList.toString() === sortedList.toString();
}
async checkDeleteTagFromTagListByNodeIdIsDisplayed(name: string): Promise<void> {
const deleteChip = element(by.id('tag_chips_delete_' + name));
await BrowserVisibility.waitUntilElementIsVisible(deleteChip);
}
async checkDeleteTagFromTagListByNodeIdIsNotDisplayed(name: string): Promise<void> {
const deleteChip = element(by.id('tag_chips_delete_' + name));
await BrowserVisibility.waitUntilElementIsNotVisible(deleteChip);
}
async clickShowDeleteButtonSwitch(): Promise<void> {
await BrowserActions.click(this.showDeleteButton);
}
async checkShowMoreButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showMoreButton);
}
async clickShowMoreButton(): Promise<void> {
await BrowserActions.click(this.showMoreButton);
}
async clickShowLessButton(): Promise<void> {
await BrowserActions.click(this.showLessButton);
}
async clickConfirmTag(): Promise<void> {
await BrowserActions.click(this.confirmTag);
}
async checkTagsOnList(): Promise<number> {
return this.tagsOnPage.count();
}
async checkShowLessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.showLessButton);
}
async checkShowLessButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.showLessButton);
}
async clickShowMoreButtonUntilNotDisplayed(): Promise<void> {
const visible = await this.showMoreButton.isDisplayed();
if (visible) {
await BrowserActions.click(this.showMoreButton);
await this.clickShowMoreButtonUntilNotDisplayed();
}
}
async clickShowLessButtonUntilNotDisplayed(): Promise<void> {
const visible = await this.showLessButton.isDisplayed();
if (visible) {
await BrowserActions.click(this.showLessButton);
await this.clickShowLessButtonUntilNotDisplayed();
}
checkDeleteTagFromTagListByNodeIdIsNotDisplayed(name: string): Promise<void> {
return TestElement.byId('tag_chips_delete_' + name).waitNotVisible();
}
}

View File

@@ -148,7 +148,7 @@ describe('Permissions Component', () => {
});
it('[C286272] Should be able to see results when searching for a user', async () => {
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();
await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed();
await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed();
@@ -157,7 +157,7 @@ describe('Permissions Component', () => {
});
it('[C276979] Should be able to give permissions to a group of people', async () => {
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();
await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed();
await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed();
@@ -168,7 +168,7 @@ describe('Permissions Component', () => {
});
it('[C277100] Should display EVERYONE group in the search result set', async () => {
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();
await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed();
await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed();
@@ -192,7 +192,7 @@ describe('Permissions Component', () => {
await contentServicesPage.checkSelectedSiteIsDisplayed('My files');
await contentList.rightClickOnRow(fileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Permission');
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();
await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed();
await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed();
@@ -377,7 +377,7 @@ describe('Permissions Component', () => {
await contentList.rightClickOnRow('RoleConsumer' + fileModel.name);
await contentServicesPage.pressContextMenuActionNamed('Permission');
await permissionsPage.addPermissionsDialog.checkPermissionInheritedButtonIsDisplayed();
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await permissionsPage.addPermissionsDialog.clickPermissionInheritedButton();
await expect(await notificationPage.getSnackBarMessage()).toEqual('You are not allowed to change permissions');
await permissionsPage.addPermissionsDialog.clickAddPermissionButton();

View File

@@ -179,7 +179,7 @@ describe('Permissions Component', () => {
await contentServicesPage.pressContextMenuActionNamed('Permission');
await permissionsPage.addPermissionsDialog.checkPermissionInheritedButtonIsDisplayed();
await permissionsPage.checkAddPermissionButtonIsDisplayed();
await permissionsPage.addPermissionButton.waitVisible();
await browser.sleep(5000);
@@ -360,7 +360,7 @@ describe('Permissions Component', () => {
await navigationBarPage.openContentServicesFolder(privateSite.entry.guid);
await contentServicesPage.versionManagerContent('privateSite' + fileModel.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');

View File

@@ -80,14 +80,14 @@ describe('Tag component', () => {
it('[C260374] Should NOT be possible to add a new tag without Node ID', async () => {
await expect(await tagPage.getNodeId()).toEqual('');
await expect(await tagPage.getNewTagPlaceholder()).toEqual('New Tag');
await expect(await tagPage.newTagInput.getAttribute('data-placeholder')).toEqual('New Tag');
await expect(await tagPage.addTagButtonIsEnabled()).toEqual(false);
await tagPage.checkTagListIsEmpty();
await tagPage.checkTagListByNodeIdIsEmpty();
await tagPage.addNewTagInput('a');
await tagPage.tagListRow.waitNotVisible();
await tagPage.tagListByNodeIdRow.waitNotVisible();
await tagPage.newTagInput.typeText('a');
await expect(await tagPage.addTagButtonIsEnabled()).toEqual(false);
await expect(await tagPage.getNewTagInput()).toEqual('a');
await expect(await tagPage.newTagInput.getAttribute('value')).toEqual('a');
});
it('[C268151] Should be possible to add a new tag to a Node', async () => {
@@ -103,7 +103,7 @@ describe('Tag component', () => {
await tagPage.addTag(sameTag);
await tagPage.checkTagIsDisplayedInTagList(sameTag);
await tagPage.addTag(sameTag);
await expect(await tagPage.getErrorMessage()).toEqual('Tag already exists');
await expect(await tagPage.errorMessage.getText()).toEqual('Tag already exists');
});
it('[C260375] Should be possible to delete a tag', async () => {
@@ -141,7 +141,7 @@ describe('Tag component', () => {
await tagPage.checkTagIsDisplayedInTagListByNodeId(tagList[3]);
await tagPage.checkDeleteTagFromTagListByNodeIdIsDisplayed(tagList[3]);
await tagPage.clickShowDeleteButtonSwitch();
await tagPage.showDeleteButton.click();
await tagPage.checkDeleteTagFromTagListByNodeIdIsNotDisplayed(tagList[3]);
});
@@ -149,16 +149,16 @@ describe('Tag component', () => {
it('[C286472] Should be able to click Show more/less button on List Tags Content Services', async () => {
await tagPage.insertNodeId(pdfFileModel.id);
await tagPage.checkShowMoreButtonIsDisplayed();
await tagPage.checkShowLessButtonIsNotDisplayed();
await tagPage.showMoreButton.waitVisible();
await tagPage.showLessButton.waitNotVisible();
await expect(await tagPage.checkTagsOnList()).toEqual(10);
await expect(await tagPage.tagsOnPage.count()).toEqual(10);
await tagPage.clickShowMoreButton();
await tagPage.checkShowLessButtonIsDisplayed();
await tagPage.showMoreButton.click();
await tagPage.showLessButton.waitVisible();
await tagPage.clickShowLessButton();
await tagPage.checkShowLessButtonIsNotDisplayed();
await tagPage.showLessButton.click();
await tagPage.showLessButton.waitNotVisible();
});
});

View File

@@ -15,14 +15,7 @@
* limitations under the License.
*/
import {
ApiService,
BrowserActions,
LoginPage,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ApiService, LoginPage, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page';
@@ -44,25 +37,27 @@ describe('Upload component', () => {
let acsUser: UserModel;
const FILES = browser.params.resources.Files;
const firstPdfFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_location
'name': FILES.ADF_DOCUMENTS.PDF_B.file_name,
'location': FILES.ADF_DOCUMENTS.PDF_B.file_location
});
const docxFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_location
'name': FILES.ADF_DOCUMENTS.DOCX.file_name,
'location': FILES.ADF_DOCUMENTS.DOCX.file_location
});
const pdfFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_location
'name': FILES.ADF_DOCUMENTS.PDF.file_name,
'location': FILES.ADF_DOCUMENTS.PDF.file_location
});
const pngFileModelTwo = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_location
'name': FILES.ADF_DOCUMENTS.PNG_B.file_name,
'location': FILES.ADF_DOCUMENTS.PNG_B.file_location
});
const pngFileModel = new FileModel({
'name': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
'location': browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
'name': FILES.ADF_DOCUMENTS.PNG.file_name,
'location': FILES.ADF_DOCUMENTS.PNG.file_location
});
const filesLocation = [pdfFileModel.location, docxFileModel.location, pngFileModel.location, firstPdfFileModel.location];
const filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name];
@@ -90,8 +85,7 @@ describe('Upload component', () => {
});
it('[C260143] Should be possible to maximize/minimize the upload dialog', async () => {
await contentServicesPage
.uploadFile(docxFileModel.location);
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.fileIsUploaded(docxFileModel.name);
@@ -113,8 +107,7 @@ describe('Upload component', () => {
});
it('[C291902] Should be shown upload counter display in dialog box', async () => {
await contentServicesPage
.uploadFile(docxFileModel.location);
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.fileIsUploaded(docxFileModel.name);
@@ -174,7 +167,7 @@ describe('Upload component', () => {
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await contentServicesPage.versionManagerContent(docxFileModel.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(pngFileModel.location);
await versionManagePage.closeVersionDialog();
@@ -183,5 +176,4 @@ describe('Upload component', () => {
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
});

View File

@@ -98,7 +98,7 @@ describe('Version component actions', () => {
});
it('[C280005] Should be showed all the default action when you have more then one version', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
@@ -122,22 +122,19 @@ describe('Version component actions', () => {
it('[C272819] Should be possible delete a version when click on delete version action', async () => {
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.clickAcceptConfirm();
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
await versionManagePage.checkFileVersionExist('1.0');
});
it('[C280006] Should be possible prevent a version to be deleted when click on No on the confirm dialog', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.1');
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.clickCancelConfirm();
await versionManagePage.confirmCancel.click();
await versionManagePage.checkFileVersionExist('1.1');
await versionManagePage.checkFileVersionExist('1.0');
@@ -169,7 +166,7 @@ describe('Version component actions', () => {
await browser.refresh();
await contentServicesPage.versionManagerContent(txtFileModel.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await browser.executeScript(' setTimeout(() => {document.querySelector("div[data-automation-id=\'cancel-upload-progress\']").click();}, 1000)');
await versionManagePage.uploadNewVersionFile(bigFileToCancel.location);

View File

@@ -18,7 +18,6 @@
import { browser, by, element } from 'protractor';
import {
ApiService,
BrowserActions,
LoginPage,
NotificationHistoryPage,
StringUtil,
@@ -152,8 +151,7 @@ describe('Version component permissions', () => {
it('[C277200] should a user with Manager permission be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
@@ -161,7 +159,7 @@ describe('Version component permissions', () => {
await expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.clickAcceptConfirm();
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
@@ -224,8 +222,7 @@ describe('Version component permissions', () => {
it('[C277177] Should a user with Contributor permission be able to upload a new version for the created file', async () => {
await contentServices.versionManagerContent(sameCreatorFile.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
@@ -233,7 +230,7 @@ describe('Version component permissions', () => {
await expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.clickAcceptConfirm();
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
@@ -279,8 +276,7 @@ describe('Version component permissions', () => {
it('[C277195] Should a user with Collaborator permission be able to upload a new version for the created file', async () => {
await contentServices.versionManagerContent(sameCreatorFile.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
@@ -288,7 +284,7 @@ describe('Version component permissions', () => {
await expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.clickAcceptConfirm();
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
@@ -300,8 +296,7 @@ describe('Version component permissions', () => {
it('[C277199] should a user with Collaborator permission be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');

View File

@@ -18,7 +18,6 @@
import { browser, by, element } from 'protractor';
import {
ApiService,
BrowserActions,
BrowserVisibility,
LoginPage,
UploadActions,
@@ -87,10 +86,10 @@ describe('Version Properties', () => {
it('[C279994] Should show/hide upload new version button when readOnly is true/false', async () => {
await versionManagePage.disableReadOnly();
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.waitVisible();
await versionManagePage.enableReadOnly();
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.showNewVersionButton);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.uploadNewVersionButton);
await versionManagePage.showNewVersionButton.waitNotVisible();
await versionManagePage.uploadNewVersionButton.waitNotVisible();
});
it('[C272817] Should NOT be present the download action when allowDownload property is false', async () => {
@@ -109,8 +108,8 @@ describe('Version Properties', () => {
it('[C269085] Should show/hide comments when showComments true/false', async () => {
await versionManagePage.enableComments();
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.enterCommentText('Example comment text');
await versionManagePage.showNewVersionButton.click();
await versionManagePage.commentText.typeText('Example comment text');
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.1');
await expect(await versionManagePage.getFileVersionComment('1.1')).toEqual('Example comment text');

View File

@@ -16,15 +16,7 @@
*/
import { browser } from 'protractor';
import {
ApiService,
BrowserActions,
BrowserVisibility,
LoginPage,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ApiService, LoginPage, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { VersionManagePage } from '../../core/pages/version-manager.page';
import { FileModel } from '../../models/ACS/file.model';
@@ -90,7 +82,7 @@ describe('Version component', () => {
});
it('[C272768] Should be visible the first file version when you upload a file', async () => {
await versionManagePage.checkUploadNewVersionsButtonIsDisplayed();
await versionManagePage.showNewVersionButton.waitVisible();
await versionManagePage.checkFileVersionExist('1.0');
await expect(await versionManagePage.getFileVersionName('1.0')).toEqual(txtFileModel.name);
@@ -98,29 +90,27 @@ describe('Version component', () => {
});
it('[C279995] Should show/hide the new upload file options when click on add New version/cancel button', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.cancelButton);
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.majorRadio);
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.minorRadio);
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.cancelButton);
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.commentText);
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.uploadNewVersionButton);
await versionManagePage.cancelButton.waitVisible();
await versionManagePage.majorRadio.waitVisible();
await versionManagePage.minorRadio.waitVisible();
await versionManagePage.commentText.waitVisible();
await versionManagePage.uploadNewVersionButton.waitVisible();
await BrowserActions.click(versionManagePage.cancelButton);
await versionManagePage.cancelButton.click();
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.majorRadio);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.minorRadio);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.cancelButton);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.commentText);
await BrowserVisibility.waitUntilElementIsNotVisible(versionManagePage.uploadNewVersionButton);
await versionManagePage.cancelButton.waitNotVisible();
await versionManagePage.majorRadio.waitNotVisible();
await versionManagePage.minorRadio.waitNotVisible();
await versionManagePage.commentText.waitNotVisible();
await versionManagePage.uploadNewVersionButton.waitNotVisible();
await BrowserVisibility.waitUntilElementIsVisible(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.waitVisible();
});
it('[C260244] Should show the version history when select a file with multiple version', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.0');
@@ -133,8 +123,8 @@ describe('Version component', () => {
});
it('[C269084] Should be possible add a comment when add a new version', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.enterCommentText('Example comment text');
await versionManagePage.showNewVersionButton.click();
await versionManagePage.commentText.typeText('Example comment text');
await versionManagePage.uploadNewVersionFile(fileModelVersionThree.location);
await versionManagePage.checkFileVersionExist('1.2');
@@ -144,16 +134,16 @@ describe('Version component', () => {
});
it('[C275719] Should be possible preview the file when you add a new version', async () => {
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.clickMajorChange();
await versionManagePage.showNewVersionButton.click();
await versionManagePage.majorRadio.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionFor.location);
await versionManagePage.checkFileVersionExist('2.0');
await expect(await versionManagePage.getFileVersionName('2.0')).toEqual(fileModelVersionFor.name);
await BrowserActions.click(versionManagePage.showNewVersionButton);
await versionManagePage.clickMinorChange();
await versionManagePage.showNewVersionButton.click();
await versionManagePage.minorRadio.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionFive.location);