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

clickAt selector example don't work #339

Open
Danieler opened this issue Oct 14, 2015 · 3 comments
Open

clickAt selector example don't work #339

Danieler opened this issue Oct 14, 2015 · 3 comments

Comments

@Danieler
Copy link

When i try to execute this step of the example in doc it fails
What its wrong?

TypeError: Cannot read property 'click' of undefined
at /usr/lib/node_modules/pioneer/lib/support/widgets.js:417:24

 this.When(/^complete the first todo$/, function () {

var List = this.Widget.List.extend({
      root: ".todo-list",
      itemSelector: "li"
    })

return new List().clickAt({
      index: 0,
      selector: "input"
    });

});

html:

     <ul class="todo-list"><li>
        <div class="view">
            <input class="toggle" type="checkbox">
            <label>Lear Pioneer</label>
            <button class="destroy"></button>
        </div>
        <input class="edit" value="Lear Pioneer">
    </li></ul>
@Danieler
Copy link
Author

the step definition must be then instead of When because the list is not created yet...
the global timeout from then function is set to 5 seconds
Could be interesting leave an option for execute cucumberjs callback manually or set up the timeout for the step...

@sethkrasnianski
Copy link
Member

For the When I enter "Learn Pioneer" step, could you change the step definition code to this...

this.When(/^I enter \"([^\"]*)\"$/, function(value){
  return new this.Widget({
    root: "header.header"
  }).sendKeys({
    selector: '.new-todo',
    keys: [
      value,
      '\uE007'
    ]
  });
});

Your final scenario should look like this...

Scenario: Completing a Todo
  When I enter "Learn Pioneer"
  And complete the first todo
  Then I should see that the first todo is completed

Let me know if that works out and I'll update the docs to reflect it.

@Danieler
Copy link
Author

i think that the scenario have to be like this, the then step with the should check must stay before to have the list created.

the "When i complete first todo" step is the one that fails..

   Scenario: Completing a Todo
   When I enter "Learn Pioneer"
   Then I should see "Learn Pioneer"
   When complete the first todo
   Then I should see that the first todo is completed

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

No branches or pull requests

2 participants