Comments (3)
Thanks Igor,
Was able to sort out the page objects after sending the email by referring,
var pageObject = this.page.pageObjectFile()
Some reason was only able to refer to the elements by pageObject.elements.elementName.selector
but not by @elementName from past two days.
step definition file:
var home = this.page.home();
this.assert.visible(home.elements.username.selector);
home.login(centreData.CO.username, centreData.CO.password);
this.page.common().waitForLoaderToDisappear();
Page Object:
var page = {
// page elements (allows @elementkey in tests)
elements : {
username : { selector: 'input[id=usn]' },
password : { selector: 'input[id=pass]' },
submit : { selector: 'input[type=submit]' }
},
// functions to be exposes via the page object via this.page.scriptname().functionname()
functions: {
login: function(username, password){
var common = this.api.page.common();
// always return runtime as this allows chaining within the step methods
return common.waitForLoaderToDisappear()
.setValue(page.elements.username.selector, username)
.setValue(page.elements.password.selector, password)
.click(page.elements.submit.selector)
.waitForElementVisible(common.elements.logout.selector, 5000);
}
}
};
// export in a format nightwatch understands
module.exports = {
// commands are exposed within step definition mehtod via this.page.home().functionName
commands: [page.functions],
// elements selectors allow step definition to use @attributeName to action a selector rather
// than hard coding selectors. For example this.setValue('@username','random-user');
elements: page.elements
};
from nightwatch-cucumber.
So if I am understanding you correctly the following code snippet is not working for you?
this.page.home().assert.visible('@username');
from nightwatch-cucumber.
Regarding
this.page.home().assert.visible('@username');
Its working, I was using this.assert.visible...rather than the
page_object.assert, hence the issue.
Cheers
Sharath Konda
On 31 December 2015 at 08:52, Igor Muchychka [email protected]
wrote:
So if I am understanding you correctly the following code snippet is not
working for you?this.page.home().assert.visible('@username');
—
Reply to this email directly or view it on GitHub
#18 (comment)
.
from nightwatch-cucumber.
Related Issues (20)
- Connection of two feature files without reusing HOT 1
- Adding feature of creating of XML reporting
- this.api is not available inside a page-object command definition HOT 3
- Feature request: HOT 1
- Simple Example not working HOT 4
- beforeEach is not called. before is called. after is called afterEach is not called HOT 3
- Incomplete Hook Example HOT 1
- Attach Nightwatch assertion messages to cucumber json report HOT 3
- [Bug] Using glob to define file source path in cucumberArgs does not work
- Version 10 of node.js has been released
- Can't return/await a promisified client.getCookies() HOT 1
- Allow passing tag_filter through test_settings
- API is not able to get Json report name when running tests in parallel mode with your own JSON formatter
- update to nightwatch 1.0.x HOT 2
- How to run individual feature in nightwatch js ? HOT 3
- How can I change selenium host for each scenario? HOT 1
- both element and page name of page object is supported in the step definition? HOT 1
- How to close the browser when the test case gets failed.
- Start test suite using cucumber-js HOT 2
- multiple arguments and implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nightwatch-cucumber.