Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate query tests from puppeteer to playwright #966

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions bench/gl-stats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import puppeteer from 'puppeteer';
import {chromium} from 'playwright';
import fs from 'fs';
import zlib from 'zlib';
import {execSync} from 'child_process';
Expand All @@ -20,15 +20,19 @@ function waitForConsole(page) {
});
}

const browser = await puppeteer.launch({
const browser = await chromium.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox'],
headless: false
});
try {
const page = await browser.newPage();
// Emulate high-DPI
const context = await browser.newContext({
viewport: {width: 600, height: 600},
deviceScaleFactor: 2,
});
const page = await context.newPage();

console.log('collecting stats...');
await page.setViewport({width: 600, height: 600, deviceScaleFactor: 2});
await page.setContent(benchHTML);

// @ts-ignore
Expand Down
10 changes: 7 additions & 3 deletions bench/run-benchmarks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import puppeteer from 'puppeteer';
import {chromium} from 'playwright';
import PDFMerger from 'pdf-merger-js';
import minimist from 'minimist';

Expand All @@ -18,13 +18,17 @@ const url = new URL('http://localhost:9966/bench/versions/');
for (const compare of [].concat(argv.compare).filter(Boolean))
url.searchParams.append('compare', compare);

const browser = await puppeteer.launch({
const browser = await chromium.launch({
headless: true,
args: ['--use-gl=angle', '--no-sandbox', '--disable-setuid-sandbox']
});

try {
const webPage = await browser.newPage();
const context = await browser.newContext({
viewport: {width: 1280, height: 1024}
});
context.setDefaultTimeout(0);
const webPage = await context.newPage();

url.hash = 'NONE';
await webPage.goto(url.toString());
Expand Down
17 changes: 17 additions & 0 deletions jest.config.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
'roots': [
'<rootDir>/src',
'<rootDir>/test',
],
'testMatch': [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)'
],
'transform': {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
transformIgnorePatterns: [
'/node_modules/@mapbox/jsonlint-lines-primitives/lib/jsonlint.js'
],
setupFiles: ['jest-canvas-mock', 'jest-playwright-preset'],
};
Loading