Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#160 feat: add WaitForQuestion to ActiveWait #160

Closed
wants to merge 1 commit into from

Conversation

nbarrett
Copy link
Contributor

@nbarrett nbarrett commented Feb 5, 2018

Hey @jan-molak I've added WaitForQuestion in order to provide further waiting flexibility outside of waiting for an ElementFinder Condition to be met (which as I understand is focussed on a the state of a single element). In my project I found myself wanting to wait for more sophisticated conditions that lean on the parsing/transformation/aggregation that can only really be done in a Question.

So this pull request now allows you to do this kind of thing:
Wait.upTo(<duration>).untilQuestionAnsweredTrue(<boolean Promise returning Question>)

@jan-molak
Copy link
Member

Thanks @nbarrett! I've decided to re-write the Wait interaction completely to address this use case.
In Serenity/JS 2.0 you will be able to do things like:

import { Text, Website } from '@serenity-js/protractor';
import { endsWith, Ensure, equals } from '@serenity-js/assertions';

const Header = Target.the('header').located(by.css('h1'));

actor.attemptsTo(
  Wait.until(Header, isVisible()),
  Wait.until(Text.of(Header), equals('Hello Nick!')),
  Wait.until(Website.url(), endsWith(Text.of(Header))),
  Ensure.that(Website.url(), endsWith(Text.of(Header))),
);

Stay tuned :-)

@jan-molak jan-molak closed this Feb 6, 2019
@nbarrett
Copy link
Contributor Author

Hey @jan-molak - looking at your examples above, I'm not sure whether your solution will address my requirement as that seems to focus on examining the state of single element. However my requirement stemmed from the need to wait for more sophisticated conditions (parsing/transformation/aggregation) that can only be achieved in a Question

@jan-molak
Copy link
Member

OK, let me re-open it for the time being and add the link to the code sample we discussed.

@jan-molak jan-molak reopened this Feb 20, 2019
@jan-molak jan-molak added this to the 2.0 milestone Feb 20, 2019
@nbarrett
Copy link
Contributor Author

Cheers @jan-molak! Actually that code is kinda in this PR too!

@nbarrett nbarrett closed this Nov 26, 2019
@nbarrett nbarrett deleted the wait-for-question branch November 26, 2019 23:54
@nbarrett
Copy link
Contributor Author

Hey @jan-molak - I closed this PR as I realised this functionality is now in Serenity 2.0 and I've replaced the code in my old solution with the new code. Awesome job!!

nbarrett pushed a commit to nbarrett/serenity-js that referenced this pull request May 1, 2020
…d_yarn/typescript-3.8.2

Bump typescript from 3.7.5 to 3.8.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants