parent
6de0ee8e64
commit
3896b86b5d
|
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', () => {
|
Cypress.Commands.add('getEditor', () => {
|
||||||
return cy.window().its('editor')
|
return cy.window().its('editor')
|
||||||
})
|
})
|
||||||
Loading…
Reference in new issue