2020-09-12 23:32:13 +00:00
|
|
|
import {
|
2022-08-14 13:01:51 +00:00
|
|
|
visitAndApproveStorage
|
2021-12-28 14:02:29 +00:00
|
|
|
} from '../../support/ui-test-helper.js'
|
2020-09-12 23:32:13 +00:00
|
|
|
|
2022-08-14 13:01:51 +00:00
|
|
|
describe('use text tools of svg-edit', function () {
|
2020-09-12 23:32:13 +00:00
|
|
|
before(() => {
|
2021-12-28 14:02:29 +00:00
|
|
|
visitAndApproveStorage()
|
|
|
|
})
|
2020-09-12 23:32:13 +00:00
|
|
|
|
|
|
|
it('check tool_source', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#tool_source').click({ force: true })
|
2020-09-12 23:32:13 +00:00
|
|
|
cy.get('#svg_source_textarea')
|
2021-05-12 23:00:09 +00:00
|
|
|
.type('{selectall}', { force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
.type(`<svg width="640" height="480" viewBox="0 0 640 480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
2020-09-12 23:32:13 +00:00
|
|
|
<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 })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2020-09-12 23:32:13 +00:00
|
|
|
it('check tool_text', function () {
|
|
|
|
cy.get('#tool_text')
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.get('#svgroot')
|
|
|
|
.trigger('mousedown', { clientX: 400, clientY: 400, force: true })
|
2021-12-28 14:02:29 +00:00
|
|
|
.trigger('mouseup', { force: true })
|
2020-09-12 23:32:13 +00:00
|
|
|
// svgedit use the #text text field to capture the text
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#text').type('AB', { force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
// force text position for snapshot tests being consistent on CI/Interactive
|
|
|
|
cy.get('#selected_x').shadow().find('elix-number-spin-box').eq(0).shadow().find('#inner').eq(0).type('{selectall}200', { force: true })
|
|
|
|
cy.get('#selected_y').shadow().find('elix-number-spin-box').eq(0).shadow().find('#inner').eq(0).type('{selectall}200', { force: true })
|
|
|
|
cy.svgSnapshot()
|
|
|
|
// cy.get('#svg_1').should('exist')
|
2022-03-13 11:59:53 +00:00
|
|
|
})
|
2020-09-13 09:26:26 +00:00
|
|
|
it('check tool_clone', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_clone')
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2020-09-13 09:26:26 +00:00
|
|
|
it('check tool_italic', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_italic')
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2020-09-13 09:26:26 +00:00
|
|
|
it('check tool_bold', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_bold')
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_x_y_coordinate', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
|
|
|
for (let n = 0; n < 25; n++) {
|
2021-08-27 11:04:07 +00:00
|
|
|
cy.get('#selected_x').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 11:04:07 +00:00
|
|
|
}
|
2021-12-28 14:02:29 +00:00
|
|
|
for (let n = 0; n < 25; n++) {
|
2021-08-27 11:04:07 +00:00
|
|
|
cy.get('#selected_y').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 11:04:07 +00:00
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_font_size', 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 11:04:07 +00:00
|
|
|
cy.get('#font_size').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 11:04:07 +00:00
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_stroke_width', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2021-08-27 11:04: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 })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_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 11:04: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 11:04: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 11:04: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 11:04: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 })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_blur', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
2021-08-27 11:04: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 11:04:07 +00:00
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_opacity', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
2021-08-27 11:04: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 11:04:07 +00:00
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_align_to_page', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
2022-08-07 23:05:22 +00:00
|
|
|
cy.get('#tool_position').shadow().find('#select-container').eq(0).click({ force: true })
|
|
|
|
cy.get('#tool_position').find('se-list-item').eq(2).shadow().find('[aria-label="option"]').eq(0)
|
2021-12-28 14:02:29 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-27 11:04:07 +00:00
|
|
|
it('check tool_text_change_class', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true })
|
2021-08-27 11:04: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 11:04: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 11:04:07 +00:00
|
|
|
it('check tool_text_change_id', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_2').click({ force: true }).click({ force: true })
|
2021-08-27 11:04: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 11:04: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 11:04:07 +00:00
|
|
|
it('check tool_text_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 })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2021-08-30 07:07:06 +00:00
|
|
|
it('check tool_text_change_font_family', function () {
|
2021-12-28 14:02:29 +00:00
|
|
|
cy.get('#svg_1').click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.get('#tool_font_family').shadow().find('select').select('Serif', { force: true })
|
|
|
|
cy.svgSnapshot()
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|
2022-01-04 09:42:22 +00:00
|
|
|
it('check tool_text_decoration_underline', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#tool_text_decoration_underline')
|
2022-01-04 19:22:17 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-04 09:42:22 +00:00
|
|
|
})
|
|
|
|
it('check tool_text_decoration_linethrough', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#tool_text_decoration_linethrough')
|
2022-01-04 19:22:17 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-04 09:42:22 +00:00
|
|
|
})
|
|
|
|
it('check tool_text_decoration_overline', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
cy.get('#tool_text_decoration_overline')
|
2022-01-04 19:22:17 +00:00
|
|
|
.click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-04 09:42:22 +00:00
|
|
|
})
|
2022-01-12 09:48:34 +00:00
|
|
|
it('check tool_letter_spacing', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
for (let n = 0; n < 10; n++) {
|
|
|
|
cy.get('#tool_letter_spacing').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
|
|
|
.click({ force: true })
|
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-12 09:48:34 +00:00
|
|
|
})
|
|
|
|
it('check tool_word_spacing', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
for (let n = 0; n < 15; n++) {
|
|
|
|
cy.get('#tool_word_spacing').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
|
|
|
.click({ force: true })
|
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-12 09:48:34 +00:00
|
|
|
})
|
|
|
|
it('check tool_text_length', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
|
|
|
for (let n = 0; n < 20; n++) {
|
|
|
|
cy.get('#tool_text_length').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
|
|
|
.click({ force: true })
|
|
|
|
}
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-12 09:48:34 +00:00
|
|
|
})
|
|
|
|
it('check tool_length_adjust', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
2023-01-09 07:32:54 +00:00
|
|
|
cy.get('#tool_length_adjust').shadow().find('select').select(1, { force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
cy.svgSnapshot()
|
2022-01-12 09:48:34 +00:00
|
|
|
})
|
2022-03-13 11:59:53 +00:00
|
|
|
it('check tool_text_change_rotation', function () {
|
|
|
|
cy.get('#svg_1').click({ force: true })
|
2022-08-14 13:01:51 +00:00
|
|
|
for (let n = 0; n < 6; n++) {
|
2022-03-13 11:59:53 +00:00
|
|
|
cy.get('#angle').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
|
|
|
|
.click({ force: true })
|
|
|
|
}
|
|
|
|
cy.get('#svg_1').should('have.attr', 'transform')
|
2022-08-14 13:01:51 +00:00
|
|
|
.and('match', /rotate\(30/)
|
|
|
|
// snapshot removed below for inconsistency between local and CI tests.
|
|
|
|
// cy.svgSnapshot()
|
2022-03-13 11:59:53 +00:00
|
|
|
})
|
2021-12-28 14:02:29 +00:00
|
|
|
})
|