feat:add image test case
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -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')
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'cypress-file-upload'
|
||||
|
||||
Cypress.Commands.add('getEditor', () => {
|
||||
return cy.window().its('editor')
|
||||
})
|
||||
@@ -2,7 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["es2015", "dom", "esnext"],
|
||||
"types": ["cypress"],
|
||||
"types": ["cypress", "cypress-file-upload"],
|
||||
"isolatedModules": false,
|
||||
"allowJs": true,
|
||||
"noEmit": true,
|
||||
|
||||
Reference in New Issue
Block a user