pageobject-io / pageobject-generator Goto Github PK
View Code? Open in Web Editor NEWSimple library for generating Protractor page objects.
Home Page: http://pageobject.io
License: MIT License
Simple library for generating Protractor page objects.
Home Page: http://pageobject.io
License: MIT License
We have an NgOptionsLocatorStrategy that matches on ng-options. At the moment we use this to generate a selector for the select, but Protractor returns the nested options if by.options is used. Because of this all of the generated methods are incorrect (our methods assume they work with the select tag).
For now, I have removed this locator strategy from the config. We need to test the generated methods with a Protractor test and adjust if necessary.
Currently you can only change the settings for the currently selected element. It would be nice to change the settings of alle elements globally at once. So I don't have to walk through my 3, 40, 100?! elements and dis-/enable the settings.
Hi,
You should not be doing expectations in a page object. That's defeating the purpose of a page object and somewhat bad practice. I saw the generation of the simple example on the website here:
var UnnamedPageObject = function() {
this.get = function() {
browser.get('');
};
this.a0 = element(by.css('a.a'));
this.clickA0 = function() {
this.a0.click();
};
this.a0ShouldBeVisible = function() {
expect(this.a0.isDisplayed()).toBeTruthy();
};
this.a0ShouldNotBeVisible = function() {
expect(this.a0.isDisplayed()).toBeFalsy();
};
this.a0ShouldHaveClass = function(className) {
this.a0.getAttribute('class').then(function(classes) {
expect(classes.split(' ').indexOf(className) !== -1).toBeTruthy();
});
};
this.a0ShouldNotHaveClass = function(className) {
this.a0.getAttribute('class').then(function(classes) {
expect(classes.split(' ').indexOf(className) === -1).toBeTruthy();
});
};
};
module.exports = new UnnamedPageObject();
The expectations are typically something you should do in your test file. Not in a helper class. This beats the purpose of seperation of concern.
All that aside, very nice project! :)
Please keep on updating/improving!
Grtz!
I am developing Angular 2 Dart applications and could use your tool to generate Page Objects for the templates.
There is already a tool out there that helps a lot:
https://github.com/google/pageloader/blob/master/dart/sync/PageLoaderManual.md
I believe, generating PageLoader compatible output would be the best way to go forward.
When the locator is generated by an expression which contains string, the single quotes doesn't get escaped. eg.:
<label class="control-label">
<i class="fa fa-calendar"></i>
{{'messages.createdFrom' | translate}}
</label>
This will generate the following property:
this.messagesCreatedFrom = element(by.exactBinding(''messages.createdFrom' | translate'));
Can you add support for NightwatchJS pageobject model ?
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.