Skip to content

Instantly share code, notes, and snippets.

@juanazam
Created August 20, 2015 13:20
Show Gist options
  • Select an option

  • Save juanazam/3778e1333d29a2097ba6 to your computer and use it in GitHub Desktop.

Select an option

Save juanazam/3778e1333d29a2097ba6 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';
import PO from '../page-object';
let application;
module('Collections', {
beforeEach: function() {
application = startApp();
},
afterEach: function() {
Ember.run(application, 'destroy');
}
});
var textField = PO.customHelper(function() {
return {
fieldName: PO.text('h3'),
inputValue: PO.value('input')
};
});
let personEntry = PO.customHelper(function() {
return {
title: PO.text('h2'),
firstNameField: textField('.first-name'),
LastNameField: textField('.last-name'),
};
});
let page = PO.build({
visit: PO.visitable('/example'),
scope: '.your-parents',
father: personEntry('.father'),
mother: personEntry('.mother')
});
test('Page contents', function(assert) {
page.visit();
page.users(1).gender().select('Female');
andThen(function() {
assert.equal(page.mother().title(), 'Mother');
assert.equal(page.mother().firstNameField().fieldName(), 'Mother First Name');
assert.equal(page.mother().lastNameField().fieldName(), 'Mother Last Name');
assert.equal(page.father().title(), 'Father');
assert.equal(page.father().firstNameField().fieldName(), 'Father First Name');
assert.equal(page.father().lastNameField().fieldName(), 'Father Last Name');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment