Transcript
00:00 Any debugging starts from reproducing the issue. And the more reliably you are able to do so, the more efficient you will be in investigating and eventually fixing it. And your tests are no exception here. If you can get a failed test before your eyes, you'd be able to inspect it, follow the stack traces, try your different debugging tools and skills, and even see how the test reacts to your attempts to fix it. But what about the situations when your test passes locally but fails on CI?
00:25 Although it may sound counterintuitive how can the same test produce different results, it does happen in practice, and it happens quite often. Because think about it, we are taking our end to end test suite, which is an already complex thing on its own, and adding an extra complexity on top by putting it on a remote machine and asking it to run it. So now there are even more things that are able to influence the result of our tests, for example, the operating system, the version of browser use, even the memory consumption. So how do you approach these scenarios? Do you just rerun the test locally hoping to hit the exact state it did on CI?
00:59 You may try doing so, but it will be extremely inefficient. There is a much better way because Playwright has a concept of tracing. Basically, you are able to record any test run and put it in a trace file. Think about it as a snapshot of that run. And you can open that snapshot at any time on any machine, yours or your colleagues, and inspect the exact state of the test during that run.
01:21 That is exactly what you are gonna do in this exercise because I already have that trace snapshot prepared for you. It contains the result of a failed test run. If you try running the same test locally, though, they're gonna pass and they're gonna pass reliably. So use the feature in Playwright called Trace Viewer to open that trace snapshot and see what's wrong. Find the culprit and fix it.
01:43 Once you're done, come back to me so we can discuss tracing and playwright in more detail.
