Repository navigation
CodeceptJs passes test when unknown methode #4606
Copy link
Copy link
Closed
Description
What are you trying to achieve?
First off: we could manage to archieve autocompletion in our ide
So there can be some mistakes while writing a test. like in this example my coworker had a spelling in a method which lead to a passing test, even though it was all not valid (text was not there, button was not pressed).
We tried to call a methode that definitly doesnt exist. "sfslfdsflkds" and if we do so, the test always passes.
can we change this behaviour to failing? or an error message or something?
What do you get instead?
Error message or failing test or something related..
CodeceptJS v3.1.1
Using test root "C:\dev\TestConnectSuite\Frontend"
@SapInputMaskTom --
√ Approve SAP Test parameter in 17907ms
OK | 1 passed // 21s
Execution time (hr): 20s 728.7074msProvide test source code if related
I.sfslfdsflkds();
I.see('somethingNotthere')
I.seeElement(....) // unkown element, which is definitly not thereDetails
- CodeceptJS version: v3.1.1
- NodeJS Version: 14.16
- Operating System: Windows
- puppeteer
- Configuration file:
const {setHeadlessWhen} = require('@codeceptjs/configure');
const testFolder = './e2e/pages';
const fs = require('fs');
let include = fs.readdirSync(testFolder)
// get access to file and path
.map(file => ({file, path: file}))
// replace snake case to camel case
.map(({file, path}) => ({file: file.replace(/([-_]\w)/g, g => g[1].toUpperCase()), path}))
// remove .js extension
.map(({file, path}) => ({file: file.slice(0, -3), path}))
// convert to object with key as file + "Page", value as "file location"
.reduce((obj, {file, path}) => (obj[`${file}Page`] = `${testFolder}/${path}`, obj), {});
include = {I: './e2e/steps/steps_file.js', ...include};
// turn on headless mode when running with HEADLESS=true environment variable
// HEADLESS=true npx codecept run
setHeadlessWhen(process.env.HEADLESS);
exports.config = {
tests: './e2e/tests/*_test.js',
output: './e2e/output/',
helpers: {
Puppeteer: {
url: process.env.profile,
show: true,
waitForNavigation: 'networkidle0',
waitForAction: 500,
smartWait: 10000,
getPageTimeout: 0,
windowSize: '1280x960',
chrome: {
executablePath: 'C:/Program Files/Chromium/Application/chrome.exe',
args: ['--window-size=1280,1080'],
defaultViewport: {
width: 1280,
height: 960
}
},
},
},
include,
mocha: {
"reporterOptions": {
"codeceptjs-cli-reporter": {
"stdout": "-",
"options": {
"verbose": false,
"steps": true
}
},
"mocha-junit-reporter": {
"stdout": "./output/console.log",
"options": {
"mochaFile": "./e2e/output/result.xml"
}
}
}
},
name: 'Frontend',
plugins: {
retryFailedStep: {
enabled: true
},
screenshotOnFail: {
enabled: true
},
pauseOnFail: {
enabled: false
},
tryTo: {
enabled: true
}
},
bootstrap: require('./e2e/hooks/bootstrap.js'),
teardown: require('./e2e/hooks/teardown.js')
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
kobenguyent commentedon Nov 19, 2024
hi @deinlieblingskevin may you happen to reproduce the same issue with latest version?
deinlieblingskevin commentedon Nov 19, 2024
its a big software and right now we cannot upgrade. maybe in january we will be able to do so and try the latest version
kobenguyent commentedon Nov 19, 2024
thanks for your prompt reply! My guess is that using TS would prevent us from having this kinda issue.
deinlieblingskevin commentedon Nov 19, 2024
thanks for the fast answer. how much efford is it to switch to typescript?
kobenguyent commentedon Nov 19, 2024
https://codecept.io/typescript/#getting-started
I could not say for sure. But as the documentation, it doesn't sound much complicated.
deinlieblingskevin commentedon Nov 19, 2024
Thanks a @kobenguyent, i tried it on a spike to switch to ts and its really helpful! <3