2021-08-27 13:56:07 +00:00
|
|
|
import {
|
2021-12-30 08:29:49 +00:00
|
|
|
visitAndApproveStorage, testSnapshot
|
2021-12-28 14:02:29 +00:00
|
|
|
} from '../../support/ui-test-helper.js'
|
2021-08-27 13:56:07 +00:00
|
|
|
|
|
|
|
describe('use all parts of svg-edit', function () {
|
|
|
|
before(() => {
|
2021-12-28 14:02:29 +00:00
|
|
|
visitAndApproveStorage()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
|
|
|
|
it('check tool_source_set', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#tool_source').click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#svg_source_textarea')
|
|
|
|
.type('{selectall}', { force: true })
|
|
|
|
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
|
|
|
<g class="layer">
|
|
|
|
<title>Layer 1</title>
|
|
|
|
</g>
|
2021-12-28 14:02:29 +00:00
|
|
|
</svg>`, { force: true, parseSpecialCharSequences: false })
|
|
|
|
cy.get('#tool_source_save').click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star', function () {
|
|
|
|
cy.get('#tool_star')
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#svgcontent')
|
|
|
|
.trigger('mousedown', 300, 150, { force: true })
|
|
|
|
.trigger('mousemove', 300, 250, { force: true })
|
2021-12-28 14:02:29 +00:00
|
|
|
.trigger('mouseup', { force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_clone', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#tool_clone').click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_class', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#elem_class').shadow().find('elix-input').eq(0).shadow().find('#inner').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.type('svg_2_class{enter}', { force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#svg_2')
|
|
|
|
.should('satisfy', ($el) => {
|
2021-12-28 14:02:29 +00:00
|
|
|
const classList = Array.from($el[0].classList)
|
|
|
|
return classList.includes('svg_2_class')
|
|
|
|
})
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_id', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true }).click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#elem_id').shadow().find('elix-input').eq(0).shadow().find('#inner').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.type('_id{enter}', { force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#svg_2_id')
|
|
|
|
.should('satisfy', ($el) => {
|
2021-12-28 14:02:29 +00:00
|
|
|
const classList = Array.from($el[0].classList)
|
|
|
|
return classList.includes('svg_2_class')
|
|
|
|
})
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_rotation', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
for (let n = 0; n < 5; n++) {
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#angle').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
}
|
2021-12-28 14:02:29 +00:00
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_blur', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#blur').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
}
|
2021-12-28 14:02:29 +00:00
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_opacity', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#opacity').shadow().find('elix-number-spin-box').eq(0).shadow().find('#downButton').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
}
|
2021-12-28 14:02:29 +00:00
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_bring_to_back', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
cy.get('#tool_move_bottom').click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_bring_to_front', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
cy.get('#tool_move_top').click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_delete', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2_id').click({ force: true })
|
|
|
|
cy.get('#tool_delete').click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_align_to_page', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#tool_position').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened')
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#tool_position').find('se-list-item').eq(0).shadow().find('elix-option').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_stroke_width', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#stroke_width').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
}
|
2021-12-28 14:02:29 +00:00
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_stoke_fill_color', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#stroke_color').shadow().find('#picker').eq(0).click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#stroke_color').shadow().find('#color_picker').eq(0)
|
|
|
|
.find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.find('.QuickColor').eq(51).click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#stroke_color').shadow().find('#color_picker').eq(0)
|
|
|
|
.find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.find('#Ok').eq(0).click({ force: true })
|
|
|
|
cy.get('#fill_color').shadow().find('#picker').eq(0).click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#fill_color').shadow().find('#color_picker').eq(0)
|
|
|
|
.find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.find('.QuickColor').eq(3).click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#fill_color').shadow().find('#color_picker').eq(0)
|
|
|
|
.find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.find('#Ok').eq(0).click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
2021-08-27 13:56:07 +00:00
|
|
|
it('check tool_star_change_sides', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2021-08-27 13:56:07 +00:00
|
|
|
cy.get('#starNumPoints').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
|
|
|
testSnapshot()
|
|
|
|
})
|
|
|
|
})
|