Thanks and Feedback
ojnc opened this issue · 2 comments
Super Tutorial!
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
- Had to insert a signinTop
- You may have missed quotes around submit
- But .click('@signinButton') with only 1 does not work;
2 does but gives a error that does not stop instancesPage code execution
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
[Signin Spec] Test Suite
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
Hi @ojnc thank you for your feedback, I really appreciate it. Please could you make a pull request for this issue? Thank you?
Hi
I an new to Testing and was in discovery phase deciding the software best for our teams requirements.
Have decided on cypress as we needed E2E only.
I realized nightwatch combo was the established choice.
Your tutorial no doubt the best.
But for our work cypress was just right.
Regards & Thanks
-jnc