mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -15,18 +15,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { element, by, protractor, browser } from 'protractor';
|
||||
import { protractor, browser, $, $$ } from 'protractor';
|
||||
import * as path from 'path';
|
||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
export class AttachmentListPage {
|
||||
|
||||
attachFileButton = element(by.css("input[type='file']"));
|
||||
buttonMenu = element(by.css("button[data-automation-id='action_menu_0']"));
|
||||
viewButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']"));
|
||||
removeButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']"));
|
||||
downloadButton = element(by.css("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']"));
|
||||
noContentContainer = element(by.css("div[class*='adf-no-content-container']"));
|
||||
attachFileButton = $("input[type='file']");
|
||||
buttonMenu = $("button[data-automation-id='action_menu_0']");
|
||||
viewButton = $("button[data-automation-id*='MENU_ACTIONS.VIEW_CONTENT']");
|
||||
removeButton = $("button[data-automation-id*='MENU_ACTIONS.REMOVE_CONTENT']");
|
||||
downloadButton = $("button[data-automation-id*='MENU_ACTIONS.DOWNLOAD_CONTENT']");
|
||||
noContentContainer = $("div[class*='adf-no-content-container']");
|
||||
|
||||
async checkEmptyAttachmentList(): Promise<void> {
|
||||
await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
|
||||
@@ -39,7 +39,7 @@ export class AttachmentListPage {
|
||||
}
|
||||
|
||||
async checkFileIsAttached(name: string): Promise<void> {
|
||||
const fileAttached = element.all(by.css('div[data-automation-id="' + name + '"]')).first();
|
||||
const fileAttached = $$('div[data-automation-id="' + name + '"]').first();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export class AttachmentListPage {
|
||||
|
||||
async viewFile(name: string): Promise<void> {
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
|
||||
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
|
||||
await BrowserActions.click(this.buttonMenu);
|
||||
await browser.sleep(500);
|
||||
await BrowserActions.click(this.viewButton);
|
||||
@@ -58,7 +58,7 @@ export class AttachmentListPage {
|
||||
|
||||
async removeFile(name: string): Promise<void> {
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
|
||||
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
|
||||
await BrowserActions.click(this.buttonMenu);
|
||||
await browser.sleep(500);
|
||||
await BrowserActions.click(this.removeButton);
|
||||
@@ -67,7 +67,7 @@ export class AttachmentListPage {
|
||||
|
||||
async downloadFile(name: string): Promise<void> {
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
await BrowserActions.click(element.all(by.css('div[data-automation-id="' + name + '"]')).first());
|
||||
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
|
||||
await BrowserActions.click(this.buttonMenu);
|
||||
await browser.sleep(500);
|
||||
await BrowserActions.click(this.downloadButton);
|
||||
@@ -75,14 +75,14 @@ export class AttachmentListPage {
|
||||
|
||||
async doubleClickFile(name: string): Promise<void> {
|
||||
await BrowserActions.closeMenuAndDialogs();
|
||||
await BrowserVisibility.waitUntilElementIsVisible(element.all(by.css(`div[data-automation-id="${name}"]`)).first());
|
||||
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
|
||||
await BrowserVisibility.waitUntilElementIsVisible($$(`div[data-automation-id="${name}"]`).first());
|
||||
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
|
||||
await BrowserActions.click(fileAttached);
|
||||
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||
}
|
||||
|
||||
async checkFileIsRemoved(name: string): Promise<void> {
|
||||
const fileAttached = element.all(by.css(`div[data-automation-id="${name}"]`)).first();
|
||||
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
|
||||
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user