Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: move TestServer under test/ (#23287)
Dmitry Gozman00b34dddb2f6
diff --git a/tests/config/serverFixtures.ts b/tests/config/serverFixtures.tsindex 0d73a84ac8..135458d0de 100644--- a/tests/config/serverFixtures.ts+++ b/tests/config/serverFixtures.ts@@ -17,7 +17,7 @@import type { Fixtures } from '@playwright/test';import path from 'path';import socks from 'socksv5';-import { TestServer } from '../../utils/testserver';+import { TestServer } from './testserver';import { TestProxy } from './proxy';export type ServerWorkerOptions = {diff --git a/utils/testserver/cert.pem b/tests/config/testserver/cert.pemsimilarity index 100%rename from utils/testserver/cert.pemrename to tests/config/testserver/cert.pemdiff --git a/utils/testserver/index.ts b/tests/config/testserver/index.tssimilarity index 100%rename from utils/testserver/index.tsrename to tests/config/testserver/index.tsdiff --git a/utils/testserver/key.pem b/tests/config/testserver/key.pemsimilarity index 100%rename from utils/testserver/key.pemrename to tests/config/testserver/key.pemdiff --git a/tests/library/har.spec.ts b/tests/library/har.spec.tsindex f539dede80..8cdce78d2b 100644--- a/tests/library/har.spec.ts+++ b/tests/library/har.spec.ts@@ -672,8 +672,8 @@ it('should contain http2 for http2 requests', async ({ contextFactory, browserNait.fixme(browserName === 'webkit' && platform === 'win32');const server = http2.createSecureServer({- key: await fs.promises.readFile(path.join(__dirname, '..', '..', 'utils', 'testserver', 'key.pem')),- cert: await fs.promises.readFile(path.join(__dirname, '..', '..', 'utils', 'testserver', 'cert.pem')),+ key: await fs.promises.readFile(path.join(__dirname, '..', 'config', 'testserver', 'key.pem')),+ cert: await fs.promises.readFile(path.join(__dirname, '..', 'config', 'testserver', 'cert.pem')),});server.on('stream', stream => {stream.respond({diff --git a/tests/page/page-autowaiting-basic.spec.ts b/tests/page/page-autowaiting-basic.spec.tsindex c4e1b50ea8..9728bc4958 100644--- a/tests/page/page-autowaiting-basic.spec.ts+++ b/tests/page/page-autowaiting-basic.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import type { TestServer } from '../../utils/testserver';+import type { TestServer } from '../config/testserver';import { test as it, expect } from './pageTest';function initServer(server: TestServer): string[] {diff --git a/tests/page/page-network-idle.spec.ts b/tests/page/page-network-idle.spec.tsindex ca73eafda2..9fabc42272 100644--- a/tests/page/page-network-idle.spec.ts+++ b/tests/page/page-network-idle.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './pageTest';import type { Frame } from 'playwright-core';-import type { TestServer } from '../../utils/testserver';+import type { TestServer } from '../config/testserver';it('should navigate to empty page with networkidle', async ({ page, server }) => {const response = await page.goto(server.EMPTY_PAGE, { waitUntil: 'networkidle' });diff --git a/tests/playwright-test/assets/simple-server-with-stdout.js b/tests/playwright-test/assets/simple-server-with-stdout.jsdeleted file mode 100644index 84650d5b2b..0000000000--- a/tests/playwright-test/assets/simple-server-with-stdout.js+++ /dev/null@@ -1,10 +0,0 @@-const { TestServer } = require('../../../utils/testserver/');-// delay creating the server to test waiting for it-setTimeout(() => {- TestServer.create(__dirname, process.argv[2] || 3000).then(server => {- console.log(`Listening on http://localhost:${server.PORT}`);- server.setRoute('/hello', (message, response) => {- response.end('hello');- });- });-}, 750);diff --git a/utils/testserver/README.md b/utils/testserver/README.mddeleted file mode 100644index f4054de6e5..0000000000--- a/utils/testserver/README.md+++ /dev/null@@ -1,18 +0,0 @@-# TestServer--This test server is used internally by Playwright to test Playwright itself.--### Example--```js-const {TestServer} = require('.');--(async () => {- const httpServer = await TestServer.create(__dirname, 8000);- const httpsServer = await TestServer.createHTTPS(__dirname, 8001);- httpServer.setRoute('/hello', (req, res) => {- res.end('Hello, world!');- });- console.log('HTTP and HTTPS servers are running!');-})();-```diff --git a/utils/testserver/run_static_server.js b/utils/testserver/run_static_server.jsdeleted file mode 100755index b3b90f2411..0000000000--- a/utils/testserver/run_static_server.js+++ /dev/null@@ -1,34 +0,0 @@-#!/usr/bin/env node-/**- * Copyright 2017 Google Inc. All rights reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--const path = require('path');-const {TestServer} = require('.');--const port = 8907;-const httpsPort = 8908;-const assetsPath = path.join(__dirname, '../../tests/assets');-const cachedPath = path.join(__dirname, '../../tests/assets/cached');--Promise.all([- TestServer.create(assetsPath, port),- TestServer.createHTTPS(assetsPath, httpsPort)-]).then(([server, httpsServer]) => {- server.enableHTTPCache(cachedPath);- httpsServer.enableHTTPCache(cachedPath);- console.log(`HTTP: server is running on http://localhost:${port}`);- console.log(`HTTPS: server is running on https://localhost:${httpsPort}`);-});