Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodeceptJs passes test when unknown methode #4935

deinlieblingskevin started this conversation in Show and tell
Discussion options

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.7074ms

Provide test source code if related

I.sfslfdsflkds();
I.see('somethingNotthere')
I.seeElement(....) // unkown element, which is definitly not there

Details

  • 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')
}
You must be logged in to vote

Replies: 6 comments

Comment options

hi @deinlieblingskevin may you happen to reproduce the same issue with latest version?

You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
0 replies
Comment options

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

thanks for your prompt reply! My guess is that using TS would prevent us from having this kinda issue.

You must be logged in to vote
0 replies
Comment options

thanks for the fast answer. how much efford is it to switch to typescript?

You must be logged in to vote
0 replies
Comment options

thanks for the fast answer. how much efford is it to switch to typescript?

https://codecept.io/typescript/#getting-started
I could not say for sure. But as the documentation, it doesn't sound much complicated.

You must be logged in to vote
0 replies
Comment options

Thanks a @kobenguyent, i tried it on a spike to switch to ts and its really helpful! <3

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #4606 on March 24, 2025 06:57.

AltStyle によって変換されたページ (->オリジナル) /