Guest User

Untitled

a guest
Jul 13th, 2023
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   // Downloaded https://github.com/microsoft/playwright/tree/main and served with npx http-server
  2.   await page.goto('http://localhost:8080/index.html');
  3.   // stub relative timestamps like "2 hours ago"
  4.   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'`);
  5.   for (let i = 2; i < 25; i++) {
  6.     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'`);
  7.   }
  8.  
  9.   // compare
  10.   await expect(page.locator('.Layout-main')).toHaveScreenshot()
Advertisement
Add Comment
Please, Sign In to add comment