Open karlhorky opened 1 day ago
Use toEqual()
like this:
expect(await page.locator('h2:text("Schedule") + div.grid a').allInnerTexts()).toEqual([ ... ])
This will display a better, more usable, accessible diff with fewer lines of context:
ยท
1) playwright/pernExtensiveImmersiveStudentBrowses.spec.ts:33:3 โบ PERN Extensive (Immersive) student browses โบ PERN Extensive (Immersive) student browses
Error: expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
@@ -64,11 +64,11 @@
09:30 - 11:00",
"Project Time
11:00 - 17:00",
"Retrospective and Review
17:00 - 18:00",
- "๐งโ๐ซ Intro to Cour, Remote Collaboration",
+ "๐งโ๐ซ Intro to Course, Remote Collaboration",
"๐งโ๐ซ Job Application Processes",
"๐งโ๐ซ LinkedIn and GitHub Profile Setup",
"๐งโ๐ซ CV Setup and Job Market",
"Daily Scrum",
326 | expect(await allScheduleAnchors.count()).toBeGreaterThan(200);
327 | }).toPass();
> 328 | expect(await allScheduleAnchors.allInnerTexts()).toEqual([
| ^
at
Version
1.48.2
Steps to reproduce
(await page.locator('h2:text("Schedule") + div.grid a').allInnerTexts()).join('\n')
)At some point, this visual diff using colored text via ANSI escape codes shows up in the output:
This is really easy to miss, even if you quickly scroll through all lines.
Expected behavior
Eg. the same type of diff as in
.toEqual([ ... ])
Actual behavior
Additional context
--
Environment