Added e2e tests and snapshot files

This commit is contained in:
Knut Sveidqvist
2019-06-01 19:21:15 +02:00
parent 357e738983
commit 86fcbf9c5e
20 changed files with 414 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
/* eslint-env jest */
import { Base64 } from 'js-base64'
const mermaidUrl = (graphStr, options) => {
export const mermaidUrl = (graphStr, options) => {
const obj = {
code: graphStr,
mermaid: options
@@ -10,4 +11,16 @@ const mermaidUrl = (graphStr, options) => {
return 'http://localhost:9000/e2e.html?graph=' + Base64.encodeURI(objStr)
}
export default mermaidUrl
export const imgSnapshotTest = async (page, graphStr, options) => {
return new Promise(async resolve => {
const url = mermaidUrl(graphStr, options)
await page.goto(url)
const image = await page.screenshot()
expect(image).toMatchImageSnapshot()
resolve()
})
// page.close()
}