-
-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Labels
Description
Environment (please complete the following information):
- Node.js version: v20.15.1
- NPM version: 10.8.2
- Browser name and version: Chrome 131
- Platform name and version: Windows 10
- WebdriverIO version: 9.5.7
@wdio/visual-serviceversion: 6.3.0
Config of WebdriverIO + @wdio/visual-service
I created a repository where I tried to reproduce the problems I found, when setting up visual testing: https://github.com/htho/wdio-repro-visual-service
https://github.com/htho/wdio-repro-visual-service/blob/main/wdio-baselineFolder.conf.ts
services: [
[
"visual",
{
// TODO: REPORT options is `this` object - it is useless
baselineFolder: (options) => {
// TS ERROR Property 'specs' does not exist on type 'ClassOptions'
// RUNTIME ERROR: Error: Error: Failed to initialise launcher service "visual": TypeError: Cannot read properties of undefined (reading '0')
// TODO: REPORT
const testFolder = path.dirname(options.specs[0]);
// TODO: REPORT what is `type` supposed to be?
return path.join(testFolder, "snapshots", type);
},
} satisfies VisualServiceOptions,
],
],https://github.com/htho/wdio-repro-visual-service/blob/main/wdio-screenshotPath.conf.ts
services: [
[
"visual",
{
// TODO: REPORT options is `this` object - it is useless
screenshotPath(options) {
// TODO: REPORT the example makes no sense:
// https://webdriver.io/docs/visual-testing/service-options#screenshotpath
// TS ERROR Property 'specs' does not exist on type 'ClassOptions'
// RUNTIME ERROR: Error: Error: Failed to initialise launcher service "visual": TypeError: Cannot read properties of undefined (reading '0')
// TODO: REPORT
const testFolder = path.dirname(options.specs[0]);
// TODO: REPORT what is `type` supposed to be?
return path.join(testFolder, "snapshots", type);
},
} satisfies VisualServiceOptions,
],
],Describe the bug
I think all the issues I are related.
The documentation/APIs for screenshotPath and baselineFolder are very similar.
- Both documentations say that one could access
options.specswithin the function, but TypeScript and the Runtime indicate Errors. - In fact the
optionsparameter is the VisualServiceOptions object itself. This makes it useless. - The examples are confusing and even syntactically wrong.
To Reproduce
Use the repository and run npm run test:screenshotPath and npm run test:baselineFolder.
Expected behavior
- The documentation should be syntactically correct.
- The object passed into the functions should at least contain the information available for formatImageName.
Log
Relevant logs included as comments in the code above.
Reactions are currently unavailable