tests: consistently use platform constants (#899)

This commit is contained in:
Pavel Feldman 2020-02-07 14:44:05 -08:00 коммит произвёл GitHub
Родитель 3acc65d285
Коммит 36344dee27
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -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');
});

Просмотреть файл

@ -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, defaultBrows
expect(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, defaultBrows
expect(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();

Просмотреть файл

@ -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`);
else
process.kill(child.pid);

Просмотреть файл

@ -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, CHROMI
await 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, CHROMI
if (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');
else
expect(errorMessage).toContain('Unacceptable TLS certificate');

Просмотреть файл

@ -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');
else
expect(failedRequests[0].failure().errorText).toBe('Message Corrupt');