Skip to content

Commit

Permalink
fix: проставлен шрифт, чтобы на разных платформах не отличались скриш…
Browse files Browse the repository at this point in the history
…оты страниц в тестах PW
  • Loading branch information
mxseev committed Feb 7, 2022
1 parent ec42d59 commit 97a516d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import NextDocument, {Html, Head, Main, NextScript} from "next/document"

class Document extends NextDocument {
render() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Roboto&display=swap"
rel="stylesheet"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}

export default Document
4 changes: 4 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

html {
font-family: 'Roboto', sans-serif;
}
1 change: 1 addition & 0 deletions tests/snapshots/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {test} from "@playwright/test"
import {snapshot} from "../utils"

// force Playwright for same screenshot filenames on various platforms
test.beforeEach(({page}, testInfo) => {
// eslint-disable-next-line no-param-reassign
testInfo.snapshotSuffix = "multi_platform"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {Page, expect} from "@playwright/test"
const snapshot = async (page: Page, url: string, filename: string) => {
await page.goto(url)

// wait for fonts loading
await page.waitForTimeout(2500)

const screenshot = await page.screenshot()
expect(screenshot).toMatchSnapshot(filename)
}
Expand Down

0 comments on commit 97a516d

Please sign in to comment.