Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Downloaded https://github.com/microsoft/playwright/tree/main and served with npx http-server
- await page.goto('http://localhost:8080/index.html');
- // stub relative timestamps like "2 hours ago"
- await page.evaluate(`document.querySelector('#repo-content-pjax-container > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.Box.mb-3 > div.Box-header.position-relative > div > div.flex-1.d-flex.flex-items-center.ml-3.min-width-0 > div.d-flex.flex-auto.flex-justify-end.ml-3.flex-items-baseline > a:nth-child(3)').innerHTML = 'stub'`);
- for (let i = 2; i < 25; i++) {
- await page.evaluate(`document.querySelector('#repo-content-pjax-container > div > div > div.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-end.Layout--sidebarPosition-flowRow-end > div.Layout-main > div.Box.mb-3 > div.js-details-container.Details > div.Details-content--hidden-not-important.js-navigation-container.js-active-navigation-container.d-md-block > div:nth-child(${i}) > div.color-fg-muted.text-right').innerHTML = 'stub'`);
- }
- // compare
- await expect(page.locator('.Layout-main')).toHaveScreenshot()
Advertisement
Add Comment
Please, Sign In to add comment