feat:add image test case

This commit is contained in:
Hufe921
2022-03-16 19:20:32 +08:00
parent 6de0ee8e64
commit 3896b86b5d
6 changed files with 37 additions and 1 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

+28
View File
@@ -0,0 +1,28 @@
import Editor from '../../../src/editor'
describe('菜单-图片', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/canvas-editor/')
cy.get('canvas').first().as('canvas').should('have.length', 1)
})
it('图片', () => {
cy.getEditor().then((editor: Editor) => {
editor.listener.saved = function (payload) {
const data = payload.data
expect(data[0].type).to.eq('image')
}
editor.command.executeSelectAll()
editor.command.executeBackspace()
cy.get('#image').attachFile('test.png')
cy.get('@canvas').type('{ctrl}s')
})
})
})
+2
View File
@@ -1,3 +1,5 @@
import 'cypress-file-upload'
Cypress.Commands.add('getEditor', () => {
return cy.window().its('editor')
})
+1 -1
View File
@@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es5",
"lib": ["es2015", "dom", "esnext"],
"types": ["cypress"],
"types": ["cypress", "cypress-file-upload"],
"isolatedModules": false,
"allowJs": true,
"noEmit": true,