chore: upgrade cypress version

This commit is contained in:
Hufe921
2023-11-29 20:07:59 +08:00
parent 6b30e3ca9d
commit ecd4ae9652
32 changed files with 382 additions and 241 deletions
+46
View File
@@ -0,0 +1,46 @@
import Editor, { ControlType, ElementType } from '../../../src/editor'
describe('控件-复选框', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/canvas-editor/')
cy.get('canvas').first().as('canvas').should('have.length', 1)
})
const elementType: ElementType = <ElementType>'control'
const controlType: ControlType = <ControlType>'checkbox'
it('复选框', () => {
cy.getEditor().then((editor: Editor) => {
editor.command.executeSelectAll()
editor.command.executeBackspace()
editor.command.executeInsertElementList([
{
type: elementType,
value: '',
control: {
code: '98175',
type: controlType,
value: null,
valueSets: [
{
value: '有',
code: '98175'
},
{
value: '无',
code: '98176'
}
]
}
}
])
const data = editor.command.getValue().data.main[0]
expect(data.control!.code).to.be.eq('98175')
})
})
})
+56
View File
@@ -0,0 +1,56 @@
import Editor, { ControlType, ElementType } from '../../../src/editor'
describe('控件-列举型', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/canvas-editor/')
cy.get('canvas').first().as('canvas').should('have.length', 1)
})
const text = ``
const elementType: ElementType = <ElementType>'control'
const controlType: ControlType = <ControlType>'select'
it('列举型', () => {
cy.getEditor().then((editor: Editor) => {
editor.command.executeSelectAll()
editor.command.executeBackspace()
editor.command.executeInsertElementList([
{
type: elementType,
value: '',
control: {
type: controlType,
value: null,
placeholder: '列举型',
valueSets: [
{
value: '有',
code: '98175'
},
{
value: '无',
code: '98176'
}
]
}
}
])
cy.get('@canvas').type(`{leftArrow}`)
cy.get('.ce-select-control-popup li')
.eq(0)
.click()
.then(() => {
const data = editor.command.getValue().data.main[0]
expect(data.control!.value![0].value).to.be.eq(text)
expect(data.control!.code).to.be.eq('98175')
})
})
})
})
+43
View File
@@ -0,0 +1,43 @@
import Editor, { ControlType, ElementType } from '../../../src/editor'
describe('控件-文本型', () => {
beforeEach(() => {
cy.visit('http://localhost:3000/canvas-editor/')
cy.get('canvas').first().as('canvas').should('have.length', 1)
})
const text = `canvas-editor`
const elementType: ElementType = <ElementType>'control'
const controlType: ControlType = <ControlType>'text'
it('文本型', () => {
cy.getEditor().then((editor: Editor) => {
editor.command.executeSelectAll()
editor.command.executeBackspace()
editor.command.executeInsertElementList([
{
type: elementType,
value: '',
control: {
type: controlType,
value: null,
placeholder: '文本型'
}
}
])
cy.get('@canvas').type(`{leftArrow}`)
cy.get('.ce-inputarea')
.type(text)
.then(() => {
const data = editor.command.getValue().data.main[0]
expect(data.control!.value![0].value).to.be.eq(text)
})
})
})
})