You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.
I have the following mocha test and having trouble if I wait for something that never exists.
In the example below I try to login as an invalid user and would expect a fail as the input[Value="Go"] never appears on the page!
const { Chromeless } = require('chromeless')
const { expect } = require('chai').use(require('chai-string'))
const options = require('yargs-parser')(process.argv.slice(2))
describe('When trying to login', function () {
console.log(options.url)
//increase as mocha has a 2 second set by default
this.timeout(5000);
var chromeless;
before(async function () {
chromeless = new Chromeless();
await chromeless
.goto(options.url + "/account")
.setViewport({ width: 1200, height: 800, scale: 1 })
})
it('check we are on the login page /account', async function () {
const href = await chromeless
.evaluate(href => window.location.href)
expect(href).to.endsWith('/account')
})
it('logs in [email protected] successfully', async function () {
const href = await chromeless
.type('[email protected]', 'input[Id="Username"]')
.type('123', 'input[Id="Password"]')
.click('input[type="submit"]')
//This would fail AT THIS POINT the input[Value="Go"] never appears on the page
.wait('input[Value="Go"]')
.evaluate(href => window.location.href)
expect(href).to.endsWith('/account/search/1')
})
after(async function () {
try {
console.log("trying to stop chromeless")
await chromeless.end()
console.log("I never get here!")
} catch (e) {
console.log(e)
done()
}
})
})
When running the script i get the following exception logged and the script does not exit
Error: wait("input[Value="Go"]") timed out after 10000ms
at Object.<anonymous> (/data/node_modules/chromeless/dist/src/util.js:137:60)
at step (/data/node_modules/chromeless/dist/src/util.js:40:23)
at Object.next (/data/node_modules/chromeless/dist/src/util.js:21:53)
at /data/node_modules/chromeless/dist/src/util.js:15:71
at Promise (<anonymous>)
at __awaiter (/data/node_modules/chromeless/dist/src/util.js:11:12)
at Timeout.<anonymous> (/data/node_modules/chromeless/dist/src/util.js:130:81)
at ontimeout (timers.js:469:11)
at tryOnTimeout (timers.js:304:5)
at Timer.listOnTimeout (timers.js:264:5)
How should i wire it up so if a wait fails the script exits gracefully?
The text was updated successfully, but these errors were encountered:
I have the following mocha test and having trouble if I wait for something that never exists.
In the example below I try to login as an invalid user and would expect a fail as the
input[Value="Go"]
never appears on the page!When running the script i get the following exception logged and the script does not exit
How should i wire it up so if a wait fails the script exits gracefully?
The text was updated successfully, but these errors were encountered: