fix(trace): only enable on separate tracing bots (#3677)

This commit is contained in:
Dmitry Gozman 2020-08-28 13:50:06 -07:00 committed by GitHub
parent 63a0e0c1d0
commit e5ff283a40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 3 deletions

View file

@ -184,3 +184,35 @@ jobs:
with:
name: wire-${{ matrix.browser }}-linux-test-results
path: test-results
tracing_linux:
name: "Tracing Linux"
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10
- uses: microsoft/playwright-github-action@v1
- run: npm ci
- run: npm run build
- run: mkdir -p coredumps
# Set core dump file name pattern
- run: sudo bash -c 'echo "$(pwd -P)/coredumps/core-pid_%p.dump" > /proc/sys/kernel/core_pattern'
# XVFB-RUN merges both STDOUT and STDERR, whereas we need only STDERR
# Wrap `npm run` in a subshell to redirect STDERR to file.
# Enable core dumps in the subshell.
- run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "ulimit -c unlimited && node test-runner/cli test/ --jobs=1 --forbid-only --timeout=30000 --retries=3 --reporter=dot,json"
env:
BROWSER: ${{ matrix.browser }}
TRACING: true
PWRUNNER_JSON_REPORT: "test-results/report.json"
- uses: actions/upload-artifact@v1
if: ${{ always() }}
with:
name: tracing-${{ matrix.browser }}-linux-test-results
path: test-results

View file

@ -33,6 +33,8 @@ export const options = {
HEADLESS: !!valueFromEnv('HEADLESS', true),
WIRE: !!process.env.PWWIRE,
SLOW_MO: valueFromEnv('SLOW_MO', 0),
// Tracing is currently not implemented under wire.
TRACING: valueFromEnv('TRACING', false) && !process.env.PWWIRE,
};
declare global {
@ -183,7 +185,7 @@ registerWorkerFixture('golden', async ({browserName}, test) => {
registerFixture('context', async ({browser, toImpl}, runTest, info) => {
const context = await browser.newContext();
const { test, config } = info;
if (toImpl) {
if (options.TRACING) {
const traceStorageDir = path.join(config.outputDir, 'trace-storage');
const relativePath = path.relative(config.testDir, test.file).replace(/\.spec\.[jt]s/, '');
const sanitizedTitle = test.title.replace(/[^\w\d]+/g, '_');

View file

@ -16,7 +16,7 @@
import { options } from './playwright.fixtures';
it.skip(options.WIRE)('should not throw', async ({page, server, context, toImpl}) => {
it.skip(!options.TRACING)('should not throw', async ({page, server, context, toImpl}) => {
await page.goto(server.PREFIX + '/snapshot/snapshot-with-css.html');
await (context as any).__snapshotter.captureSnapshot(toImpl(page), { timeout: 5000, label: 'snapshot' });
});

View file

@ -17,7 +17,7 @@
const path = require('path');
const fs = require('fs');
const playwright = require('..');
const { showTraceViewer } = require('../lib/client/traceViewer');
const { showTraceViewer } = require('../lib/trace/traceViewer');
const testResultsDir = process.argv[2] || path.join(__dirname, '..', 'test-results');
const files = collectFiles(testResultsDir, '');