This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Element.isPresent() script timeout #5151
Open
Description
Hi!
I have an issue using protractor with jasmine, and I wonder if there is an issue with the framework, or if my limited knowledge of the framework plays against me. I found a fairly recent StackOverflow question with four upvotes but no answer so far, which leads me to think that something may be going wrong with the latest version of protractor.
Here is my test:
import {
browser,
ExpectedConditions,
$
} from 'protractor';
describe('When user click \"Test\" button', async () => {
beforeAll(async () => {
await browser.get('http://local.myawesomewebsite.com:4200');
expect(await browser.getCurrentUrl())
.toContain('myawesomewebsite');
browser.waitForAngularEnabled(true);
});
it ("should navigate to next page", async () => {
var testButton = $(".wrapper button");
browser.wait(
ExpectedConditions.presenceOf(testButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await testButton.isPresent())
.toBe(true);
await testButton.click();
});
describe("When user click button to open modal", async () => {
beforeAll(() => {
expect(browser.getCurrentUrl())
.toContain('next/page');
});
it("should make modal appear", async () => {
var popModalButton = await $(".wrapper button");
var overlay = await $('.overlay.active');
browser.wait(
ExpectedConditions.presenceOf(popModalButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await popModalButton.isPresent())
.toBe(true);
await popModalButton.click();
});
describe("When user clicks modal button", async () => {
it("should proceed to final page", async () => {
var proceedToFinalPageButton = await $(".cta.modal-not-empty button.continue-to-final-page");
await browser.wait(
ExpectedConditions.presenceOf(proceedToFinalPageButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await proceedToFinalPageButton.isPresent())
.toBe(true);
});
});
});
});
It all works great until the test reach the last attempt to detect if the modal popped out:
await browser.wait(
ExpectedConditions.presenceOf(proceedToFinalPageButton),
5000,
'Element taking too long to appear in the DOM'
);
expect(await proceedToFinalPageButton.isPresent())
.toBe(true);
This isPresent()
doesn't return true
or false
, instead nothing happens and protractor stops and outputs the following error:
Failed: script timeout: result was not received in 11 seconds
Any idea what could be going wrong?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels