Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Webdriver helper #1

Closed
sagecelia opened this issue May 16, 2024 · 8 comments
Closed

Webdriver helper #1

sagecelia opened this issue May 16, 2024 · 8 comments

Comments

@sagecelia
Copy link

sagecelia commented May 16, 2024

Hi,

I used the codeceptjs-monocart-coverage plugin to perform a coverage test during my Codeceptjs tests. The Coverage plugin is only available with Playwright and Pupeteer, I wanted to use this plugin because I use the Webdriver helper.
Unfortunately I am no longer able to carry out my Codeceptjs test when I add the plugin to my codecept.conf.js. When I execute my npx codeceptjs run command I get this error which prevents the test from being executed:

[MCR] Not found coverage data in dir(s):

Here is the configuration of the plugin in codecept.conf.js :
monocart: {
require: 'codeceptjs-monocart-coverage',
enabled: true,
coverageOptions: {
name: 'My CodeceptJS Coverage Report',
outputDir: 'coverage-report',
}
}

@cenfun
Copy link
Owner

cenfun commented May 16, 2024

CodeceptJS has integrated MCR, so this plugin is no longer maintained. but yes, it added support for Webdriver helper, can you provide more to reproduce this problem locally? seems the coverage data haven't been collected.

@sagecelia
Copy link
Author

sagecelia commented May 16, 2024

Thank you for your quick reply. But since coverage is not available for Webdriver, is there another way to perform coverage tests than this plugin if it is no longer maintained?

Here is my codecept.conf.js file:

/** @type {CodeceptJS.MainConfig} */
exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    WebDriver: {
      url: '...',
      host: 'hub-selenium.***ch',
      path: '/',
      protocol: 'https',
      port: 443,
      browser: 'chrome',
      capabilities: {
        alwaysMatch: {
          browserName: 'chrome',
          acceptInsecureCerts: true
        }
      }
    }
  },
  include: {
    I: './steps_file.js'
  },
  name: 'codeceptjs-data-testid',
  plugins: {
    monocart: {
      require: 'codeceptjs-monocart-coverage',
      enabled: true,
      coverageOptions: {
        name: 'My CodeceptJS Coverage Report',
        outputDir: 'coverage-report',
      }
    },
    customLocator: {
      enabled: true,
      attribute: 'data-testid',
      startegy: 'css'
    },
    allure: {
      enabled: true,
      require: "allure-codeceptjs",
      outputDir: "output/allure-results",
      enableScreenshotDiffPlugin: true,
      addConsoleLogs: true,
      reportedEnvironmentVars: {
        browser: 'firefox'
      },
      addConsoleLogs: true
    }
  }
}

@cenfun
Copy link
Owner

cenfun commented May 16, 2024

did you got any errors when tesing?

@cenfun
Copy link
Owner

cenfun commented May 16, 2024

I'm sorry, I can't find the problem with just this configuration file.
I suggest submitting issues to CodeceptJS
and asked that CodeceptJS provide coverage support for WebDriver too.

@sagecelia
Copy link
Author

Ok thank you, I open a new Topic on Codeceptjs Community.
I don't really have any other specific configuration to share. Is there anything specific you're thinking of?

@cenfun
Copy link
Owner

cenfun commented May 16, 2024

In fact, I am not very familiar with WebDriver, so there might be some problems that I can't solve. Therefore, I still suggest that the Codeceptjs official provides coverage support for WebDriver.

@kobenguyent
Copy link

hey @sagecelia CodeceptJS would support the coverage WebDriver but only when you running with devtools protocol.

codeceptjs/CodeceptJS#4349

@cenfun based on this wdio services, looks like we only support devtools protocol, right?
https://github.com/cenfun/wdio-monocart-service/blob/main/lib/index.js#L43

@cenfun
Copy link
Owner

cenfun commented May 16, 2024

@kobenguyent I think so.
For wdio, it actually collects the coverage data through the interface of puppeteer, and puppeteer should be using the devtools protocol.

@cenfun cenfun closed this as completed Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants