Skip to content

CodeceptJs passes test when unknown methode #4606

@deinlieblingskevin

Description

@deinlieblingskevin

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')
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions