#623 path cypress test cases

master
agriyadev5 2021-08-25 20:26:30 +05:30
parent ae4610edfb
commit fcca6c46f5
2 changed files with 258 additions and 0 deletions

View File

@ -0,0 +1,158 @@
exports[`use all parts of svg-edit > check tool_source_set #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer"><title>Layer 1</title></g>
</svg>
`;
exports[`use all parts of svg-edit > check tool_path #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<path
fill="#FF0000"
stroke="#000000"
stroke-width="5"
opacity="0.5"
style="pointer-events:inherit"
d="M 50 50 L 150 100 L 125 200 L 50 50 z"
id="svg_1"
>
<animate
attributeName="opacity"
begin="indefinite"
dur="0.2"
fill="freeze"
to="1"
></animate>
</path>
</g>
</svg>
`;
exports[`use all parts of svg-edit > check tool_path_change_node_xy #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<path
fill="#FF0000"
stroke="#000000"
stroke-width="5"
d="M75,75L150,100L125,200L75,75z"
id="svg_1"
fill-opacity="1"
stroke-opacity="1"
></path>
</g>
</svg>
`;
exports[`use all parts of svg-edit > check tool_path_change_seg_type #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<path
fill="#FF0000"
stroke="#000000"
stroke-width="5"
d="M75,75L150,100L125,200C235.33333,330.33333 91.66667,116.66667 75,75z"
id="svg_1"
fill-opacity="1"
stroke-opacity="1"
></path>
</g>
</svg>
`;
exports[`use all parts of svg-edit > check tool_path_change_clone_node #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<path
fill="#FF0000"
stroke="#000000"
stroke-width="5"
d="M201,246L150,100L125,200C180.16666,265.16666 297.83333,415.33333 273.625,373C249.41667,330.66667 209.33334,266.83334 201,246z"
id="svg_1"
fill-opacity="1"
stroke-opacity="1"
></path>
</g>
</svg>
`;
exports[`use all parts of svg-edit > check tool_path_openclose #0`] = `
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
width="640"
height="480"
id="svgcontent"
overflow="visible"
x="640"
y="480"
viewBox="0 0 640 480"
>
<g class="layer" style="pointer-events:all">
<title style="pointer-events:inherit">Layer 1</title>
<path
fill="#FF0000"
stroke="#000000"
stroke-width="5"
d="M201,246L150,100L125,200C180.16666,265.16666 297.83333,415.33333 273.625,373C249.41667,330.66667 209.33334,266.83334 201,246z"
id="svg_1"
fill-opacity="1"
stroke-opacity="1"
></path>
</g>
</svg>
`;

View File

@ -0,0 +1,100 @@
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(`<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>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click({ force: true });
testSnapshot();
});
it('check tool_path', function () {
cy.get('#tool_path')
.click({ force: true });
cy.get('#svgcontent')
.trigger('mousedown', 50, 50, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 100, 50, { force: true })
.trigger('mousedown', 100, 50, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 75, 150, { force: true })
.trigger('mousedown', 75, 150, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 0, 0, { force: true })
.trigger('mousedown', 0, 0, { force: true })
.trigger('mouseup', { force: true });
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_path_change_node_xy', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').dblclick({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#path_node_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('#path_node_y').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
}
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_path_change_seg_type', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').dblclick({ force: true });
cy.get('#seg_type').select('6').should('have.value', '6');
cy.get('#ctrlpointgrip_3c1')
.trigger('mousedown', { force: true })
.trigger('mousemove', 130, 175, { force: true })
.trigger('mouseup', { force: true });
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_path_change_clone_node', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').dblclick({ force: true });
cy.get('#tool_node_clone').click({ force: true });
cy.get('#pathpointgrip_4')
.trigger('mousedown', { force: true })
.trigger('mousemove', 130, 175, { force: true })
.trigger('mouseup', { force: true });
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_path_openclose', function () {
cy.get('#tool_select').click({ force: true });
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').dblclick({ force: true });
cy.get('#tool_openclose_path').click({ force: true });
cy.get('#svgcontent').toMatchSnapshot();
});
/* it('check tool_path_add_subpath', function () {
cy.get('#tool_add_subpath').click({ force: true });
cy.get('#svgcontent')
.trigger('mousedown', 0, 0, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 100, 50, { force: true })
.trigger('mousedown', 100, 50, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 75, 150, { force: true })
.trigger('mousedown', 75, 150, { force: true })
.trigger('mouseup', { force: true })
.trigger('mousemove', 0, 0, { force: true })
.trigger('mousedown', 0, 0, { force: true })
.trigger('mouseup', { force: true });
cy.get('#tool_select').click({ force: true });
cy.get('#svgcontent').toMatchSnapshot();
}); */
});