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

Getting @wdio/cli: [0-0] SKIPPED in chrome, one spec file skipped #219

Closed siddharthmlk closed 2 years ago

siddharthmlk commented 2 years ago

Hello, I just started using wdi5 and trying to setup and run a simple spec file to open a browser and validate title as mentioned in your example, but getting below response without any error or warnings. Tried lot of permutations and combinations but nothing worked.

$ npx wdio

Execution of 1 spec files started at 2022-04-07T18:21:59.761Z

2022-04-07T18:21:59.764Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
2022-04-07T18:21:59.828Z INFO @wdio/cli:launcher: Run onPrepare hook
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
2022-04-07T18:22:00.374Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-04-07T18:22:00.375Z INFO @wdio/local-runner: Start worker 0-0 with arg: 
[0-0] 2022-04-07T18:22:01.033Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2022-04-07T18:22:01.038Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-04-07T18:22:01.040Z INFO webdriverio: Initiate new session using the ./protocol-stub protocol
2022-04-07T18:22:01.560Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 0
2022-04-07T18:22:01.561Z INFO @wdio/cli: [0-0] SKIPPED in chrome - C:\Users\xyz-workspace\ui5app\ui\webapp\test\e2e\specs\basic.spec.js
2022-04-07T18:22:01.561Z INFO @wdio/cli:launcher: Run onComplete hook

Spec Files:      0 passed, 1 skipped, 1 total (100% completed) in 00:00:01

2022-04-07T18:22:01.563Z INFO @wdio/local-runner: Shutting down spawned worker
2022-04-07T18:22:01.828Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-04-07T18:22:01.828Z INFO @wdio/local-runner: shutting down

My wdio.conf.js is

exports.config = {
    wdi5: {
        screenshotPath: join("webapp","test", "e2e", "screenshots"), // [optional] {string}, default: ""
        screenshotsDisabled: false, // [optional] {boolean}, default: false; if set to true, screenshots won't be taken and not written to file system
        logLevel: "error", // [optional] error | verbose | silent, default: "error"
        url: "", // [mandatory] {string} name of your bootstrap html file. If your server autoredirects to a 'domain:port/'-like root url, use empty string ''
        skipInjectUI5OnStart: false, // [optional] {boolean}, default: false; true when UI5 is not on the start page, you need to later call <wdioUI5service>.injectUI5() manually
        waitForUI5Timeout: 15000 // [optional] {number}, default: 15000; maximum waiting time in milliseconds while checking for UI5 availability
      },
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],
    specs: [
        "./webapp/test/e2e/specs/*.spec.js"
    ],
    maxInstances: 10,
    capabilities: [{
        maxInstances: 5,
        browserName: 'chrome',
        acceptInsecureCerts: true,
        "goog:chromeOptions": {
            args: process.env.DEBUG ? ["--auto-open-devtools-for-tabs"] : [],
            prefs: {
              directory_upgrade: true,
              prompt_for_download: false
            }
          }
    }],

    logLevel: 'trace',
    bail: 0,

    baseUrl: 'https://google.com',

    waitforTimeout: 10000,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 3,
    services: [
     "chromedriver",
    "ui5"],

    framework: 'jasmine',

    reporters: ['spec'],

    jasmineOpts: {
        // Jasmine default timeout
        defaultTimeoutInterval: 60000,
        expectationResultHandler: function(passed, assertion) {
            // do something
        }
    }

package.json

"engines": {
    "node": "12.x"
  },
  "devDependencies": {
    "@wdio/cli": "^6.4.0",
    "@wdio/jasmine-framework": "^6.4.0",
    "@wdio/local-runner": "^6.4.0",
    "@wdio/spec-reporter": "^6.4.0",
    "browserify": "16.5.2",
    "chromedriver": "^100.0.0",
    "colors": "1.4.0",
    "express": "4.17.1",
    "grunt": "1.0.3",
    "grunt-cli": "1.3.2",
    "grunt-karma": "3.0.2",
    "grunt-string-replace": "1.3.1",
    "jasmine-core": "3.6.0",
    "karma": "5.1.1",
    "karma-browserify": "6.1.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "2.0.0",
    "karma-coverage": "2.0.1",
    "karma-html-reporter": "0.2.7",
    "karma-jasmine": "2.0.1",
    "karma-junit-reporter": "1.2.0",
    "karma-openui5": "0.2.3",
    "karma-qunit": "4.1.1",
    "karma-ui5": "1.2.0",
    "karma-webdriver-launcher": "1.0.8",
    "nodemon": "2.0.6",
    "qunit": "2.10.0",
    "rimraf": "2.7.1",
    "start-server-and-test": "1.11.3",
    "watchify": "3.11.1",
    "wdio-chromedriver-service": "^6.0.4",
    "wdio-ui5-service": "^0.6.2",
    "webdriverio": "6.4.0"
  }
Siolto commented 2 years ago

Hi Siddarth,

it seems like something is a little bit off with your spec file. In the console log you can actually see, that it skips your tests:

Spec Files: 0 passed, 1 skipped, 1 total (100% completed) in 00:00:01

Could you maybe share your spec file as well?

A few more things I noticed with your config:

Regards Simon

siddharthmlk commented 2 years ago

Hell Simon,

Thanks for looking. I made few changes, upgraded dependencies to the latest and set base URL to https://sapui5.hana.ondemand.com/

upgraded depdencies

  "devDependencies": {
    "@wdio/cli": "^7.19.3",
    "@wdio/jasmine-framework": "^7.19.3",
    "@wdio/local-runner": "^7.19.3",
    "@wdio/spec-reporter": "^7.19.1",
    "browserify": "16.5.2",
    "chromedriver": "^100.0.0",
    "colors": "1.4.0",
    "express": "4.17.1",
    "grunt": "1.0.3",
    "grunt-cli": "1.3.2",
    "grunt-karma": "3.0.2",
    "grunt-string-replace": "1.3.1",
    "jasmine-core": "3.6.0",
    "karma": "5.1.1",
    "karma-browserify": "6.1.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "2.0.0",
    "karma-coverage": "2.0.1",
    "karma-html-reporter": "0.2.7",
    "karma-jasmine": "2.0.1",
    "karma-junit-reporter": "1.2.0",
    "karma-openui5": "0.2.3",
    "karma-qunit": "4.1.1",
    "karma-ui5": "1.2.0",
    "karma-webdriver-launcher": "1.0.8",
    "nodemon": "2.0.6",
    "qunit": "2.10.0",
    "rimraf": "2.7.1",
    "start-server-and-test": "1.11.3",
    "watchify": "3.11.1",
    "wdio-chromedriver-service": "^7.3.2",
    "wdio-ui5-service": "^0.9.0-rc3",
    "webdriverio": "^7.19.3"

basic.test.js

const Main = require("../pageObjects/Main")

describe("ui5 basic", () => {
    before(async () => {
        await Main.open()
    })

    it("should have the right title", async () => {
        const title = await browser.getTitle()
        expect(title).toEqual("Sample UI5 Application")
    })
});

Main.js

const { wdi5 } = require("wdio-ui5-service")
module.exports = class Main {
    async open(path) {
        wdi5.goTo(path)
    }
}

I am still getting the same response. Not sure what is missing now.


$ npx wdio

Execution of 1 workers started at 2022-04-08T09:47:18.847Z

2022-04-08T09:47:18.850Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
2022-04-08T09:47:18.932Z DEBUG @wdio/utils:initialiseServices: initialise service "ui5" as NPM package
2022-04-08T09:47:19.006Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-04-08T09:47:19.010Z INFO chromedriver: Start Chromedriver (C:\Users\abc-workspace\xyz\ui\node_modules\chromedriver\lib\chromedriver\chromedriver.exe) with args --port=9515 --url-base=/
2022-04-08T09:47:19.757Z INFO chromedriver: Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 9515
2022-04-08T09:47:19.758Z INFO chromedriver: Only local connections are allowed.
2022-04-08T09:47:19.759Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2022-04-08T09:47:19.772Z INFO chromedriver: ChromeDriver was started successfully.
2022-04-08T09:47:19.818Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 811ms
2022-04-08T09:47:19.819Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-04-08T09:47:19.820Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2022-04-08T09:47:19.821Z INFO @wdio/local-runner: Start worker 0-0 with arg:
[0-0] 2022-04-08T09:47:20.637Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2022-04-08T09:47:20.645Z DEBUG @wdio/config:ConfigParser: No compiler found, continue without compiling files
[0-0] 2022-04-08T09:47:20.651Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2022-04-08T09:47:20.656Z DEBUG @wdio/utils:initialiseServices: initialise service "chromedriver" as NPM package
[0-0] 2022-04-08T09:47:20.765Z DEBUG @wdio/utils:initialiseServices: initialise service "ui5" as NPM package
2022-04-08T09:47:21.170Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 0
2022-04-08T09:47:21.170Z INFO @wdio/cli: [0-0] SKIPPED in chrome - C:\Users\abc-workspace\xyz\ui\webapp\test\e2e\specs\basic.test.js
2022-04-08T09:47:21.171Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-04-08T09:47:21.171Z DEBUG @wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2022-04-08T09:47:21.172Z INFO @wdio/cli:launcher: Run onComplete hook
2022-04-08T09:47:21.172Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 0ms

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

2022-04-08T09:47:21.174Z INFO @wdio/local-runner: Shutting down spawned worker
2022-04-08T09:47:21.429Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-04-08T09:47:21.429Z INFO @wdio/local-runner: shutting down
Siolto commented 2 years ago

Hi Siddarth,

I had a look at your spec file and I think we have 2 Problems here:

The main reason why your test is not executed, is the before function. In your configuration file you decided to use jasmine and in jasmine there is no before function . This function only exists in mocha, which we use in all our tests. The equivalent function in Jasmine would be beforeAll.

The second problem, after you use the correct before function, will be in your Main.js. You have to instantiate the pageObject otherwise this will not work. Your file could look something like this:

const { wdi5 } = require("wdio-ui5-service");

class Main {
    async open(path) {
        wdi5.goTo(path);
    }
}

module.exports = new Main();

I hope this will help you to solve the problem.

Best regards, Simon

github-actions[bot] commented 2 years ago

hey 👋 - silence for 30 days 🤐 ... anybody? 😀

dominikfeininger commented 2 years ago

@siddharthmlk still a thing? Or solved with the last answer from @Siolto ?

github-actions[bot] commented 2 years ago

hey 👋 - silence for 30 days 🤐 ... anybody? 😀

github-actions[bot] commented 2 years ago

closed 📴 because silencio 🤫 since an additional 14 days after staleness 📠