0

I am using wdio,cucumber to run test framework using firefox browser. My package.json is:

{
    "name": "abc",
    "description": "abc",
    "version": "0.0.1",
    "private": true,
    "engines": {
        "node": ">=10.16.0",
        "npm": ">=6.9.0"
    },
    "main": "./lib",
    "scripts": {
        "lint": "eslint 'pageobjects/**/*.js' 'step-definitions/**/*.js'",
        "test": "wdio wdio.conf.js",
        "test-parallel": "wdio wdio.conf.js --parallel=true",
        "open-allure": "./node_modules/.bin/allure generate ./allure-results --clean && allure open"
    },
    "dependencies": {
        "@babel/cli": "7.12.1",
        "@babel/core": "7.12.3",
        "@babel/plugin-proposal-export-default-from": "7.12.1",
        "@babel/preset-env": "7.12.1",
        "@babel/register": "7.12.1",
        "@g4/moment-utc": "3.1.7",
        "@wdio/allure-reporter": "^7.30.1",
        "@wdio/cli": "7.16.13",
        "@wdio/config": "7.16.13",
        "@wdio/cucumber-framework": "7.16.13",
        "@wdio/local-runner": "7.16.13",
        "@wdio/selenium-standalone-service": "7.16.11",
        "@wdio/spec-reporter": "7.16.13",
        "@wdio/sync": "7.16.13",
        "axe-core": "4.0.1",
        "chai": "4.2.0",
        "chai-sorted": "0.2.0",
        "chromedriver": "^104.0.0",
        "dotenv": "^16.0.3",
        "eslint": "6.8.0",
        "eslint-config-airbnb-base": "14.2.1",
        "eslint-plugin-import": "2.22.1",
        "eslint-plugin-wdio": "6.6.0",
        "faker": "4.1.0",
        "fibers": "4.0.3",
        "fs-extra": "^9.0.1",
        "geckodriver": "^3.2.0",
        "gherkin": "9.0.0",
        "got": "11.8.0",
        "husky": "^4.2.5",
        "multiple-cucumber-html-reporter": "1.18.0",
        "path": "^0.12.7",
        "request": "^2.88.2",
        "wdio-chromedriver-service": "^7.3.2",
        "wdio-cucumberjs-json-reporter": "2.0.1",
        "wdio-geckodriver-service": "^2.1.0",
        "webdriverio": "7.16.10"
    },
    "devDependencies": {
        "eslint": "^6.8.0",
        "eslint-config-airbnb-base": "^14.1.0",
        "eslint-config-prettier": "^6.11.0",
        "eslint-import-resolver-jest": "^3.0.0",
        "eslint-plugin-import": "^2.20.2",
        "eslint-plugin-jest": "^23.8.2",
        "eslint-plugin-prettier": "^3.1.4",
        "eslint-plugin-wdio": "^6.0.8",
        "node-emoji": "^1.10.0",
        "wdio-cucumber-parallel-execution": "^3.6.14"
    },
    "husky": {
        "hooks": {
            "pre-commit": "npm run lint",
            "pre-push": "npm run lint"
        }
    }
}

wdio.conf.js:

exports.config = {
    runner: 'local',
    specs: [
      [
        'features/**/a1.feature',
        'features/**/a2.feature',
        'features/**/a3.feature'  
      ]
    ],
    maxInstances: 3,
  

  capabilities: [{
        browserName: 'chrome',
        maxInstances:3,
         acceptInsecureCerts: true,
     'goog:chromeOptions': {
        args: ['--ignore-certificate-errors']
      },

    path: '/wd/hub'
    },
    {
        browserName: 'firefox',
        maxInstances: 5,
        /*for ERROR:--remote-debugging-port can't be set via capabilities
        refer:https://github.com/mozilla/geckodriver/issues/2011 and
        https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html#moz-debuggeraddress
        */
         "alwaysMatch": {
         "moz:firefoxOptions": {
            "moz:debuggerAddress": true        
           }
         },
    }
  ],
  
  
    //logLevel: 'silent',
    logLevel: 'trace',
    sync: true,
    //sync: false,
    bail: 0,
    //baseUrl:process.env.appEnv,
    //Env:process.env.Env,
    waitforInterval: 100,
    waitforTimeout: 10000,
    connectionRetryTimeout: 200000,
    connectionRetryCount: 3,
    reporters: [
      'spec',
     
      [
        'allure',
        {
          outputDir: './allure-results/',
          disableWebdriverStepsReporting: false,
          useCucumberStepReporter: true,
        },
      ],
      // [
      //   'cucumberjs-json',
      //   {
      //     jsonFolder: './cucumberJs-results/',
      //     language: 'en',
      //   },
      // ],
    ],
    screenshotPath: './allure-results/',
    disableWebdriverScreenshotsReporting: false,
    framework: 'cucumber',
    automationProtocol: 'webdriver',
    desiredCapabilities: {
       acceptSslCerts: true
     },
    cucumberOpts: {
      requireModule: [
        [
          '@babel/register',
          {
            ignore: [
              filepath =>
                filepath.includes('node_modules')
            ],
          },
        ],
      ],
      require: [
        'step-definitions/**/*.js'
        
      ],
      backtrace: true,
      failAmbiguousDefinitions: true,
      dryRun: false,
      failFast: false,
      format: ['pretty'],
      colors: true,
      snippets: true,
      source: true,
      profile: [],
      strict: false,
      tagExpression: process.env.tag,
      timeout: defaultTimeoutInterval,
      ignoreUndefinedDefinitions: false,
      tagsInTitle: false,
    },
    
    //services: ['selenium-standalone'],
    services: ['geckodriver'],
    
    coloredLogs: true,
    afterStep: async function (step, scenario, { error, duration, passed }, context) {
      if (error) {
        await browser.takeScreenshot();
      }
    }
  };

When I run my tests suite with chrome it works fine. So for firefox i changed wdio services in wdio.conf.js to geckodriver as in following line:

services: ['geckodriver']

I installed firefox version 111.0.1 and geckodriver from npm as

npm install geckodriver

version 3.2.0 which is

3.2.0 - geckodriver 0.32.0, arm64 support.

as mentioned here

The problem is that it is not working with firefox and giving following error:

2023-03-25T18:52:58.215Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in firefox - D:\Automation\work\UI_GQL\e2e\features\a1.feature, D:\Automation\work\UI_GQL\e2e\features\a2.feature, D:\Automation\work\UI_GQL\e2e\features\a3.feature

Full error logs:

2023-03-25T18:52:54.126Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 6927ms
2023-03-25T18:52:54.133Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-03-25T18:52:54.134Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2023-03-25T18:52:54.140Z INFO @wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2023-03-25T18:52:55.318Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2023-03-25T18:52:55.549Z DEBUG @wdio/config:utils: Found '@babel/register' package, auto-compiling files with Babel
[0-0] wdio.conf.js 1824 6760
[0-0] 2023-03-25T18:52:56.459Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2023-03-25T18:52:56.471Z DEBUG @wdio/utils:initialiseServices: initialise service "selenium-standalone" as NPM package
[0-0] RUNNING in firefox - D:\Automation\work\UI_GQL\e2e\features\a1.feature, D:\Automation\work\UI_GQL\e2e\features\a2.feature, D:\Automation\work\UI_GQL\e2e\features\a3.feature
[0-0] 2023-03-25T18:52:58.065Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2023-03-25T18:52:58.072Z INFO webdriver: Initiate new session using the WebDriver protocol
2023-03-25T18:52:58.215Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in firefox - D:\Automation\work\UI_GQL\e2e\features\a1.feature, D:\Automation\work\UI_GQL\e2e\features\a2.feature, D:\Automation\work\UI_GQL\e2e\features\a3.feature
2023-03-25T18:52:58.219Z INFO @wdio/cli:launcher: Run onComplete hook
2023-03-25T18:52:58.219Z INFO @wdio/selenium-standalone-service: shutting down all browsers
2023-03-25T18:52:58.220Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 1ms
cat.conf.js onComplete 6760

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

2023-03-25T18:52:58.223Z INFO @wdio/local-runner: Shutting down spawned worker
2023-03-25T18:52:58.474Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-03-25T18:52:58.475Z INFO @wdio/local-runner: shutting down
npm ERR! Test failed.  See above for more details.
a Learner
  • 4,944
  • 10
  • 53
  • 89

0 Answers0