Skip to content

Commit ee7e32f

Browse files
[test optimization] Fix playwright tests in v5 release line (#6798)
1 parent 2872038 commit ee7e32f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/datadog-instrumentations/src/playwright.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,28 +496,28 @@ function dispatcherHook (dispatcherExport) {
496496
const worker = createWorker.apply(this, arguments)
497497
const projects = getProjectsFromDispatcher(dispatcher)
498498

499+
// for older versions of playwright, `shouldCreateTestSpan` should always be true,
500+
// since the `_runTest` function wrapper is not available for older versions
499501
worker.process.on('message', ({ method, params }) => {
500502
if (method === 'testBegin') {
501503
const { test } = dispatcher._testById.get(params.testId)
502504
const browser = getBrowserNameFromProjects(projects, test)
503-
const shouldCreateTestSpan = test.expectedStatus === 'skipped'
504-
testBeginHandler(test, browser, shouldCreateTestSpan)
505+
testBeginHandler(test, browser, true)
505506
} else if (method === 'testEnd') {
506507
const { test } = dispatcher._testById.get(params.testId)
507508

508509
const { results } = test
509510
const testResult = results.at(-1)
510511

511512
const isTimeout = testResult.status === 'timedOut'
512-
const shouldCreateTestSpan = test.expectedStatus === 'skipped'
513513
testEndHandler(
514514
{
515515
test,
516516
annotations: params.annotations,
517517
testStatus: STATUS_TO_TEST_STATUS[testResult.status],
518518
error: testResult.error,
519519
isTimeout,
520-
shouldCreateTestSpan,
520+
shouldCreateTestSpan: true,
521521
projects
522522
}
523523
)

0 commit comments

Comments
 (0)