Skip to content

Commit f6e1219

Browse files
authored
test: make assertions order-insensitive to prevent failing tests based on the framework version (#7129)
1 parent 48cbba9 commit f6e1219

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

integration-tests/cucumber/cucumber.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,7 @@ describe(`cucumber@${version} commonJS`, () => {
28682868
assert.ok(!('TEST_EARLY_FLAKE_ENABLED' in testSession.meta))
28692869
}
28702870

2871-
const resourceNames = tests.map(span => span.resource)
2871+
const resourceNames = tests.map(span => span.resource).sort()
28722872

28732873
// TODO: This is a duplication of the code below. We should refactor this.
28742874
assertObjectContains(resourceNames,

integration-tests/playwright/playwright.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,18 @@ versions.forEach((version) => {
189189
assert.exists(testSuiteEvent.content.metrics[DD_HOST_CPU_COUNT])
190190
})
191191

192-
assert.deepStrictEqual(testEvents.map(test => test.content.resource), [
192+
assert.deepStrictEqual(testEvents.map(test => test.content.resource).sort(), [
193193
'landing-page-test.js.highest-level-describe' +
194-
' leading and trailing spaces should work with passing tests',
195-
'landing-page-test.js.highest-level-describe' +
196-
' leading and trailing spaces should work with skipped tests',
194+
' leading and trailing spaces should work with annotated tests',
197195
'landing-page-test.js.highest-level-describe' +
198196
' leading and trailing spaces should work with fixme',
199197
'landing-page-test.js.highest-level-describe' +
200-
' leading and trailing spaces should work with annotated tests',
201-
'todo-list-page-test.js.should work with fixme root',
202-
'todo-list-page-test.js.playwright should work with failing tests',
198+
' leading and trailing spaces should work with passing tests',
199+
'landing-page-test.js.highest-level-describe' +
200+
' leading and trailing spaces should work with skipped tests',
203201
'skipped-suite-test.js.should work with fixme root',
202+
'todo-list-page-test.js.playwright should work with failing tests',
203+
'todo-list-page-test.js.should work with fixme root',
204204
])
205205

206206
assertObjectContains(testEvents.map(test => test.content.meta[TEST_STATUS]), [
@@ -285,9 +285,9 @@ versions.forEach((version) => {
285285
receiver.gatherPayloadsMaxTimeout(({ url }) => url === '/api/v2/citestcycle', payloads => {
286286
const events = payloads.flatMap(({ payload }) => payload.events)
287287
const testEvents = events.filter(event => event.type === 'test')
288-
assertObjectContains(testEvents.map(test => test.content.resource), [
289-
'playwright-tests-ts/one-test.js.playwright should work with skipped tests',
288+
assertObjectContains(testEvents.map(test => test.content.resource).sort(), [
290289
'playwright-tests-ts/one-test.js.playwright should work with passing tests',
290+
'playwright-tests-ts/one-test.js.playwright should work with skipped tests',
291291
])
292292
assert.match(testOutput, /1 passed/)
293293
assert.match(testOutput, /1 skipped/)

0 commit comments

Comments
 (0)