linstula / ember-page-object Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Add a scope to Page Objects so interaction helpers look for elements within scope.
@linstula I would link out to your blog post in the README. It provides some good, introductory context that is not provided in the README.
I hope this isn't a really stupid question. All of the addon's code is in the /addon
dir. Doesn't that mean that this is being compiled into vendor? Since this is only for testing, wouldn't putting in a place like /lib
work?
When calling `this.visit('/?queryParam=hello_world') it doesn't work as if the user goes to that address in the browser and it gets picked up by Ember as queryParams as usual.
Ideally, we would like to have a unique attribute (data-auto-id
) on DOM elements that we are testing for. This will allow us to target elements with greater specificity than if we were to simply identify them by "type" (data-auto-type
).
@danmcclain After talking this through with @linstula, it seems wise to implement a data-auto-type
attribute first and then implement id
-based targeting later, once we have a sound plan for ensuring that a given element has a unique id in the template.
The issue that we're running into with resource-backed elements is that we can't guarantee that they will be unique. With multiple components being rendered, it is very difficult to ensure that a given element has a unique id. This is especially true if the data-auto-id
is computed. But even if we were to enter the attribute into the template statically, the same user record may be displayed multiple times, which would render the same data-attribute multiple times (e.g., user-1
or user-lin-reid
).
We're going to simply rename data-test-selector
to data-auto-type
and then revisit this.
Is there a way to use the page-object
for a checkbox to see if it's checked?
I tried searching across the repo under several keywords, but couldn't find anything.
This is how my current Ember test looks for it:
find('.t-settings-modules-tickets').prop('checked')
We do use a pattern to check checkboxes using your library, but I know that it's a hack, so wanted to see if there is a better way. Currently, this is how we use the page-object
to check for checkboxes being checked:
import PageObject from 'bsrs-ember/tests/page-object';
var DTDPage = PageObject.create({
fieldRequiredTwoNotChecked: () => Ember.$('.t-dtd-field-required').is(':not(:checked)'),
fieldRequiredTwoChecked: () => Ember.$('.t-dtd-field-required').is(':checked'),
});
Thanks in advance,
Aaron
I would of proposed changes for the readme but I'm not sure of the answer just yet. Your documentation has several examples of selectors using standard sizzle style queries. Eg:
export default class SignupPage extends PageObject {
fillInEmail(text) {
return this.fillIn('#email', text);
}
}
But, at far as I can tell, you only ship a data-attribute bridge, meaning that everything you want to select requires the data-test-selector
attribute. Am I correct in this? Is there a regular bridge or is that something I need to write and pass into the constructor?
I wanted to know if it is possible to access a buttons attributes to know if a button is disabled or not?
I have this code:
assert.ok(find('.t-dt-start').attr('disabled'));
That I'd like to use an ember-page-object
in the first snippet test if possible. Is this possible?
Thank you in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.