Adding image snapshots for graphs

This commit is contained in:
Knut Sveidqvist
2019-05-31 14:20:43 +02:00
parent 7242a98adb
commit 357e738983
9 changed files with 1147 additions and 60 deletions

View File

@@ -1,10 +1,23 @@
/* eslint-env jest */
describe('Google', () => {
beforeAll(async () => {
await page.goto('https://google.com')
})
import mermaidUrl from '../helpers/util.js'
const { toMatchImageSnapshot } = require('jest-image-snapshot')
it('should be titled "Google"', async () => {
await expect(page.title()).resolves.toMatch('Google')
expect.extend({ toMatchImageSnapshot })
describe('Google', () => {
it('should apa', async () => {
const url = mermaidUrl(`graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
`, {})
await page.goto(url)
const image = await page.screenshot()
expect(image).toMatchImageSnapshot()
})
})