Пример #1
0
import PageObject from 'croodle/tests/page-object';

let {
  collection,
  text,
  visitable
} = PageObject;

const urlMatches = function(regExp) {
  return function() {
    const pollURL = currentURL();
    return regExp.test(pollURL);
  };
};

export default PageObject.create({
  description: text('.description'),
  options: collection({
    answers: text('.selections .form-group:eq(0) .radio', { multiple: true }),
    itemScope: '.selections .form-group',
    item: {
      label: text('label.control-label')
    },
    labels: text('.selections .form-group label.control-label', { multiple: true })
  }),
  title: text('h2.title'),
  urlIsValid: urlMatches(/^\/poll\/[a-zA-Z0-9]{10}\/participation\?encryptionKey=[a-zA-Z0-9]{40}$/),
  // use as .visit({ encryptionKey: ??? })
  visit: visitable('/poll/participation')
});
Пример #2
0
import PageObject from 'croodle/tests/page-object';

let {
  clickable,
  collection,
  fillable,
  hasClass,
  text
} = PageObject;

export default PageObject.create({
  days: collection({
    itemScope: '.form-group',
    labels: text('label:not(.sr-only)', { multiple: true })
  }),
  times: collection({
    itemScope: '.form-group',
    item: {
      add: clickable('button.add'),
      delete: clickable('button.delete'),
      label: text('label'),
      labelIsHidden: hasClass('label', 'sr-only'),
      time: fillable('input')
    }
  }),
  next: clickable('button[type="submit"]')
});
Пример #3
0
import PageObject from 'croodle/tests/page-object';

let {
  clickable,
  fillable,
  visitable
} = PageObject;

export default PageObject.create({
  next: clickable('button[type="submit"]'),
  pollType: fillable('.poll-type select'),
  visit: visitable('/create')
});
Пример #4
0
import PageObject from 'croodle/tests/page-object';

let {
  clickable,
  fillable
} = PageObject;

export default PageObject.create({
  description: fillable('.description textarea'),
  next: clickable('button[type="submit"]'),
  title: fillable('.title input')
});