#623 tool text cypress test cases added

This commit is contained in:
agriyadev5
2021-08-27 16:34:07 +05:30
parent 92ec863fbc
commit a905f02c76
2 changed files with 664 additions and 312 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,6 @@ describe('use various parts of svg-edit', function () {
.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>
<rect id="rect" fill="#FF0000" height="70" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click({ force: true });
@@ -27,7 +26,7 @@ describe('use various parts of svg-edit', function () {
it('check tool_fhpath', function () {
cy.get('#tool_fhpath')
.click({ force: true });
cy.get('#rect')
cy.get('#svgcontent')
.trigger('mousemove', 200, 200, { force: true })
.trigger('mousedown', 200, 200, { force: true })
.trigger('mousemove', 20, 20, { force: true })
@@ -37,7 +36,7 @@ describe('use various parts of svg-edit', function () {
it('check tool_text', function () {
cy.get('#tool_text')
.click({ force: true });
cy.get('#rect')
cy.get('#svgcontent')
.trigger('mousedown', 46, 35, { force: true })
.trigger('mouseup', { force: true });
// svgedit use the #text text field to capture the text
@@ -63,11 +62,64 @@ describe('use various parts of svg-edit', function () {
.click({ force: true });
testSnapshot();
});
it('check change color', function () {
it('check tool_text_change_x_y_coordinate', function () {
cy.get('#svg_2').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_text_change_font_size', function () {
cy.get('#svg_1').click({ force: true });
cy.get('[data-rgb="#ffff00"]')
for(let n = 0; n < 10; n ++){
cy.get('#font_size').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
}
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_text_change_font_family', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#tool_font_family').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened');
cy.get('#tool_font_family').find('se-list-item').eq(2).shadow().find('elix-option').eq(0)
.click({ force: true });
testSnapshot();
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_text_change_stroke_width', function () {
cy.get('#svg_1').click({ force: true });
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_text_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_text_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_text_anchor_start', function () {
cy.get('#svg_1').click({ force: true });
@@ -87,22 +139,60 @@ describe('use various parts of svg-edit', function () {
.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_text_change_rotation', function () {
cy.get('#svg_2').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_polygon', function () {
cy.get('#tool_polygon')
it('check tool_text_change_blur', function () {
cy.get('#svg_2').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_text_change_opacity', function () {
cy.get('#svg_2').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_text_align_to_page', function () {
cy.get('#svg_2').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(2).shadow().find('elix-option').eq(0)
.click({ force: true });
cy.get('#svgcontent')
.trigger('mousedown', 350, 250, { force: true })
.trigger('mousemove', 350, 370, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_text_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_text_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_text_delete', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_delete').click({ force: true });
cy.get('#svgcontent').toMatchSnapshot();
});
});