ui5-community / wdi5

official UI5 end-to-end test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
https://ui5-community.github.io/wdi5/
Apache License 2.0
102 stars 43 forks source link

Testing with chromedriver: data:, in address bar #401

Closed htammen closed 1 year ago

htammen commented 1 year ago

Describe the bug When I start my test with wdio run wdio.conf.js the chromium browser starts but the address bar of the browser shows data: , instead of my baseurl. As a result my tests are not executed at all.

When I set the config.capabilities to

      browserName: "chromium",
      binary: "/snap/bin/chromium",

the correct url is called in the browser.

When running with Firefox (geckodriver) the correct url is also run but in that case I get other errors in my test setup which don't appear when I'm using the chromium setting.

To Reproduce Steps to reproduce the behavior:

This is my wdio.conf.js file

const { join } = require("path");

exports.config = {
  wdi5: {
    screenshotPath: join("webapp", "wdi5-test", "__screenshots__"),
    logLevel: "verbose", // error | verbose | silent
    waitForUI5Timeout: 30000,
  },
  //// wdio runner config
  specs: [join("webapp", "wdi5-test", "**/*.test.js")],
  // Patterns to exclude.
  exclude: [],
  //// capabilities ("browser") config
  maxInstances: 10,
  capabilities: [
    {
      // overwrite global "maxInstances"
      maxInstances: 5,
      browserName: "chrome",
      acceptInsecureCerts: true,
      "goog:chromeOptions": {
        args: process.argv.indexOf("--headless") > -1
          ? ["window-size=1440,800", "--headless"]
          : process.argv.indexOf("--debug") > -1
          ? ["window-size=1920,1280", "--auto-open-devtools-for-tabs"]
          : ["window-size=1920,1280"],
      },
      "wdi5:authentication": {
        provider: "BasicAuth", //> mandatory
      },
    },
  ],
  //// test config
  // Level of logging verbosity: trace | debug | info | warn | error | silent
  logLevel: "error",
  bail: 0,
  baseUrl: "http://localhost:4004/#fields-manage",

  waitforTimeout: 30000,
  connectionRetryTimeout: 60000,
  connectionRetryCount: 1,

  services: ["chromedriver", "ui5"],

  framework: "mocha",
  mochaOpts: {
    ui: "bdd",
    timeout: 60000,
  },
  reporters: ["spec"],
};

Expected behavior I would expect that the my baseUrl http://localhost:4004/#fields-manage is called.

Logs/Console Output

./node_modules/.bin/wdio run wdio.conf.js

Execution of 1 workers started at 2023-01-14T09:05:01.894Z

[0-0] RUNNING in chrome - /webapp/wdi5-test/Journey.test.js
[0-0] FAILED in chrome - /webapp/wdi5-test/Journey.test.js

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:02:00

Screenshots image

Runtime Env (please complete the following information):

My npm list output:

├── @sap/ui5-builder-webide-extension@1.1.9
├── @wdio/cli@7.29.1
├── @wdio/local-runner@7.29.1
├── @wdio/mocha-framework@7.26.0
├── @wdio/selenium-standalone-service@7.29.1
├── @wdio/spec-reporter@7.29.1
├── chromedriver@109.0.0
├── ui5-task-zipper@0.5.1
├── wdio-chromedriver-service@7.3.2
└── wdio-ui5-service@1.0.5

Additional context I added some wdio hooks and set breakpoints. As you can see in the screenshot the baseUrl is still correct in the beforeSession hook. The other functions I set breakpoints are not called. image

vobu commented 1 year ago

usually the nav bar changes from data: (which indicates "remote control by software") to the actual URL of the app under test. Dumb question: do you have the app running at localhost:4004 before you start off the actual test runs? Asking this b/c wdi5 doesn't run any app starts, but "only" the tests.

htammen commented 1 year ago

In a live session @vobu and I figured out that it is necessary to have Google Chrome installed locally. I only had Chromium installed.