Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix automatic capabilities conversion from JWP to W3C #277

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/process-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,19 @@ export function processConfig(config: any = {}, args: any = {}) {
};

// transform JWP capabilities into W3C capabilities for backward compatibility
if (isW3C(args)) {
if (!isW3C(args)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't seem to align with the comments above or below.

Why would you "delete JWP capabilities" if you are in JWP mode?

Copy link
Author

@gkalpak gkalpak Oct 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the capabilities are in the old JWP format, then they are converted to the new W3C format (inside the if block). Essentially, JWP's version and platform properties are converted to W3C's browserVersion and platformName properties. At the end, the JWP properties, version and platform are deleted from the args object (since they are not needed any more).

Does that make sense?

args.browserVersion = args.browserVersion || args.version || 'latest'
args.platformName = args.platformName || args.platform || 'Windows 10'
args['sauce:options'] = {...capabilitiesFromConfig, ...(args['sauce:options'] || {})}

// delete JWP capabilities
delete args.version
delete args.platform
} else {
args = {...args, ...capabilitiesFromConfig}
}

// Move capabilities from config into `sauce:options`. This is necessary for W3C.
// See: https://docs.saucelabs.com/dev/w3c-webdriver-capabilities/index.html#use-sauceoptions
args['sauce:options'] = {...capabilitiesFromConfig, ...(args['sauce:options'] || {})}

// Not needed
delete args.base

Expand Down