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
tests: consistently use platform constants (#899)
Pavel Feldman36344dee27c3
diff --git a/test/capabilities.spec.js b/test/capabilities.spec.jsindex 388083af38..65c6fff14f 100644--- a/test/capabilities.spec.js+++ b/test/capabilities.spec.js@@ -17,13 +17,13 @@const utils = require('./utils');const { waitEvent } = utils;-module.exports.describe = function({testRunner, expect}) {+module.exports.describe = function({testRunner, expect, WIN, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;describe('Capabilities', function() {- it('Web Assembly should work', async function({page, server}) {+ it.skip(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {await page.goto(server.PREFIX + '/wasm/table2.html');expect(await page.evaluate(() => loadTable())).toBe('42, 83');});diff --git a/test/cookies.spec.js b/test/cookies.spec.jsindex 4c0765a50e..e06cdde358 100644--- a/test/cookies.spec.js+++ b/test/cookies.spec.js@@ -15,7 +15,7 @@* limitations under the License.*/-module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, FFOX, CHROMIUM, WEBKIT}) {+module.exports.describe = function({testRunner, expect, playwright, defaultBrowserOptions, MAC, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;@@ -51,7 +51,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsexpect(cookies.length).toBe(1);expect(cookies[0].httpOnly).toBe(true);});- it.skip(WEBKIT && process.platform !== 'darwin')('should properly report "Strict" sameSite cookie', async({context, page, server}) => {+ it.skip(WEBKIT && !MAC)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {server.setRoute('/empty.html', (req, res) => {res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');res.end();@@ -61,7 +61,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsexpect(cookies.length).toBe(1);expect(cookies[0].sameSite).toBe('Strict');});- it.skip(WEBKIT && process.platform !== 'darwin')('should properly report "Lax" sameSite cookie', async({context, page, server}) => {+ it.skip(WEBKIT && !MAC)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {server.setRoute('/empty.html', (req, res) => {res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');res.end();diff --git a/test/fixtures.spec.js b/test/fixtures.spec.jsindex c2433bcca3..1f9cf1eafd 100644--- a/test/fixtures.spec.js+++ b/test/fixtures.spec.js@@ -82,7 +82,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, pla});it('should close the browser when the node process closes', async () => {const result = await testSignal(child => {- if (process.platform === 'win32')+ if (WIN)execSync(`taskkill /pid ${child.pid} /T /F`);elseprocess.kill(child.pid);diff --git a/test/navigation.spec.js b/test/navigation.spec.jsindex 37607a14f9..126c3cfaf5 100644--- a/test/navigation.spec.js+++ b/test/navigation.spec.js@@ -18,7 +18,7 @@const utils = require('./utils');const { performance } = require('perf_hooks');-module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {+module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;@@ -176,7 +176,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIawait page.goto('http://localhost:44123/non-existing-url').catch(e => error = e);if (CHROMIUM)expect(error.message).toContain('net::ERR_CONNECTION_REFUSED');- else if (WEBKIT && process.platform === 'win32')+ else if (WEBKIT && WIN)expect(error.message).toContain(`Couldn\'t connect to server`);else if (WEBKIT)expect(error.message).toContain('Could not connect');@@ -907,9 +907,9 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIif (CHROMIUM) {expect(errorMessage).toContain('net::ERR_CERT_AUTHORITY_INVALID');} else if (WEBKIT) {- if (process.platform === 'darwin')+ if (MAC)expect(errorMessage).toContain('The certificate for this server is invalid');- else if (process.platform === 'win32')+ else if (WIN)expect(errorMessage).toContain('SSL peer certificate or SSH remote key was not OK');elseexpect(errorMessage).toContain('Unacceptable TLS certificate');diff --git a/test/network.spec.js b/test/network.spec.jsindex 0e81e5c861..cafa1490df 100644--- a/test/network.spec.js+++ b/test/network.spec.js@@ -19,7 +19,7 @@ const fs = require('fs');const path = require('path');const utils = require('./utils');-module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT}) {+module.exports.describe = function({testRunner, expect, MAC, WIN, FFOX, CHROMIUM, WEBKIT}) {const {describe, xdescribe, fdescribe} = testRunner;const {it, fit, xit, dit} = testRunner;const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;@@ -243,9 +243,9 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})if (CHROMIUM) {expect(failedRequests[0].failure().errorText).toBe('net::ERR_INVALID_HTTP_RESPONSE');} else if (WEBKIT) {- if (process.platform === 'darwin')+ if (MAC)expect(failedRequests[0].failure().errorText).toBe('The network connection was lost.');- else if (process.platform === 'win32')+ else if (WIN)expect(failedRequests[0].failure().errorText).toBe('Unsupported protocol');elseexpect(failedRequests[0].failure().errorText).toBe('Message Corrupt');