mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
E2E: try to fix one weird flaky test (#1401)
This commit is contained in:
parent
5a88c8c852
commit
2816e5fe11
@ -23,7 +23,7 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ElementFinder, by, browser, until } from 'protractor';
|
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||||
import { GenericDialog } from '../dialog/generic-dialog';
|
import { GenericDialog } from '../dialog/generic-dialog';
|
||||||
|
|
||||||
@ -45,6 +45,24 @@ export class PasswordDialog extends GenericDialog {
|
|||||||
super(PasswordDialog.selectors.root);
|
super(PasswordDialog.selectors.root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async waitForPasswordInputToBeInteractive() {
|
||||||
|
await browser.wait(EC.elementToBeClickable(this.passwordInput), BROWSER_WAIT_TIMEOUT, '--- timeout wait for passwordInput ---');
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForDialogToOpen(): Promise<void> {
|
||||||
|
await super.waitForDialogToOpen();
|
||||||
|
await this.waitForPasswordInputToBeInteractive();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isDialogOpen(): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
await this.waitForDialogToOpen();
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async isCloseEnabled(): Promise<boolean> {
|
async isCloseEnabled(): Promise<boolean> {
|
||||||
return this.isButtonEnabled(PasswordDialog.selectors.closeButton);
|
return this.isButtonEnabled(PasswordDialog.selectors.closeButton);
|
||||||
}
|
}
|
||||||
@ -71,8 +89,13 @@ export class PasswordDialog extends GenericDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isErrorDisplayed(): Promise<boolean> {
|
async isErrorDisplayed(): Promise<boolean> {
|
||||||
const elem = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.errorMessage)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for error message to appear')
|
try {
|
||||||
return (await browser.isElementPresent(elem)) && (await elem.isDisplayed());
|
await this.waitForDialogToOpen();
|
||||||
|
return (await this.errorMessage.isPresent()) && (await this.errorMessage.isDisplayed());
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getErrorMessage(): Promise<string> {
|
async getErrorMessage(): Promise<string> {
|
||||||
|
@ -59,6 +59,7 @@ export class Viewer extends Component {
|
|||||||
async waitForViewerToOpen() {
|
async waitForViewerToOpen() {
|
||||||
try {
|
try {
|
||||||
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
|
||||||
|
await browser.wait(EC.presenceOf(this.viewerLayout), BROWSER_WAIT_TIMEOUT);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('\n-----> catch waitForViewerToOpen <-----\n', error)
|
console.log('\n-----> catch waitForViewerToOpen <-----\n', error)
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ describe('Viewer - password protected file', () => {
|
|||||||
await dataTable.waitForHeader();
|
await dataTable.waitForHeader();
|
||||||
await dataTable.doubleClickOnRowByName(protectedFile.name);
|
await dataTable.doubleClickOnRowByName(protectedFile.name);
|
||||||
await viewer.waitForViewerToOpen();
|
await viewer.waitForViewerToOpen();
|
||||||
await page.waitForDialog();
|
await passwordDialog.waitForDialogToOpen();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user