Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for Screenplay-style explicit and fluent wait #7
I Loved the concept of Screenplay pattern. I would love to learn this. Concept is clear.
Hey @srinivasbudh and thank you for your kind words and your interest in Serenity/JS :-)
The best way to get started with Serenity/JS is to go through the tutorials.
If you want to just have a look at a finished implementation of some example projects, you can head to the
There's also an example implementation located in the
Does this answer your question?
Thanks for your response. Yes I have gone through the implementation using your tutorials. In fact I have implemented 2-reports branch using your tutorials.
I was looking for a project which would use .js files rather than .ts files for step definition. Is this possible for implementation??
Reason I am asking this is Few of the protractor commands I tried executing are not compilable in .ts files.
In order to resolve this problem Serenity/JS needs to provide a Task centred around waiting for things to happen, effectively wrapping the
Is that's what you think might help?
Would you mind giving me an example of what is that you'd like the test scenario to wait for in your case (I might just prioritise it over other "waits" I need to implement ;-) ).
That's good to see a response, so quick.
In my case I am using Protractor with a non-angular application my UI is designed in reactJS. So I can't use waitForAngular for the page to load.
When I navigate in between pages (example: gmail) It's easy to land on login page, However After login it might take few seconds(1-10 depending on the speed of internet) for the inbox to be displayed. In this case I want to make my code to wait till it find the compose button(may be with a time limit of 10 seconds).
I assume this wait can be handled using Explicit wait, which is throwing compilation error on this files.
changed the title from
Support for Screenplay-style explicit and fluent wait
Dec 6, 2016
The latest version of Serenity/JS should support your use case.
There are two ways you can wait for things to happen:
actor.attemptsTo( Wait.for(Duration.ofMillis(500)), // *assumes* that the button will show up during 500ms Click.on(InboxNavigation.Compose_Button) )
actor.attemptsTo( Wait.until(InboxNavigation.Compose_Button, Is.clickable()), Click.on(InboxNavigation.Compose_Button) )
You can also specify the maximum timeout:
actor.attemptsTo( Wait.upTo(Duration.ofSeconds(10)).until(InboxNavigation.Compose_Button, Is.clickable()), Click.on(InboxNavigation.Compose_Button) )
I hope that this helps you solve your problem! Please let me know how you're getting on with this new feature :-)
This Looks great I was looking for a similar solution, However this is not working when I tried Implementing it. Duration.seconds(10) gives me a error sating second is not a parameter. Tried using Duration.ofSeconds(60), Which is not throwing any error but Not Waiting for the element to be displayed and not throwing an error when locator is not available.
I've not had a look into the latest serenity recipes yet, but isn't the protractor 'way' to use expected conditions?
I've had success in the past with:
@nbarrett : Yes, Protractor can handle this, I was also using something similar to handle this.
Hmm, I'd always avoid