diff --git a/cypress/integration/ui/__snapshots__/scenario1.js.snap b/cypress/integration/ui/__snapshots__/scenario1.js.snap index ee4d81cd..5a8ea21f 100644 --- a/cypress/integration/ui/__snapshots__/scenario1.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario1.js.snap @@ -14,44 +14,6 @@ exports[`use all parts of svg-edit > check tool_source_set #0`] = ` `; -exports[`use all parts of svg-edit > check tool_line #0`] = ` - - - Layer 1 - - - - - -`; - exports[`use all parts of svg-edit > check tool_shape #0`] = ` check tool_shape #0`] = ` > Layer 1 - - - - - - -`; - -exports[`use all parts of svg-edit > check tool_rect_square #0`] = ` - - - Layer 1 - - - - - - - - - - `; @@ -217,75 +57,23 @@ exports[`use all parts of svg-edit > check tool_image #0`] = ` > Layer 1 - - - - check tool_source_set #0`] = ` + + Layer 1 + +`; + +exports[`use all parts of svg-edit > check tool_star #0`] = ` + + + Layer 1 + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_clone #0`] = ` + + + Layer 1 + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_rotation #0`] = ` + + + Layer 1 + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_blur #0`] = ` + + + Layer 1 + + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_opacity #0`] = ` + + + Layer 1 + + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_bring_to_back #0`] = ` + + + Layer 1 + + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_bring_to_front #0`] = ` + + + Layer 1 + + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_delete #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_align_to_page #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_stroke_width #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_stroke_style #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_line_cap #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_stoke_fill_color #0`] = ` + + + Layer 1 + + + + + + + + +`; + +exports[`use all parts of svg-edit > check tool_star_change_sides #0`] = ` + + + Layer 1 + + + + + + + + +`; diff --git a/cypress/integration/ui/scenario1.js b/cypress/integration/ui/scenario1.js index 9813aed0..a6567cc0 100644 --- a/cypress/integration/ui/scenario1.js +++ b/cypress/integration/ui/scenario1.js @@ -23,18 +23,6 @@ describe('use all parts of svg-edit', function () { cy.get('#tool_source_save').click({ force: true }); testSnapshot(); }); - it('check tool_line', function () { - cy.get('#tool_line') - .click({ force: true }); - cy.get('#svgcontent') - .trigger('mousemove', 200, 200, { force: true }) - .trigger('mousedown', 200, 200, { force: true }) - .trigger('mousemove', 20, 20, { force: true }) - .trigger('mouseup', { force: true }); - // cy.get('#angle').click({ force: true }).invoke('attr', 'value', '45'); - //.shadow().get('elix-number-spin-box').shadow().find('plain-repeat-button-0').click({ force: true }); - cy.get('#svgcontent').toMatchSnapshot(); - }); it('check tool_shape', function () { cy.get('#tool_shapelib').shadow().find('.overall').eq(0).click({ force: true }); cy.get('[data-shape="heart"]').click({ force: true }); @@ -49,30 +37,7 @@ describe('use all parts of svg-edit', function () { .trigger('mouseup', { force: true }); cy.get('#svgcontent').toMatchSnapshot(); }); - it('check tool_rect_square', function () { - cy.get('#tool_rect').click({ force: true }); - cy.get('#svgcontent') - .trigger('mousedown', 100, -60, { force: true }) - .trigger('mousemove', 250, 60, { force: true }) - .trigger('mouseup', { force: true }); - cy.get('#tool_square').click({ force: true }); - cy.get('#svgcontent') - .trigger('mousedown', 250, -60, { force: true }) - .trigger('mousemove', 430, 120, { force: true }) - .trigger('mouseup', { force: true }); - cy.get('#tool_fhrect') - .click({ force: true }); - cy.get('#svgcontent') - .trigger('mousedown', 20, 80, { force: true }) - .trigger('mousemove', 120, 80, { force: true }) - .trigger('mousemove', 120, 180, { force: true }) - .trigger('mousemove', 20, 180, { force: true }) - .trigger('mousemove', 20, 80, { force: true }) - .trigger('mouseup', 20, 80, { force: true }); - cy.get('#svgcontent').toMatchSnapshot(); - }); it('check tool_image', function () { - cy.get('#tool_image').click({ force: true }); cy.get('#svgcontent') .trigger('mousedown', 100, 100, { force: true }) @@ -87,5 +52,4 @@ describe('use all parts of svg-edit', function () { }); cy.get('#svgcontent').toMatchSnapshot(); }); - }); diff --git a/cypress/integration/ui/scenario7.js b/cypress/integration/ui/scenario7.js new file mode 100644 index 00000000..1ea808dc --- /dev/null +++ b/cypress/integration/ui/scenario7.js @@ -0,0 +1,164 @@ +import { + visitAndApproveStorage +} from '../../support/ui-test-helper.js'; + +const testSnapshot = () => { + cy.get('#svgcontent').cleanSnapshot(); +}; + +describe('use all parts of svg-edit', function () { + before(() => { + visitAndApproveStorage(); + }); + + it('check tool_source_set', function () { + cy.get('#tool_source').click({ force: true }); + cy.get('#svg_source_textarea') + .type('{selectall}', { force: true }) + .type(` + + Layer 1 + + `, { force: true, parseSpecialCharSequences: false }); + cy.get('#tool_source_save').click({ force: true }); + testSnapshot(); + }); + it('check tool_star', function () { + cy.get('#tool_star') + .click({ force: true }); + cy.get('#svgcontent') + .trigger('mousedown', 300, 150, { force: true }) + .trigger('mousemove', 300, 250, { force: true }) + .trigger('mouseup', { force: true }); + testSnapshot(); + }); + it('check tool_star_clone', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#tool_clone').click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_class', function () { + cy.get('#svg_2').click({ force: true }); + cy.get('#elem_class').shadow().find('elix-input').eq(0).shadow().find('#inner').eq(0) + .type('svg_2_class{enter}', { force: true }); + cy.get('#svg_2') + .should('satisfy', ($el) => { + const classList = Array.from($el[0].classList); + return classList.includes('svg_2_class'); + }); + }); + it('check tool_star_change_id', function () { + cy.get('#svg_2').click({ force: true }).click({ force: true }); + cy.get('#elem_id').shadow().find('elix-input').eq(0).shadow().find('#inner').eq(0) + .type('_id{enter}', { force: true }); + cy.get('#svg_2_id') + .should('satisfy', ($el) => { + const classList = Array.from($el[0].classList); + return classList.includes('svg_2_class'); + }); + }); + it('check tool_star_change_rotation', function () { + cy.get('#svg_2_id').click({ force: true }); + for(let n = 0; n < 5; n ++){ + cy.get('#angle').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + } + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_blur', function () { + cy.get('#svg_2_id').click({ force: true }); + for(let n = 0; n < 10; n ++){ + cy.get('#blur').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + } + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_opacity', function () { + cy.get('#svg_2_id').click({ force: true }); + for(let n = 0; n < 10; n ++){ + cy.get('#opacity').shadow().find('elix-number-spin-box').eq(0).shadow().find('#downButton').eq(0) + .click({ force: true }); + } + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_bring_to_back', function () { + cy.get('#svg_2_id').click({ force: true }); + cy.get('#tool_move_bottom').click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_bring_to_front', function () { + cy.get('#svg_2_id').click({ force: true }); + cy.get('#tool_move_top').click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_delete', function () { + cy.get('#svg_2_id').click({ force: true }); + cy.get('#tool_delete').click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_align_to_page', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#tool_position').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened'); + cy.get('#tool_position').find('se-list-item').eq(0).shadow().find('elix-option').eq(0) + .click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + /* it('check tool_star_change_x_y_coordinate', function () { + cy.get('#svg_1').click({ force: true }); + for(let n = 0; n < 25; n ++){ + cy.get('#selected_x').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + } + for(let n = 0; n < 25; n ++){ + cy.get('#selected_y').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + } + cy.get('#svgcontent').toMatchSnapshot(); + }); */ + it('check tool_star_change_stroke_width', function () { + cy.get('#svg_1').click({ force: true }); + for(let n = 0; n < 10; n ++){ + cy.get('#stroke_width').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + } + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_stroke_style', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#stroke_style').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened'); + cy.get('#stroke_style').find('se-list-item').eq(3).shadow().find('elix-option').eq(0) + .click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_line_cap', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#stroke_linecap').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened'); + cy.get('#stroke_linecap').find('se-list-item').eq(1).shadow().find('elix-option').eq(0) + .click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_stoke_fill_color', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#stroke_color').shadow().find('#picker').eq(0).click({ force: true }); + cy.get('#stroke_color').shadow().find('#color_picker').eq(0) + .find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0) + .find('.QuickColor').eq(51).click({ force: true }); + cy.get('#stroke_color').shadow().find('#color_picker').eq(0) + .find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0) + .find('#Ok').eq(0).click({ force: true }); + cy.get('#fill_color').shadow().find('#picker').eq(0).click({ force: true }); + cy.get('#fill_color').shadow().find('#color_picker').eq(0) + .find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0) + .find('.QuickColor').eq(3).click({ force: true }); + cy.get('#fill_color').shadow().find('#color_picker').eq(0) + .find('#jGraduate_colPick').eq(0).find('#jPicker-table').eq(0) + .find('#Ok').eq(0).click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); + it('check tool_star_change_sides', function () { + cy.get('#svg_1').click({ force: true }); + cy.get('#starNumPoints').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0) + .click({ force: true }); + cy.get('#svgcontent').toMatchSnapshot(); + }); +});