svgedit/cypress/integration/ui/scenario.js

164 lines
5.3 KiB
JavaScript
Raw Normal View History

2020-09-12 23:32:13 +00:00
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
const testSnapshot = () => {
2020-10-16 21:59:30 +00:00
cy.get('#svgcontent').cleanSnapshot();
};
2020-09-12 23:32:13 +00:00
describe('use various parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
it('check tool_source', function () {
cy.get('#tool_source').click({force: true});
2020-09-12 23:32:13 +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>
<rect id="rect" fill="#FF0000" height="70" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
</g>
Refactor canvas in multiple pieces to increase maintainability (#446) * #refactor-canvas getJsonFromSvgElement and svgroot code moved to separate file * #refactor-canvas build files changes * #refactor-canvas addSVGElementsFromJson move to json file * #refactor-canvas selected element option function move separate file * #refactor-canvas moveUpDownSelected move to select-elem * ##refactor-canvas build file updated * #refactor-canvas moveSelectedElements move to selected-elem * #refactor-canvas cloneSelectedElements move to slected-elem * #refactor-canvas alignSelectedElements move to selected-elem * #refactor-canvas deleteSelectedElements move to selected-elem * #refactor-canvas copySelectedElements and groupSelectedElements move to selected-elem * #refactor-canvas pushGroupProperty, ungroupSelectedElement move to selected-elem * #refactor-canvas comment changes * #refactor-canvas UndoManager move to separate file * #refactor-canvas event file move to mouseMove, mouseUpEvent and dblClickEvent * #refactor-canvas mouseDown move to event * #refactor-canvas move to undo file * #refactor alignment changes and set function revert return * #refactor-canvas textaction move to separate file * #refactor-canvas paste-element function move to separate file * #refactor-canvas set and get method move to separate file * #refactor-canvas set and get function moved changes * #refactor clear file import and regaring function moved changes changes * #refactor-canvas svg related function move to separate file * #refactor-canvas setBackground methos move to elem-get-set file * #refactor-canvas getBsplinePoint method move to event file * #refactor-canvas export functions move to svg-exec * #refactor-canvas svg related function moved separate file * #refactor-canvas updateCanvas, cycleElement move to selected-elem file * #refactor-canvas removeUnusedDefElems move to svg-exec file * #refactor-canvas blur method move to separate file blur-event.js * #refactor-canvas selection related function move to separate file slection.js * #refactor-canvas convertGradients, mousewheelmove event bind function move to other files * #refactor-canvas extension function move to selection file * #refactor-canvas svg tag long string changes to es6 format * eslint fixes * eslint and test fixes * add netlify logo per their requirements * #refactor-canvas path file separate to path-method.js and path-actions.js * #refactor-canvas lint issue fixed * #refactor-canvas path.js file class and const move to path-method.js * #refactor-canvas eslint issue fixed. 'jsdoc/check-examples': 'off' already so removed eslint-disable jsdoc/check-examples * #refactor-canvas path class moved changes and copy-elem.js file cypress test issue fixed * #refactor-canvas UI - Clipboard paste element cypress issue fixed * #refactor-canvas cypress test cases issue fixed changes * #refactor-canvas cypress test cases issue fixed changes * #refactor-canvas cypress test case issue fixed * npm update and fix a few eslint new errors * fix snapshot and run tests * add star tool to cypress * #refactor-canvas shapelibrary, star, polygon and panning tool issue fixed * build * Update layer.js * revert proper declarations Authored-by OptimistikSAS
2020-11-11 10:38:45 +00:00
</svg>`, {force: true, parseSpecialCharSequences: false});
cy.get('#tool_source_save').click({force: true});
testSnapshot();
2020-09-12 23:32:13 +00:00
});
it('check tool_fhpath', function () {
cy.get('#tool_fhpath')
.click({force: true});
cy.get('#rect')
.trigger('mousemove', 200, 200, {force: true})
.trigger('mousedown', 200, 200, {force: true})
.trigger('mousemove', 20, 20, {force: true})
2020-09-12 23:32:13 +00:00
.trigger('mouseup', {force: true});
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_text', function () {
cy.get('#tool_text')
.click({force: true});
cy.get('#rect')
.trigger('mousedown', 'center', {force: true})
.trigger('mouseup', {force: true});
2020-09-12 23:32:13 +00:00
// svgedit use the #text text field to capture the text
// cy.get('#text').type('1234', {force: true});
cy.get('#text').type('B', {force: true});
testSnapshot();
});
it('check tool_clone', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_clone')
.click({force: true});
testSnapshot();
});
it('check tool_italic', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_italic')
.click({force: true});
testSnapshot();
});
it('check tool_bold', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_bold')
.click({force: true});
testSnapshot();
2020-09-12 23:32:13 +00:00
});
2020-09-21 22:18:52 +00:00
it('check change color', function () {
cy.get('#svg_1').click({force: true});
cy.get('[data-rgb="#ffff00"]')
.click({force: true});
testSnapshot();
});
2020-12-08 09:37:48 +00:00
it('check tool_text_anchor_start', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_anchor_start')
.click({force: true});
testSnapshot();
});
it('check tool_text_anchor_middle', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_anchor_middle')
.click({force: true});
testSnapshot();
});
it('check tool_text_anchor_end', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_anchor_end')
.click({force: true});
testSnapshot();
});
it('check tool_text_decoration_underline', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_decoration_underline')
.click({force: true});
testSnapshot();
});
it('check tool_text_decoration_overline', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_decoration_overline')
.click({force: true});
testSnapshot();
});
it('check tool_text_decoration_linethrough', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_text_decoration_linethrough')
.click({force: true});
testSnapshot();
});
it('check tool_letter_spacing', function () {
cy.get('#svg_1').click({force: true});
cy.get('#letter_spacing')
.type('{selectall}', {force: true})
.type('150', {force: true})
.type('{enter}', {force: true});
testSnapshot();
});
it('check tool_word_spacing', function () {
cy.get('#svg_1').click({force: true});
cy.get('#word_spacing')
.type('{selectall}', {force: true})
.type('10', {force: true})
.type('{enter}', {force: true});
testSnapshot();
});
it('check tool_text_length', function () {
cy.get('#svg_1').click({force: true});
cy.get('#text_length')
.type('{selectall}', {force: true})
.type('600', {force: true})
.type('{enter}', {force: true});
testSnapshot();
});
it('check tool_length_adjust_spacing', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_length_adjust_spacing')
.click({force: true});
testSnapshot();
});
it('check tool_length_adjust_spacingAndGlyphs', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_length_adjust_spacingAndGlyphs')
.click({force: true});
testSnapshot();
});
it('check tool_star', function () {
cy.get('#tool_star')
.click({force: true});
cy.get('#svgcontent')
.trigger('mousedown', {which: 1, pageX: 600, pageY: 150, force: true})
.trigger('mousemove', {which: 1, pageX: 600, pageY: 170, force: true})
.trigger('mouseup', {force: true});
cy.get('#svgcontent').toMatchSnapshot();
});
it('check tool_polygon', function () {
cy.get('#tool_polygon')
.click({force: true});
cy.get('#svgcontent')
.trigger('mousedown', {which: 1, pageX: 650, pageY: 200, force: true})
.trigger('mousemove', {which: 1, pageX: 650, pageY: 210, force: true})
.trigger('mouseup', {force: true});
cy.get('#svgcontent').toMatchSnapshot();
});
2020-09-12 23:32:13 +00:00
});