Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: remove Selenium jar files from repo (#21939)

Max Schmitt054fcd39ba9e
diff --git a/tests/assets/selenium-grid/selenium-server-4.4.0.jar b/tests/assets/selenium-grid/selenium-server-4.4.0.jar
deleted file mode 100644
index a939a10141..0000000000
Binary files a/tests/assets/selenium-grid/selenium-server-4.4.0.jar and /dev/null differ
diff --git a/tests/assets/selenium-grid/selenium-server-standalone-3.141.59.jar b/tests/assets/selenium-grid/selenium-server-standalone-3.141.59.jar
deleted file mode 100644
index 8410e9565a..0000000000
Binary files a/tests/assets/selenium-grid/selenium-server-standalone-3.141.59.jar and /dev/null differ
diff --git a/tests/installation/connect-to-selenium.spec.ts b/tests/installation/connect-to-selenium.spec.ts
index 4e72c32c24..366665bfa8 100755
--- a/tests/installation/connect-to-selenium.spec.ts
+++ b/tests/installation/connect-to-selenium.spec.ts
@@ -21,6 +21,14 @@ test('connect to selenium', async ({ exec, tmpWorkspace }, testInfo) => {
test.skip(os.platform() !== 'linux');
await exec('npm i --foreground-scripts playwright-core');
- await exec(`node download-chromedriver.js ${path.join(tmpWorkspace)}`);
- await exec(`npm run test -- --reporter=list selenium.spec --output=${testInfo.outputPath('tmp-test-results')}`, { cwd: path.join(__dirname, '..', '..'), env: { PWTEST_CHROMEDRIVER: path.join(tmpWorkspace, 'chromedriver') } });
+ await exec(`node download-chromedriver.js ${tmpWorkspace}`);
+ const seleniumPath = path.join(tmpWorkspace, 'selenium');
+ await exec(`node download-selenium.js ${seleniumPath}`);
+ await exec(`npm run test -- --reporter=list selenium.spec --output=${testInfo.outputPath('tmp-test-results')}`, {
+ cwd: path.join(__dirname, '..', '..'),
+ env: {
+ PWTEST_CHROMEDRIVER: path.join(tmpWorkspace, 'chromedriver'),
+ PWTEST_SELENIUM: seleniumPath,
+ },
+ });
});
diff --git a/tests/installation/fixture-scripts/download-selenium.js b/tests/installation/fixture-scripts/download-selenium.js
new file mode 100644
index 0000000000..111a1e3217
--- /dev/null
+++ b/tests/installation/fixture-scripts/download-selenium.js
@@ -0,0 +1,15 @@
+const { execSync } = require('child_process');
+const { mkdirSync } = require('fs');
+const path = require('path');
+
+async function downloadFile(url, dir, filename) {
+ const output = path.join(dir, filename);
+ execSync(`curl -L --silent --output ${output} ${url}`);
+}
+
+(async () => {
+ const dir = process.argv[2];
+ mkdirSync(dir);
+ downloadFile('https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar', dir, 'selenium-server-4.4.0.jar')
+ downloadFile('https://github.com/SeleniumHQ/selenium/releases/download/selenium-3.141.59/selenium-server-standalone-3.141.59.jar', dir, 'selenium-server-standalone-3.141.59.jar')
+})();
diff --git a/tests/library/browsertype-launch-selenium.spec.ts b/tests/library/browsertype-launch-selenium.spec.ts
index 33fa1480f7..e607af3902 100644
--- a/tests/library/browsertype-launch-selenium.spec.ts
+++ b/tests/library/browsertype-launch-selenium.spec.ts
@@ -22,8 +22,8 @@ import { start } from '../../packages/playwright-core/lib/outofprocess';
const chromeDriver = process.env.PWTEST_CHROMEDRIVER;
const brokenDriver = path.join(__dirname, '..', 'assets', 'selenium-grid', 'broken-selenium-driver.js');
-const standalone_3_141_59 = path.join(__dirname, '..', 'assets', 'selenium-grid', 'selenium-server-standalone-3.141.59.jar');
-const selenium_4_4_0 = path.join(__dirname, '..', 'assets', 'selenium-grid', 'selenium-server-4.4.0.jar');
+let standalone_3_141_59: string;
+let selenium_4_4_0: string;
function writeSeleniumConfig(testInfo: TestInfo, port: number) {
const template = path.join(__dirname, '..', 'assets', 'selenium-grid', `selenium-config-standalone.json`);
@@ -37,6 +37,11 @@ test.skip(({ mode }) => mode !== 'default', 'Using test hooks');
test.skip(!chromeDriver);
test.slow();
+test.beforeAll(() => {
+ standalone_3_141_59 = path.join(process.env.PWTEST_SELENIUM!, 'selenium-server-standalone-3.141.59.jar');
+ selenium_4_4_0 = path.join(process.env.PWTEST_SELENIUM!, 'selenium-server-4.4.0.jar');
+});
+
test('selenium grid 3.141.59 standalone chromium', async ({ browserName, childProcess, waitForPort, browserType }, testInfo) => {
test.skip(browserName !== 'chromium');