CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

.seeInField() not working as expected after upgrade to Chrome 92/ChromeDriver 92

Open JLRishe opened this issue 3 years ago • 0 comments

What are you trying to achieve?

Use the .seeInField() Webdriver helper on a text input that has a value, but whose value= attribute is blank.

What do you get instead?

.seeInField sees the input as having a blank value, even though it is not blank.

This was working fine until yesterday, but after upgrading from Chrome 90 to Chrome 92, 15 of my tests are failing.

It's not clear exactly what change in behavior caused this, but it seems that this line in the CodeceptJS's Webdriver.js helper is at the heart of the matter:

 const proceedSingle = el => this.browser.getElementAttribute(getElementId(el), 'value').then((res) => {

It looks like this line is grabbing value of the input's value attribute instead of the input's actual value (which is not the same thing). In my case, the input has a blank value attribute, but has a value, so .seeInField() seems to think the input is blank when it it isn't.

Why is the .seeInField helper implemented this way? It seems that .grabValueFrom is able to grab this input's value just fine, so there is an inconsistency here.

Example:

const templateName = await I.grabValueFrom('#templateName');

console.log(templateName);  // logs "TestForms"

I.seeInField('#templateName', 'TestForms');  // fails with the assertion error below

Error:

expected fields by #templateName to include "TestForms"
      + expected - actual

      +TestForms

Details

  • CodeceptJS version: 3.0.7
  • NodeJS Version: 16.4.1
  • Operating System: Windows 10
  • webdriverio 7.8.0
  • Configuration file:
exports.config = {
  "output": "./output",
  "helpers": {
    "WebDriver": {
      "url": "https://***********************8",
      "host": "localhost",
      "browser": "chrome",
      "windowSize": "maximize",
      "restart": false,
      "keepBrowserState": true,
      "keepCookies": true,
      "coloredLogs": true,
      "waitForTimeout": 10000
    },
    "TabSwitch": {
      "require": "./helpers/tabswitch_helper.js"
    },
    "LoginHelper": {
      "require": "./helpers/LoginHelper.js"
    }
  },
  "include": {
    "I": "./steps_file.js",
    "loginPagePage": "./pages/loginPage.js",
    "manageCredentialPage": "./pages/manageCredential.js",
    "templatePage": "./pages/template.js",
    "uiHelper": "./pages/uiHelper.js",
    "fvAssert": "./pages/fvAssert.js",
    "listPage": "./pages/listPage.js",
    "schemaSelector":"./pages/schemaSelector.js",
    "fvData": "./InputData/login.js",
    "peoplePickerHelper": "./pages/peoplePickerHelper.js",
    "config": "./pages/config.js",
    "designerHelper": "./pages/designerHelper.js",
    "ruleEditorHelper":  "./pages/ruleEditorHelper.js" 
  },
  "mocha": {
    "reporterOptions": {
      "codeceptjs-cli-reporter": {
        "stdout": "-",
        "options": {
          "verbose": false,
          "steps": true
        }
      },
      "mocha-junit-reporter": {
        "stdout": "./output/console.log",
        "options": {
          "mochaFile": "./output/result.xml"
        }
      }
    }
  },
  "bootstrap": require("./config/start_server.js"),
  "teardown": require("./config/stop_server.js"),
  "hooks": [],
  "tests": "**/fv_*_test.js",
  "timeout": 10000,
  "name": "FV",
  "plugins": {
    "wdio": {
      "enabled": true
    }
  }
};

JLRishe avatar Jul 27 '21 11:07 JLRishe