codejockie / e2e-testing-nightwatch Goto Github PK
View Code? Open in Web Editor NEWSource code to my tutorials on E2E Testing with Nightwatch.js
Source code to my tutorials on E2E Testing with Nightwatch.js
It may have been some while and things moving may have upset the code!
I ran your repo and some tests worked but some did not. I really liked the filters.spec.js
I put some effort on sign.in.spec
https://cjdocs.herokuapp.com/auth/signin is very slow
so I changed globals.js and added an extra 0! waitForConditionTimeout: 100000
This version of signinPage.js worked apart for a non-show-stopper error
const signinCommands = {
signin(email, password) {
return this
.waitForElementVisible('@signinTop')
.click('@signinTop')
.waitForElementVisible('@emailInput')
.setValue('@emailInput', email)
.setValue('@passwordInput', password)
.waitForElementVisible('@signinButton')
.click('@signinButton')
.click('@signinButton')
}
};
export default {
url: 'https://cjdocs.herokuapp.com/auth/signin',
commands: [signinCommands],
elements: {
emailInput: {
selector: 'input[type=email]'
},
passwordInput: {
selector: 'input[name=password]'
},
signinButton: {
selector: 'button[type="submit"]'
},
signinTop: {
selector: 'a[href="/signin"]'
}
}
};
Changes
One change of text in signin.spec.js Welcome to the Docs Home! no CJ
module.exports = {
'User can sign in'(client) {
const signinPage = client.page.signinPage();
const instancesPage = client.page.instancesPage();
signinPage
.navigate()
.signin(process.env.EMAIL, process.env.PASSWORD);
instancesPage.expect.element('@homepageWelcomeTitle').text.to.contain('Welcome to the Docs Home!');
client.end();
}
};
OUTPUT
C:\winreactjs\e2e-testing-nightwatch>nightwatch --env local
i Connected to 127.0.0.1 on port 4444 (5888ms).
Using: chrome (81.0.4044.138) on Windows NT platform.
Running: User can sign in
√ Element <a[href="/signin"]> was visible after 74 milliseconds.
√ Element <input[type=email]> was visible after 112 milliseconds.
√ Element <button[type="submit"]> was visible after 50 milliseconds.
Error while running .getElementText() protocol action: stale element reference: element is not attached to the page document
√ Expected element <//div/h2> text to contain: "Welcome to the Docs Home!" (2178ms)
OK. 4 assertions passed. (7.353s)
Regards & Thanks
Jayanta@Kolkata
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.