Skip to content

chore(integration-tests): Update Playwright to 1.27.1 #6511

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

Merged
merged 2 commits into from
Dec 13, 2022
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
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"karma-typescript-es6-transform": "^4.0.0",
"karma-webkit-launcher": "^1.0.2",
"node-fetch": "^2.6.0",
"playwright": "^1.17.1",
"playwright": "^1.27.1",
"sinon": "^7.3.2",
"webpack": "^4.30.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
},
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.17.0",
"@playwright/test": "^1.27.1",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.5.0",
"playwright": "^1.17.1",
"playwright": "^1.27.1",
"typescript": "^4.5.2",
"webpack": "^5.52.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sentryTest('should report finished spans as children of the root transaction', a
const url = await getLocalTestPath({ testDir: __dirname });
const transaction = await getFirstSentryEnvelopeRequest<Event>(page, url);

const rootSpanId = transaction?.contexts?.trace.spanId;
const rootSpanId = transaction?.contexts?.trace?.spanId;

expect(transaction.spans).toHaveLength(3);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sentryTest(
{ function: 'readFile' },
{ function: 'httpsCall' },
{ function: 'webpackDevServer' },
{ function: 'Function.httpCode' },
{ function: 'Response.httpCode' },
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sentryTest(
{ function: 'file' },
{ function: 'https' },
{ function: 'webpack' },
{ function: 'Function.http' },
{ function: 'File.http' },
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sentryTest(
{ function: '?' },
{ function: 'foo' },
{ function: 'bar' },
{ function: 'Function.baz' },
{ function: 'Test.baz' },
]);
});

Expand Down
11 changes: 0 additions & 11 deletions packages/integration-tests/suites/stacktraces/template.hbs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<title></title>
<script src="{{htmlWebpackPlugin.options.initialization}}"></script>
<script src="{{htmlWebpackPlugin.options.initialization}}"></script>
</head>
<body>
<script src="{{htmlWebpackPlugin.options.subject}}"></script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ sentryTest('should finish pageload transaction when the page goes background', a

const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page);

expect(pageloadTransaction.contexts?.trace.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace.tags).toMatchObject({
expect(pageloadTransaction.contexts?.trace?.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace?.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace?.tags).toMatchObject({
visibilitychange: 'document.hidden',
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestPath,
expect.objectContaining({
op: 'ui.long-task',
description: 'Main UI thread blocked',
parent_span_id: eventData.contexts?.trace.span_id,
parent_span_id: eventData.contexts?.trace?.span_id,
}),
);
const start = firstUISpan['start_timestamp'] ?? 0;
const end = firstUISpan['timestamp'] ?? 0;
const start = (firstUISpan as Event)['start_timestamp'] ?? 0;
const end = (firstUISpan as Event)['timestamp'] ?? 0;
const duration = end - start;

expect(duration).toBeGreaterThanOrEqual(0.1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ sentryTest(
trace_id: '12312012123120121231201212312012',
});

expect(navigationRequest.contexts?.trace.op).toBe('navigation');
expect(navigationRequest.contexts?.trace.trace_id).toBeDefined();
expect(navigationRequest.contexts?.trace.trace_id).not.toBe(pageloadRequest.contexts?.trace.trace_id);
expect(navigationRequest.contexts?.trace?.op).toBe('navigation');
expect(navigationRequest.contexts?.trace?.trace_id).toBeDefined();
expect(navigationRequest.contexts?.trace?.trace_id).not.toBe(pageloadRequest.contexts?.trace?.trace_id);

const pageloadSpans = pageloadRequest.spans;
const navigationSpans = navigationRequest.spans;

const pageloadSpanId = pageloadRequest.contexts?.trace.span_id;
const navigationSpanId = navigationRequest.contexts?.trace.span_id;
const pageloadSpanId = pageloadRequest.contexts?.trace?.span_id;
const navigationSpanId = navigationRequest.contexts?.trace?.span_id;

expect(pageloadSpanId).toBeDefined();
expect(navigationSpanId).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ sentryTest('should create a navigation transaction on page navigation', async ({
const pageloadRequest = await getFirstSentryEnvelopeRequest<Event>(page, url);
const navigationRequest = await getFirstSentryEnvelopeRequest<Event>(page, `${url}#foo`);

expect(pageloadRequest.contexts?.trace.op).toBe('pageload');
expect(navigationRequest.contexts?.trace.op).toBe('navigation');
expect(pageloadRequest.contexts?.trace?.op).toBe('pageload');
expect(navigationRequest.contexts?.trace?.op).toBe('navigation');

expect(navigationRequest.transaction_info?.source).toEqual('url');

const pageloadTraceId = pageloadRequest.contexts?.trace.trace_id;
const navigationTraceId = navigationRequest.contexts?.trace.trace_id;
const pageloadTraceId = pageloadRequest.contexts?.trace?.trace_id;
const navigationTraceId = navigationRequest.contexts?.trace?.trace_id;

expect(pageloadTraceId).toBeDefined();
expect(navigationTraceId).toBeDefined();
Expand All @@ -25,8 +25,8 @@ sentryTest('should create a navigation transaction on page navigation', async ({
const pageloadSpans = pageloadRequest.spans;
const navigationSpans = navigationRequest.spans;

const pageloadSpanId = pageloadRequest.contexts?.trace.span_id;
const navigationSpanId = navigationRequest.contexts?.trace.span_id;
const pageloadSpanId = pageloadRequest.contexts?.trace?.span_id;
const navigationSpanId = navigationRequest.contexts?.trace?.span_id;

expect(pageloadSpanId).toBeDefined();
expect(navigationSpanId).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sentryTest('should add browser-related spans to pageload transaction', async ({
expect(browserSpans).toContainEqual(
expect.objectContaining({
description: eventDesc,
parent_span_id: eventData.contexts?.trace.span_id,
parent_span_id: eventData.contexts?.trace?.span_id,
}),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Event } from '@sentry/types';
import { sentryTest } from '../../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';

sentryTest('should add resource spans to pageload transaction', async ({ getLocalTestPath, page }) => {
sentryTest('should add resource spans to pageload transaction', async ({ getLocalTestPath, page, browser }) => {
// Intercepting asset requests to avoid network-related flakiness and random retries (on Firefox).
await page.route('**/path/to/image.svg', (route: Route) => route.fulfill({ path: `${__dirname}/assets/image.svg` }));
await page.route('**/path/to/script.js', (route: Route) => route.fulfill({ path: `${__dirname}/assets/script.js` }));
Expand All @@ -15,13 +15,19 @@ sentryTest('should add resource spans to pageload transaction', async ({ getLoca
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
const resourceSpans = eventData.spans?.filter(({ op }) => op?.startsWith('resource'));

expect(resourceSpans?.length).toBe(3);
// Webkit 16.0 (which is linked to Playwright 1.27.1) consistently creates 2 consectutive spans for `css`,
// so we need to check for 3 or 4 spans.
if (browser.browserType().name() === 'webkit') {
expect(resourceSpans?.length).toBeGreaterThanOrEqual(3);
} else {
expect(resourceSpans?.length).toBe(3);
}

['resource.img', 'resource.script', 'resource.link'].forEach(op =>
expect(resourceSpans).toContainEqual(
expect.objectContaining({
op: op,
parent_span_id: eventData.contexts?.trace.span_id,
parent_span_id: eventData.contexts?.trace?.span_id,
}),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ sentryTest('should create spans for multiple fetch requests', async ({ getLocalT
requestSpans?.forEach((span, index) =>
expect(span).toMatchObject({
description: `GET http://example.com/${index}`,
parent_span_id: tracingEvent.contexts?.trace.span_id,
parent_span_id: tracingEvent.contexts?.trace?.span_id,
span_id: expect.any(String),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: tracingEvent.contexts?.trace.trace_id,
trace_id: tracingEvent.contexts?.trace?.trace_id,
}),
);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/integration-tests/suites/tracing/request/xhr/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ sentryTest('should create spans for multiple XHR requests', async ({ getLocalTes
requestSpans?.forEach((span, index) =>
expect(span).toMatchObject({
description: `GET http://example.com/${index}`,
parent_span_id: eventData.contexts?.trace.span_id,
parent_span_id: eventData.contexts?.trace?.span_id,
span_id: expect.any(String),
start_timestamp: expect.any(Number),
timestamp: expect.any(Number),
trace_id: eventData.contexts?.trace.trace_id,
trace_id: eventData.contexts?.trace?.trace_id,
}),
);
});
Expand Down
1 change: 1 addition & 0 deletions packages/integration-tests/utils/defaults/template.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Loading