From 15a4fa45e005a4c15827f9fc5d157319de71e9a5 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 14 Feb 2025 15:15:26 -0600 Subject: [PATCH] feat(tests): Adds target for grid ff tests. --- package.json | 4 +++- tests/wdio.grid.conf.ts | 6 +++--- tests/wdio.grid.firefox.conf.ts | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 tests/wdio.grid.firefox.conf.ts diff --git a/package.json b/package.json index 6fe1db76ed..3f2a766375 100644 --- a/package.json +++ b/package.json @@ -228,7 +228,9 @@ "test-dev": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.dev.conf.ts", "test-dev-single": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.dev.conf.ts --spec", "test-grid": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.grid.conf.ts", - "test-grid-single": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.grid.conf.ts --spec" + "test-grid-single": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.grid.conf.ts --spec", + "test-grid-ff": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.grid.firefox.conf.ts", + "test-grid-ff-single": "DOTENV_CONFIG_PATH=tests/.env wdio run tests/wdio.grid.firefox.conf.ts --spec" }, "resolutions": { "@types/react": "17.0.14", diff --git a/tests/wdio.grid.conf.ts b/tests/wdio.grid.conf.ts index bf72df28e1..4daff49ff6 100644 --- a/tests/wdio.grid.conf.ts +++ b/tests/wdio.grid.conf.ts @@ -1,6 +1,5 @@ // wdio.grid.conf.ts // extends the main configuration file to add the selenium grid address -import { merge } from 'lodash-es'; import { URL } from 'url'; // @ts-ignore @@ -9,13 +8,14 @@ import { config as defaultConfig } from './wdio.conf.ts'; const gridUrl = new URL(process.env.GRID_HOST_URL as string); const protocol = gridUrl.protocol.replace(':', ''); -const mergedConfig = merge(defaultConfig, { +const mergedConfig = { + ...defaultConfig, protocol, hostname: gridUrl.hostname, port: gridUrl.port ? parseInt(gridUrl.port, 10) // Convert port to number : protocol === 'http' ? 80 : 443, path: gridUrl.pathname -}, { clone: false }); +}; mergedConfig.capabilities.participant1.capabilities['goog:chromeOptions'].args = updateRemoteResource(mergedConfig.capabilities.participant1.capabilities['goog:chromeOptions'].args); diff --git a/tests/wdio.grid.firefox.conf.ts b/tests/wdio.grid.firefox.conf.ts new file mode 100644 index 0000000000..ac3ce5ce2a --- /dev/null +++ b/tests/wdio.grid.firefox.conf.ts @@ -0,0 +1,18 @@ +// wdio.grid.conf.ts +// extends the main configuration file to add the selenium grid address +import { URL } from 'url'; + +// @ts-ignore +import { config as defaultConfig } from './wdio.firefox.conf.ts'; + +const gridUrl = new URL(process.env.GRID_HOST_URL as string); +const protocol = gridUrl.protocol.replace(':', ''); + +export const config = { + ...defaultConfig, + protocol, + hostname: gridUrl.hostname, + port: gridUrl.port ? parseInt(gridUrl.port, 10) // Convert port to number + : protocol === 'http' ? 80 : 443, + path: gridUrl.pathname +};