[ADF-5463] Rework Protractor tests - changes related to element/element… (#7284)

* ADF-5463 Rework Protractor tests - changes related to element/elements and duplication of locators

* Fix one which I missed

* Remove console.logs

* Remove console.logs

* Reverse the timeouts

* Fixed things TSLint

* Remove unused import

* Fixed broken tests

* Last test fixed
This commit is contained in:
MichalFidor
2021-10-08 17:28:37 +02:00
committed by GitHub
parent db6a638a2d
commit 1e62b46060
156 changed files with 1653 additions and 1647 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { createApiService,
BreadcrumbPage,
BreadcrumbDropdownPage,
@@ -47,7 +47,7 @@ describe('Document List Component - Actions', () => {
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const infinitePaginationPage = new InfinitePaginationPage(element(by.css('adf-content-node-selector')));
const infinitePaginationPage = new InfinitePaginationPage($('adf-content-node-selector'));
describe('Folder Actions - Copy and Move', () => {
const folderModel1 = new FolderModel({ name: StringUtil.generateRandomString() });

View File

@@ -22,7 +22,7 @@ import {
DropdownPage,
TestElement
} from '@alfresco/adf-testing';
import { browser, by } from 'protractor';
import { browser } from 'protractor';
export class PermissionsPage {
@@ -55,7 +55,7 @@ export class PermissionsPage {
async clickRoleDropdownByUserOrGroupName(name: string): Promise<void> {
const row = this.dataTableComponentPage.getRow('Users and Groups', name);
await row.click();
await BrowserActions.click(row.element(by.css('[id="adf-select-role-permission"] .mat-select-trigger')));
await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger'));
await TestElement.byCss('.mat-select-panel').waitVisible();
}

View File

@@ -15,12 +15,12 @@
* limitations under the License.
*/
import { by, element } from 'protractor';
import { $ } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
export class SocialPage {
nodeIdField = element(by.css(`input[id="nodeId"]`));
nodeIdField = $(`input[id="nodeId"]`);
async getNodeIdFieldValue(): Promise<string> {
return BrowserActions.getInputValue(this.nodeIdField);

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { element, by, protractor, browser } from 'protractor';
import { by, protractor, browser, $, $$ } from 'protractor';
import { BrowserActions, TestElement } from '@alfresco/adf-testing';
export class TagPage {
addTagButton = TestElement.byCss('#add-tag');
insertNodeIdElement = element(by.css('input[id="nodeId"]'));
insertNodeIdElement = $('input[id="nodeId"]');
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');
@@ -30,7 +30,7 @@ export class TagPage {
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"]'));
tagsOnPage = $$('div[class*="adf-list-tag"]');
confirmTag = TestElement.byCss('#adf-tag-node-send');
getNodeId(): Promise<string> {

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import { element, by, protractor } from 'protractor';
import { element, by, protractor, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class TreeViewPage {
treeViewTitle = element(by.cssContainingText('app-tree-view div', 'TREE VIEW TEST'));
nodeIdInput = element(by.css('input[data-placeholder="Node Id"]'));
noNodeMessage = element(by.id('adf-tree-view-missing-node'));
nodesOnPage = element.all(by.css('mat-tree-node'));
nodeIdInput = $('input[data-placeholder="Node Id"]');
noNodeMessage = $('#adf-tree-view-missing-node');
nodesOnPage = $$('mat-tree-node');
async checkTreeViewTitleIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.treeViewTitle);
@@ -34,17 +34,17 @@ export class TreeViewPage {
}
async clickNode(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"] button'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"] button');
await BrowserActions.click(node);
}
async checkNodeIsDisplayedAsClosed(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="false"]');
await BrowserVisibility.waitUntilElementIsVisible(node);
}
async checkNodeIsDisplayedAsOpen(nodeName: string): Promise<void> {
const node = element(by.css('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]'));
const node = $('mat-tree-node[id="' + nodeName + '-tree-child-node"][aria-expanded="true"]');
await BrowserVisibility.waitUntilElementIsVisible(node);
}
@@ -54,7 +54,7 @@ export class TreeViewPage {
}
async checkNodeIsNotDisplayed(nodeName: string): Promise<void> {
const node = element(by.id('' + nodeName + '-tree-child-node'));
const node = $('#' + nodeName + '-tree-child-node');
await BrowserVisibility.waitUntilElementIsNotVisible(node);
}