tests: consistently use platform constants (#899)

This commit is contained in:
Pavel Feldman 2020-02-07 14:44:05 -08:00 committed by GitHub
parent 3acc65d285
commit 36344dee27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View file

@ -17,13 +17,13 @@
const utils = require('./utils'); const utils = require('./utils');
const { waitEvent } = utils; const { waitEvent } = utils;
module.exports.describe = function({testRunner, expect}) { module.exports.describe = function({testRunner, expect, WIN, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner; const {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner; const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
describe('Capabilities', function() { 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'); await page.goto(server.PREFIX + '/wasm/table2.html');
expect(await page.evaluate(() => loadTable())).toBe('42, 83'); expect(await page.evaluate(() => loadTable())).toBe('42, 83');
}); });

View file

@ -15,7 +15,7 @@
* limitations under the License. * 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 {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner; const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
@ -51,7 +51,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
expect(cookies.length).toBe(1); expect(cookies.length).toBe(1);
expect(cookies[0].httpOnly).toBe(true); 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) => { server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Strict'); res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');
res.end(); res.end();
@ -61,7 +61,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrows
expect(cookies.length).toBe(1); expect(cookies.length).toBe(1);
expect(cookies[0].sameSite).toBe('Strict'); 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) => { server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Lax'); res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');
res.end(); res.end();

View file

@ -82,7 +82,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, pla
}); });
it('should close the browser when the node process closes', async () => { it('should close the browser when the node process closes', async () => {
const result = await testSignal(child => { const result = await testSignal(child => {
if (process.platform === 'win32') if (WIN)
execSync(`taskkill /pid ${child.pid} /T /F`); execSync(`taskkill /pid ${child.pid} /T /F`);
else else
process.kill(child.pid); process.kill(child.pid);

View file

@ -18,7 +18,7 @@
const utils = require('./utils'); const utils = require('./utils');
const { performance } = require('perf_hooks'); 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 {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner; const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
@ -176,7 +176,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
await page.goto('http://localhost:44123/non-existing-url').catch(e => error = e); await page.goto('http://localhost:44123/non-existing-url').catch(e => error = e);
if (CHROMIUM) if (CHROMIUM)
expect(error.message).toContain('net::ERR_CONNECTION_REFUSED'); 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`); expect(error.message).toContain(`Couldn\'t connect to server`);
else if (WEBKIT) else if (WEBKIT)
expect(error.message).toContain('Could not connect'); expect(error.message).toContain('Could not connect');
@ -907,9 +907,9 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
if (CHROMIUM) { if (CHROMIUM) {
expect(errorMessage).toContain('net::ERR_CERT_AUTHORITY_INVALID'); expect(errorMessage).toContain('net::ERR_CERT_AUTHORITY_INVALID');
} else if (WEBKIT) { } else if (WEBKIT) {
if (process.platform === 'darwin') if (MAC)
expect(errorMessage).toContain('The certificate for this server is invalid'); 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'); expect(errorMessage).toContain('SSL peer certificate or SSH remote key was not OK');
else else
expect(errorMessage).toContain('Unacceptable TLS certificate'); expect(errorMessage).toContain('Unacceptable TLS certificate');

View file

@ -19,7 +19,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const utils = require('./utils'); 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 {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner; const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
@ -243,9 +243,9 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})
if (CHROMIUM) { if (CHROMIUM) {
expect(failedRequests[0].failure().errorText).toBe('net::ERR_INVALID_HTTP_RESPONSE'); expect(failedRequests[0].failure().errorText).toBe('net::ERR_INVALID_HTTP_RESPONSE');
} else if (WEBKIT) { } else if (WEBKIT) {
if (process.platform === 'darwin') if (MAC)
expect(failedRequests[0].failure().errorText).toBe('The network connection was lost.'); 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'); expect(failedRequests[0].failure().errorText).toBe('Unsupported protocol');
else else
expect(failedRequests[0].failure().errorText).toBe('Message Corrupt'); expect(failedRequests[0].failure().errorText).toBe('Message Corrupt');