Create
Methods
Table of Contents
create
Creates a new PageObject.
By default, the resulting PageObject will respond to:
- Actions: click, clickOn, fillIn, select
- Predicates: contains, isHidden, isPresent, isVisible
- Queries: text
definition can include a key context, which is an
optional integration test this context.
If a context is passed, it is used by actions, queries, etc.,
as the this in this.$().
If no context is passed, the global Ember acceptence test helpers are used.
Parameters
definitionObject PageObject definition (optional, default{})definition.contextObject? A test’sthiscontext
optionsObject [private] Ceibo options. Do not use! (optional, default{})
Examples
// <div class="title">My title</div>
import { create, text } from 'ember-cli-page-object';
const page = create({
title: text('.title')
});
assert.equal(page.title, 'My title');
// <div id="my-page">
// My super text
// <button>Press Me</button>
// </div>
const page = create({
scope: '#my-page'
});
assert.equal(page.text, 'My super text');
assert.ok(page.contains('super'));
assert.ok(page.isPresent);
assert.ok(page.isVisible);
assert.notOk(page.isHidden);
assert.equal(page.value, 'my input value');
// clicks div#my-page
page.click();
// clicks button
page.clickOn('Press Me');
// fills an input
page.fillIn('name', 'John Doe');
// selects an option
page.select('country', 'Uruguay');
Returns PageObject