Closed
Description
What are you trying to achieve?
I want to grab and assert a selected option inside a frame by using a within-block. I expect to have a proper test error handling in case of a failing assertion.
What do you get instead?
In case of a failing assertion
- the teardown session hangs and must be manually aborted (ctrl+c)
- the error ist not handled properly according to the console messages
Used chai lib and node assert with same result.
Output value to console instead assert works.
Using switchTo instead within works (but I prefer within).
Provide console output if related. Use
--verbose
mode for more details.
Within "{"frame":"#aniframe"}"
I see element "select[name=countrycode]"
[1] <within> Retrying... Attempt #2
» [Browser:Error] Failed to load resource: the server responded with a status of 500 (OK)
[1] <within> Retrying... Attempt #3
» [Browser:Error] Failed to load resource: the server responded with a status of 500 (OK)
» [Browser:Warning] The behavior that Selection.addRange() merges existing Range and the specified Range was removed. See https://www.chromestatus.com/features/6680566019653632 for more details.
[1] <within> Retrying... Attempt #4
Emitted | step.passed (I see element "select[name=countrycode]")
Emitted | step.finish (I see element "select[name=countrycode]")
Emitted | step.start (I grab text from "select[name=countrycode] > option:checked")
I grab text from "select[name=countrycode] > option:checked"
Emitted | step.passed (I grab text from "select[name=countrycode] > option:checked")
Emitted | step.finish (I grab text from "select[name=countrycode] > option:checked")
[1] <within> Finalize <within> session
Emitted | test.passed ([object Object])
Emitted | test.finish ([object Object])
√ OK in 1355ms
Emitted | test.after ([object Object])
[1] Retrying... Attempt #2
[1] Retrying... Attempt #3
[1] Retrying... Attempt #4
[1] Starting <teardown> session
Emitted | test.failed ([object Object])
Emitted | test.finish ([object Object])
» <screenshotOnFail> Test failed, saving screenshot
» Screenshot is saving to C:\workspace\cjs-sample\output\Check_selected_option_@selected_option_sample_after_each_hook__finalize_codeceptjs.failed.png
× FAILED in 1355ms
» [Browser:Error] Failed to load resource: net::ERR_EMPTY_RESPONSE
» [Browser:Error] Failed to load resource: net::ERR_EMPTY_RESPONSE
...
Provide test source code if related
const should = require('chai').should();
Scenario('Check selected option', (I) => {
I.click("Link to frame page");
I.retry({ retries: 3, maxTimeout: 5000 }).seeElement("#aniframe");
within({frame: '#aniframe'}, async () => {
I.retry({ retries: 3, maxTimeout: 5000 }).seeElement("select[name=countrycode]");
let oText = await I.grabTextFrom('select[name=countrycode] > option:checked');
oText.should.eql('somethin_else');
});
}).tag('selected_option_sample');
Details
- CodeceptJS version: 2.1.5
- NodeJS Version: 10.15.3
- Operating System: Windows 10
- Puppeteer version: 1.18.1
- Configuration file:
exports.config = {
tests: './tests/**/*_test.js',
output: './output',
helpers: {
Puppeteer: {
url: 'http://192.168.99.100:8080',
show: true,
waitForNavigation: [ "domcontentloaded", "networkidle0" ],
waitForAction: 500,
windowSize: "1600x1200",
chrome:{
"args": ["--no-sandbox", "--window-size=1600,1200"],
"defaultViewport": {width:1600, height:1200}
}
}
MyPuppeteer: {
require: './helpers/puppeteer_helper.js',
}
},
plugins: {
"allure": {}
},
include: {
I: './helpers/custom_steps.js'
},
bootstrap: null,
mocha: {},
name: 'cjs-sample'
}
Metadata
Metadata
Assignees
Labels
No labels