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
e2e
@ -23,7 +23,7 @@
|
||||
* 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 { GenericDialog } from '../dialog/generic-dialog';
|
||||
|
||||
@ -45,6 +45,24 @@ export class PasswordDialog extends GenericDialog {
|
||||
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> {
|
||||
return this.isButtonEnabled(PasswordDialog.selectors.closeButton);
|
||||
}
|
||||
@ -71,8 +89,13 @@ export class PasswordDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
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')
|
||||
return (await browser.isElementPresent(elem)) && (await elem.isDisplayed());
|
||||
try {
|
||||
await this.waitForDialogToOpen();
|
||||
return (await this.errorMessage.isPresent()) && (await this.errorMessage.isDisplayed());
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getErrorMessage(): Promise<string> {
|
||||
|
@ -59,6 +59,7 @@ export class Viewer extends Component {
|
||||
async waitForViewerToOpen() {
|
||||
try {
|
||||
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.presenceOf(this.viewerLayout), BROWSER_WAIT_TIMEOUT);
|
||||
} catch (error) {
|
||||
console.log('\n-----> catch waitForViewerToOpen <-----\n', error)
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ describe('Viewer - password protected file', () => {
|
||||
await dataTable.waitForHeader();
|
||||
await dataTable.doubleClickOnRowByName(protectedFile.name);
|
||||
await viewer.waitForViewerToOpen();
|
||||
await page.waitForDialog();
|
||||
await passwordDialog.waitForDialogToOpen();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user