Skip to content

Unable to set window-size on --chrome-options argument on CLI #541

Open
@renato-bohler

Description

@renato-bohler

Product: CLI

Expectation: any options added to the --chrome-options argument should be passed down to the ChromeDriver

Actual: options that require a comma on its value (like window-size=1920,1080) causes ChromeDriver to fail initializing

Motivation: sometimes users might want to specify the window size to run tests on specific viewports


axe-core version: 4.4.1
@axe-core/cli: 4.4.3 (on fcfa36c2)

- Node version: v14.19.0
- Platform:  Linux

This happens because the CLI is using a comma or a semicolon to split different options:

export const splitList = (val: string): string[] => {
return val.split(/[,;]/).map(str => str.trim());
};

This way, options which require a comma on its value are passed down as two options instead of one: window-size=1920 and 1080 (note both arg: logs on the console)
image

If I change the RegExp to /[;]/ instead, everything works fine:
image
image

However, this would introduce a breaking change, so I'm unsure how to proceed. To be more generic and avoid future problems, we could add a --delimiter-character argument and use that to split lists on the CLI (and have /[,;]/ as a fallback). Or we could have a --chrome-options-delimiter-character argument, only changing the split behavior regarding the --chrome-options argument.

I'm happy to open a PR if we're able to agree on how to solve this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions