Skip to content

waitForClickable: Timeout doesn't work, method call fails immediately #2166

@mirao

Description

@mirao

What are you trying to achieve?

The following call I.waitForClickable() should fail after 10 sec.
Note: The test page contains disabled button.

What do you get instead?

CodeceptJS logs "element button still not clickable after 10 sec", however it's not true, because the test fails immediately.

$ npx codeceptjs run buttondisabled_test.js --verbose
CodeceptJS v2.4.1
Using test root "/home/mirao/workspace/mycodeceptjs/tests/my"
Helpers: WebDriver
Plugins: screenshotOnFail, retryFailedStep

ButtonDisabled --
    [1] Starting recording promises
    Emitted | suite.before ([object Object])
  Test that button is enabled
    Emitted | test.before ([object Object])
    Emitted | test.start ([object Object])
    Emitted | step.before (I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html")
    Emitted | step.after (I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html")
    Emitted | step.before (I wait for clickable "button", 10)
    Emitted | step.after (I wait for clickable "button", 10)
    Emitted | step.start (I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html")
    I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html"
    Emitted | step.passed (I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html")
    Emitted | step.finish (I am on page "https://design-system.service.gov.uk/components/button/disabled/index.html")
    Emitted | step.start (I wait for clickable "button", 10)
    I wait for clickable "button", 10
    [1] Error | Error: element button still not clickable after 10 sec
    Emitted | step.failed (I wait for clickable "button", 10)
    Emitted | step.finish (I wait for clickable "button", 10)
    [1] Error | Error: element button still not clickable after 10 sec
    [1] Starting <teardown> session
    Emitted | test.failed ([object Object])
    Emitted | test.finish ([object Object])
    [1] <teardown> Stopping recording promises
 › <screenshotOnFail> Test failed, saving screenshot
 › Screenshot has been saved to /home/mirao/workspace/mycodeceptjs/tests/my/output/Test_that_button_is_enabled.failed.png
  ✖ FAILED in 1082ms

    [2] Starting recording promises
    Emitted | test.after ([object Object])
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) ButtonDisabled
       Test that button is enabled:
     element button still not clickable after 10 sec
  
  Scenario Steps:
  
  - I.waitForClickable("button", 10) at Test.Scenario (buttondisabled_test.js:5:7)
  - I.amOnPage("https://design-system.service.gov.uk/components/button/disabled/index.html") at Test.Scenario (buttondisabled_test.js:4:7)
  
  Error: element button still not clickable after 10 sec
      at timer.catch.e (/home/mirao/workspace/mycodeceptjs/node_modules/webdriverio/build/commands/browser/waitUntil.js:30:15)
      at process._tickCallback (internal/process/next_tick.js:68:7)


  FAIL  | 0 passed, 1 failed   // 6s
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])

Provide test source code if related

Feature("ButtonDisabled");

Scenario("Test that button is enabled", (I) => {
    I.amOnPage("https://design-system.service.gov.uk/components/button/disabled/index.html");
    I.waitForClickable("button", 10);
});

Details

  • CodeceptJS version: 2.4.1
  • NodeJS Version: v10.18.1
  • Operating System: Ubuntu 19.10
  • webdriverio 5.18.6
  • Configuration file:
exports.config = {
    tests: "./*_test.js",
    output: "./output",
    helpers: {
        WebDriver: {
            url: "http://localhost",
            browser: "chrome"
        }
    },
    include: {
        I: "./steps_file.js"
    },
    bootstrap: null,
    mocha: {},
    name: "my",
    plugins: {
        retryFailedStep: {
            enabled: true
        },
        screenshotOnFail: {
            enabled: true
        }
    }
};

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