diff --git a/images/samples/images/webshop-login.png b/images/samples/images/webshop-login.png new file mode 100644 index 00000000..e2b88f96 Binary files /dev/null and b/images/samples/images/webshop-login.png differ diff --git a/learn/playwright/performance.mdx b/learn/playwright/performance.mdx index 8dfc0388..fff7681c 100644 --- a/learn/playwright/performance.mdx +++ b/learn/playwright/performance.mdx @@ -210,10 +210,21 @@ test('basic performance paint timing', async ({ page }) => { ```json [ - { name: 'first-paint', entryType: 'paint', startTime: 1149.5, duration: 0 }, - { name: 'first-contentful-paint', entryType: 'paint', startTime: 1149.5, duration: 0 } + { + "name": "first-paint", + "entryType": "paint", + "startTime": 1149.5, + "duration": 0 + }, + { + "name": "first-contentful-paint", + "entryType": "paint", + "startTime": 1149.5, + "duration": 0 + } ] +``` #### Largest Contentful Paint API (`largest-contentful-paint`) @@ -354,7 +365,7 @@ The DevTools Protocol is quite extensive. We recommend exploring the [documentat Lighthouse can easily be used programmatically with Playwright to gather values and scores for different metrics, like [Time To Interactive (TTI)](https://web.dev/interactive/): -```js +```js measure-performance.js const chromeLauncher = require('chrome-launcher') const { chromium } = require('playwright') const lighthouse = require('lighthouse') diff --git a/learn/playwright/test-fixtures.mdx b/learn/playwright/test-fixtures.mdx index 2deeb10c..bc4a546d 100644 --- a/learn/playwright/test-fixtures.mdx +++ b/learn/playwright/test-fixtures.mdx @@ -28,8 +28,7 @@ At their core, fixtures in Playwright are predefined components like `page`, `co When writing multiple tests for a single site or service, you're likely to end up performing the same tasks over and over, so we'd like to add fixtures to our Playwright tests that developers can re-use, rather than copying and pasting big blocks of code. This helps us follow the DRY principle: don't repeat yourself when writing code! ## Why we need custom fixtures -In our web shop, we've got a login process that we want to simulate and test before doing further account actions: - +In our [web shop](https://danube-webshop.herokuapp.com/), we've got a login process that we want to simulate and test before doing further account actions: ![A web shop login dialog](/images/samples/images/webshop-login.png) To open this dialog and log in, we might use some lines like the following: