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

allow to use assertion / step groups #13

Open
gr2m opened this issue Aug 12, 2014 · 1 comment
Open

allow to use assertion / step groups #13

gr2m opened this issue Aug 12, 2014 · 1 comment

Comments

@gr2m
Copy link

gr2m commented Aug 12, 2014

I 😍 Dalek's API.

One thing that'd I'd like to do is this:

test.open( url ).assert( userIsSignedOut ).done()

function userIsSignedOut() {
  this.assert.chain()
    .visible('.accountBar')
    .text('.username', '')
  .end()
}

That would allow me to define reusable steps / assertion groups. I'd like to have the same for steps, like so

test.open( url ).then( takeScreenshots ).done()

function takeScreenshots() {
    this.resize({width: 320, height: 480})
    this.screenshot('/screenshots/:viewport')
    this.resize({width: 768, height: 1024})
    this.screenshot('/screenshots/:viewport')
    this.resize({width: 1280, height: 800})
    this.screenshot('/screenshots/:viewport')
    this.resize({width: 1680, height: 1050})
    this.screenshot('/screenshots/:viewport')
}

This would make the actual test files very consize and even more readable, at the same time allow for better code reuse. Happy to help building this if you like it

@asciidisco
Copy link
Member

Yep,
with the current architecture, this is more or less impossible (at least in the way you scribbled it here).
But you can do something similar, I have an example lying around from a workshop I did a few months
ago, see:

https://github.com/asciidisco/jsdays-workshop/blob/8-dry/test/dalek/form2.js#L12
https://github.com/asciidisco/jsdays-workshop/blob/8-dry/test/dalek/functions/formHelper.js

It is not that elegant, but we will have a better solution for this in Skaro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants