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

Introduce (private) action #509

Merged
merged 9 commits into from
May 18, 2020
Merged

Introduce (private) action #509

merged 9 commits into from
May 18, 2020

Conversation

ro0gr
Copy link
Collaborator

@ro0gr ro0gr commented May 7, 2020

This formalizes actions flow by leveraging action utility implemented in this PR.

Here is how an action may look like:

function clickable(selector, queryOptions = {}) {
  return action({ ...queryOptions, selector }), function() {
    const element = findOne(this.node, this.query.selector, this.query);

    return this.adapter.click(element);
  });
}

the action util provide a wrapper for page object descriptor, which is responsible for invocation of user function, and handling error message(if any). That's basically what we did before, but responsibilities were spreaded across different layers a bit.

In the example above you've might noticed this which has:

  • node - page object node on which the action is processed
  • query - CSS selector and some other (j)query options
  • adapter previously known as ExectutionContext, but now it's only responsible for DOM interactions. All The find logic removed from there now.

So this is a reincarnation of execution contexts with a more clear responsibility now.

@coveralls
Copy link

coveralls commented May 9, 2020

Coverage Status

Coverage decreased (-0.2%) to 98.418% when pulling 20869f0 on ro0gr:actions into ebac9d3 on san650:v2-beta.

@ro0gr ro0gr mentioned this pull request May 9, 2020
@ro0gr ro0gr force-pushed the actions branch 2 times, most recently from 588f2b0 to 89891bf Compare May 9, 2020 21:43
@ro0gr ro0gr marked this pull request as ready for review May 11, 2020 21:00
@ro0gr ro0gr changed the title introduce and use action Introduce (private) action May 11, 2020
@ro0gr ro0gr merged commit 242e2ab into san650:v2-beta May 18, 2020
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