separate svgcanvas from svgedit
now you can use directlt svgcanvas. see readme.md * configure workspaces * move svgcanvas to packages folder * move utils to common and paint to svgcanvas * make svgcanvas a dependency of svgedit * update deps * workspaces requires npm 7 at least so the ci needs a new node version * update github actions to V3 * update snapshots using custom svg exports * remove unmaintained cypress snapshot plugin * new github action to add coverage in PR * Update onpushandpullrequest.yml * svgcanvas v7.1.6
This commit is contained in:
@@ -23,3 +23,22 @@
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
Cypress.Commands.add('svgSnapshot', () => {
|
||||
cy.wait(300) // necessary for some animations to complete
|
||||
// console.log(Cypress.spec, Cypress.currentTest)
|
||||
cy.window().then((win) => { // access to the remote Window so we can get the svgEditor variable
|
||||
const svgString = win.svgEditor.svgCanvas.getSvgString()
|
||||
const filename = `cypress/__svgSnapshots__/${Cypress.spec.fileName}-${Cypress.currentTest.title}.svg`
|
||||
//
|
||||
// console.log(filename)
|
||||
cy.task('readFileMaybe', filename).then((text) => {
|
||||
if (text === null) {
|
||||
// file does not exist so we create it
|
||||
cy.writeFile(filename, svgString)
|
||||
cy.log('creating snapshot', filename)
|
||||
} else {
|
||||
expect(text).to.equal(svgString)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user