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

Add none helper #299

Closed
magistrula opened this issue Apr 8, 2017 · 1 comment
Closed

Add none helper #299

magistrula opened this issue Apr 8, 2017 · 1 comment
Labels

Comments

@magistrula
Copy link
Contributor

Given the following test...

it('can clear the Roster', function() {
  RosterPageObject.clearRoster();

  // expect Roster to be in its initial state
  expect(RosterPageObject.rosterNames().count).to.equal(0);
  expect(RosterPageObject.nameInputValue).to.equal('');
  expect(RosterPageObject.isClearButtonVisible).to.be.false;
});

It may be helpful for the PageObject to define what it means for the Roster to be "empty" so that the tests don't have to check each individual criterion, and so that these criteria do not need to be repeated every time we need to check whether the roster is empty. A none helper would be useful in this case:

const RosterPageObject = create({
  rosterNames: collection({
    itemScope: '.roster-name'
  }),
  nameInputValue: value('.name-input'),
  isClearButtonVisible: isVisible('.clear-button'),

  isRosterBlank: none('rosterNames', 'nameInputValue', 'isClearButtonVisible')
});

This would allow the test above to be rewritten as follows:

it('can clear the Roster', function() {
  RosterPageObject.clearRoster();

  expect(RosterPageObject.isRosterBlank).to.be.true;
});
@san650 san650 added the feature label Apr 14, 2017
@magistrula magistrula mentioned this issue May 8, 2017
5 tasks
@ro0gr
Copy link
Collaborator

ro0gr commented Dec 14, 2018

Closing, since it can be achieved with getters. see #300 (comment)

@ro0gr ro0gr closed this as completed Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants