forked from nightwatchjs/nightwatch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid closing of session according to end_session_on_fail (nightwatch…
- Loading branch information
1 parent
550ef83
commit 1a1a223
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const nock = require('nock'); | ||
const nocks = require('../../lib/nocks'); | ||
const common = require('../../common.js'); | ||
const CommandGlobals = require('../../lib/globals/commands.js'); | ||
const {settings} = common; | ||
const {runTests} = common.require('index.js'); | ||
|
||
describe('test runner with end_session_on_fail flag', function() { | ||
|
||
before(function(done) { | ||
nocks.enable().cleanAll(); | ||
CommandGlobals.beforeEach.call(this, done); | ||
|
||
}); | ||
|
||
after(function(done) { | ||
nocks.disable(); | ||
CommandGlobals.afterEach.call(this, done); | ||
}); | ||
|
||
|
||
it('session is not ended with end_on_sessiion_fail: false', function() { | ||
let endSessionCalled = false; | ||
const testFile = path.join(__dirname, '../../sampletests/withfailures/sample.js'); | ||
|
||
nocks.createSession() | ||
.url() | ||
.elementNotFound('#weblogin'); | ||
|
||
|
||
nock('http://localhost:10195') | ||
.delete('/wd/hub/session/1352110219202') | ||
.reply(204, ()=> { | ||
endSessionCalled = true; | ||
|
||
return ''; | ||
}); | ||
|
||
return runTests(testFile, settings({ | ||
enable_fail_fast: true, | ||
end_session_on_fail: false, | ||
globals: { | ||
waitForConditionPollInterval: 5, | ||
waitForConditionTimeout: 5, | ||
retryAssertionTimeout: 1 | ||
} | ||
})).catch(_ => { | ||
assert.strictEqual(endSessionCalled, false); | ||
}); | ||
|
||
|
||
}); | ||
|
||
}); |