move to standard linter for simpler configuration

This commit is contained in:
JFH
2021-12-28 11:02:29 -03:00
parent 258e2bd6a1
commit fdcfc8a253
251 changed files with 19760 additions and 19935 deletions

View File

@@ -1,14 +1,14 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
describe('UI - Clipboard', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('Editor - Copy and paste', () => {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
@@ -17,47 +17,47 @@ describe('UI - Clipboard', function () {
<title>Layer 1</title>
<circle cx="100" cy="100" r="50" fill="#FF0000" id="testCircle" stroke="#000000" stroke-width="5"/>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click();
cy.get('#testCircle').should('exist');
cy.get('#svg_1').should('not.exist');
cy.get('#svg_2').should('not.exist');
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click()
cy.get('#testCircle').should('exist')
cy.get('#svg_1').should('not.exist')
cy.get('#svg_2').should('not.exist')
// Copy.
cy.get('#testCircle').click().rightclick();
cy.get('#cmenu_canvas a[href="#copy"]').click({ force: true });
cy.get('#testCircle').click().rightclick()
cy.get('#cmenu_canvas a[href="#copy"]').click({ force: true })
// Paste.
// Scrollbars fail to recenter in Cypress test. Works fine in reality.
// Thus forcing click is needed since workspace is mostly offscreen.
cy.get('#svgroot').rightclick({ force: true });
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true });
cy.get('#testCircle').should('exist');
cy.get('#svg_1').should('exist');
cy.get('#svg_2').should('not.exist');
cy.get('#svgroot').rightclick({ force: true })
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true })
cy.get('#testCircle').should('exist')
cy.get('#svg_1').should('exist')
cy.get('#svg_2').should('not.exist')
// Cut.
cy.get('#testCircle').click().rightclick();
cy.get('#cmenu_canvas a[href="#cut"]').click({ force: true });
cy.get('#testCircle').should('not.exist');
cy.get('#svg_1').should('exist');
cy.get('#svg_2').should('not.exist');
cy.get('#testCircle').click().rightclick()
cy.get('#cmenu_canvas a[href="#cut"]').click({ force: true })
cy.get('#testCircle').should('not.exist')
cy.get('#svg_1').should('exist')
cy.get('#svg_2').should('not.exist')
// Paste.
// Scrollbars fail to recenter in Cypress test. Works fine in reality.
// Thus forcing click is needed since workspace is mostly offscreen.
cy.get('#svgroot').rightclick({ force: true });
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true });
cy.get('#testCircle').should('not.exist');
cy.get('#svg_1').should('exist');
cy.get('#svg_2').should('exist');
cy.get('#svgroot').rightclick({ force: true })
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true })
cy.get('#testCircle').should('not.exist')
cy.get('#svg_1').should('exist')
cy.get('#svg_2').should('exist')
// Delete.
cy.get('#svg_2').click().rightclick();
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true });
cy.get('#svg_1').click().rightclick();
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true });
cy.get('#svg_1').should('not.exist');
cy.get('#svg_2').should('not.exist');
});
});
cy.get('#svg_2').click().rightclick()
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true })
cy.get('#svg_1').click().rightclick()
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true })
cy.get('#svg_1').should('not.exist')
cy.get('#svg_2').should('not.exist')
})
})

View File

@@ -1,15 +1,15 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
describe('UI - Control Points', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('Editor - No parameters: Drag control point of arc path', () => {
const randomOffset = () => 2 + Math.round(10 + Math.random() * 40);
cy.get('#tool_source').click();
const randomOffset = () => 2 + Math.round(10 + Math.random() * 40)
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@@ -17,18 +17,18 @@ describe('UI - Control Points', function () {
<title>Layer 1</title>
<path d="m187,194a114,62 0 1 0 219,2" id="svg_1" fill="#FF0000" stroke="#000000" stroke-width="5"/>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click({ force: true });
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
cy.get('#svg_1').click({ force: true }).click({ force: true });
cy.get('#svg_1').click({ force: true }).click({ force: true })
cy.get('#pathpointgrip_0').trigger('mousedown', { which: 1, force: true })
.trigger('mousemove', randomOffset(), randomOffset(), { force: true })
.trigger('mouseup', { force: true });
.trigger('mouseup', { force: true })
cy.get('#pathpointgrip_1').trigger('mousedown', { which: 1, force: true })
.trigger('mousemove', randomOffset(), randomOffset(), { force: true })
.trigger('mouseup', { force: true });
.trigger('mouseup', { force: true })
cy.get('#svg_1[d]').should('not.contain', 'NaN');
});
});
cy.get('#svg_1[d]').should('not.contain', 'NaN')
})
})

View File

@@ -1,20 +1,20 @@
import {
visitAndApproveStorage, openMainMenu
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
describe('UI - Export tests', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('Editor - No parameters: Has export button', () => {
openMainMenu();
cy.get('#tool_export');
});
openMainMenu()
cy.get('#tool_export')
})
it('Editor - No parameters: Export button clicking; dialog opens', () => {
openMainMenu();
cy.get('#tool_export').click({ force: true });
cy.get('#dialog_content select');
});
});
openMainMenu()
cy.get('#tool_export').click({ force: true })
cy.get('#dialog_content select')
})
})

View File

@@ -1,15 +1,15 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/359
describe('Fix issue 359', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('can undo without throwing', function () {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@@ -17,10 +17,10 @@ describe('Fix issue 359', function () {
<title>Layer 1</title>
<rect fill="#ffff00" height="70" width="165" x="179.5" y="146.5"/>
</g>
</svg>`, { parseSpecialCharSequences: false, force: true });
cy.get('#tool_source_save').click();
cy.get('#tool_undo').click();
cy.get('#tool_redo').click(); // test also redo to make the test more comprehensive
</svg>`, { parseSpecialCharSequences: false, force: true })
cy.get('#tool_source_save').click()
cy.get('#tool_undo').click()
cy.get('#tool_redo').click() // test also redo to make the test more comprehensive
// if the undo throws an error to the console, the test will fail
});
});
})
})

View File

@@ -1,15 +1,15 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/407
describe('Fix issue 407', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('can enter edit on text child', function () {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@@ -20,16 +20,16 @@ describe('Fix issue 407', function () {
<text fill="#000000" id="a_text" text-anchor="middle" x="260.5" xml:space="preserve" y="192.5">hello</text>
</g>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click();
cy.get('#svg_1').click().dblclick();
cy.get('#a_text').should('exist');
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click()
cy.get('#svg_1').click().dblclick()
cy.get('#a_text').should('exist')
cy.get('#a_text')
.trigger('mousedown', { which: 1, force: true })
.trigger('mouseup', { force: true })
.dblclick({ force: true });
.dblclick({ force: true })
// svgedit use the #text text field to capture the text
cy.get('#text').type('1234', { force: true });
cy.get('#a_text').should('have.text', 'he1234llo');
});
});
cy.get('#text').type('1234', { force: true })
cy.get('#a_text').should('have.text', 'he1234llo')
})
})

View File

@@ -1,15 +1,15 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/408
describe('Fix issue 408', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('should not throw when showing/saving svg content', function () {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
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">
@@ -20,10 +20,10 @@ describe('Fix issue 408', function () {
<circle cx="117.5" cy="87.5" fill="#ffff00" r="19.84943" stroke="#000000" />
</g>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click();
cy.get('#svg_6').click().dblclick(); // change context
cy.get('#tool_source').click(); // reopen tool_source
cy.get('#tool_source_save').should('exist'); // The save button should be here if it does not throw
});
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click()
cy.get('#svg_6').click().dblclick() // change context
cy.get('#tool_source').click() // reopen tool_source
cy.get('#tool_source_save').should('exist') // The save button should be here if it does not throw
})
})

View File

@@ -1,15 +1,15 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/423
describe('Fix issue 423', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('should not throw when undoing the move', function () {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
@@ -22,12 +22,12 @@ describe('Fix issue 423', function () {
<rect clip-path="url(#svg_2)" fill="#0033b5" height="174.9" id="TANK1" width="78" x="77.5" y="29"/>
</g>
</g>
</svg>`, { parseSpecialCharSequences: false, force: true });
cy.get('#tool_source_save').click({ force: true });
</svg>`, { parseSpecialCharSequences: false, force: true })
cy.get('#tool_source_save').click({ force: true })
cy.get('#TANK1')
.trigger('mousedown', { force: true })
.trigger('mousemove', 50, 0, { force: true })
.trigger('mouseup', { force: true });
cy.get('#tool_undo').click({ force: true });
});
});
.trigger('mouseup', { force: true })
cy.get('#tool_undo').click({ force: true })
})
})

View File

@@ -1,16 +1,16 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
} from '../../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/660
describe('Fix issue 660', function () {
beforeEach(() => {
visitAndApproveStorage();
cy.viewport(512, 512);
});
visitAndApproveStorage()
cy.viewport(512, 512)
})
/** @todo: reenable this test when we understand why it is passing locally but not on ci */
it.skip('can resize text', function () {
cy.get('#tool_source').click();
cy.get('#tool_source').click()
cy.get('#svg_source_textarea')
.type('{selectall}', { force: true })
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@@ -18,18 +18,18 @@ describe('Fix issue 660', function () {
<title>Layer 1</title>
<text fill="#000000" id="a_text" text-anchor="middle" x="260.5" xml:space="preserve" y="192.5" font-size="40">hello</text>
</g>
</svg>`, { force: true, parseSpecialCharSequences: false });
cy.get('#tool_source_save').click({ force: true });
cy.get('#a_text').should('exist');
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
cy.get('#a_text').should('exist')
cy.get('#a_text')
.trigger('mousedown', { which: 1, force: true })
.trigger('mouseup', { force: true });
.trigger('mouseup', { force: true })
cy.get('#selectorGrip_resize_s')
.trigger('mousedown', { which: 1, force: true })
.trigger('mousemove', { clientX: 0, clientY: 600 })
.trigger('mouseup', { force: true });
.trigger('mouseup', { force: true })
// svgedit use the #text text field to capture the text
cy.get('#a_text').should('have.attr', 'transform')
.and('equal', 'matrix(1 0 0 4.54639 0 -540.825)'); // Chrome 96 is matrix(1 0 0 4.17431 0 -325.367)
});
});
.and('equal', 'matrix(1 0 0 4.54639 0 -540.825)') // Chrome 96 is matrix(1 0 0 4.17431 0 -325.367)
})
})

View File

@@ -1,14 +1,14 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
// See https://github.com/SVG-Edit/svgedit/issues/364
describe('Key commands', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it.skip('cmd-A on empty canvas should not cause an error', function () {
cy.get('body').type('{cmd}a');
});
});
cy.get('body').type('{cmd}a')
})
})

View File

@@ -1,190 +1,188 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use various parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_fhpath', function () {
cy.get('#tool_fhpath')
.click({ force: true });
.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 });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_text', function () {
cy.get('#tool_text')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 46, 35, { force: true })
.trigger('mouseup', { force: true });
.trigger('mousedown', 46, 35, { force: true })
.trigger('mouseup', { force: true })
// svgedit use the #text text field to capture the text
cy.get('#text').type('AB', { force: true });
testSnapshot();
});
cy.get('#text').type('AB', { force: true })
testSnapshot()
})
it('check tool_clone', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_clone')
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_italic', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_italic')
.click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500);
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_bold', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_bold')
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
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('#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 });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_text_change_font_size', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_1').click({ force: true })
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_text_change_stroke_width', function () {
cy.get('#svg_1').click({ force: true });
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 });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
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('#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 });
.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 });
.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 });
.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 });
testSnapshot();
});
.find('#Ok').eq(0).click({ force: true })
testSnapshot()
})
it('check tool_text_anchor_start', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_anchor_start')
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_text_anchor_middle', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_anchor_middle')
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_text_anchor_end', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#tool_text_anchor_end')
.click({ force: true });
testSnapshot();
});
.click({ 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('#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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_text_change_blur', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_text_change_opacity', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
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('#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 });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_text_change_class', function () {
cy.get('#svg_2').click({ force: true });
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 });
.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');
});
});
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('#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 });
.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');
});
});
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 });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
})
it('check tool_text_change_font_family', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#tool_font_family').shadow().find('select').select("Serif");
testSnapshot();
});
});
cy.get('#svg_1').click({ force: true })
cy.get('#tool_font_family').shadow().find('select').select('Serif')
testSnapshot()
})
})

View File

@@ -1,55 +1,55 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
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 });
cy.get('#tool_shapelib').shadow().find('.overall').eq(0).click({ force: true })
cy.get('[data-shape="heart"]').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 });
.trigger('mouseup', { force: true })
cy.get('#selectorGrip_rotate')
.trigger('mousedown')
.trigger('mousemove', 20, 20, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_image', function () {
cy.get('#tool_image').click({ force: true });
cy.get('#tool_image').click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 100, 100, { force: true })
.trigger('mousemove', 120, 120, { force: true })
.trigger('mouseup', { force: true });
.trigger('mouseup', { force: true })
// eslint-disable-next-line promise/catch-or-return
cy.window()
// eslint-disable-next-line promise/always-return
.then(($win) => {
cy.stub($win, 'prompt').returns('./images/logo.svg');
cy.contains('OK');
});
testSnapshot();
});
});
cy.stub($win, 'prompt').returns('./images/logo.svg')
cy.contains('OK')
})
testSnapshot()
})
})

View File

@@ -1,124 +1,124 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_circle', function () {
cy.get('#tool_circle')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 150, 150, { force: true })
.trigger('mousemove', 250, 200, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_fhellipse', function () {
cy.get('#tool_fhellipse')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 200, 80, { force: true })
.trigger('mousemove', 320, 80, { force: true })
.trigger('mousemove', 320, 180, { force: true })
.trigger('mousemove', 200, 180, { force: true })
.trigger('mousemove', 200, 80, { force: true })
.trigger('mouseup', 200, 80, { force: true });
testSnapshot();
});
.trigger('mouseup', 200, 80, { force: true })
testSnapshot()
})
it('check tool_ellipse', function () {
cy.get('#tool_ellipse').click({ force: true });
cy.get('#tool_ellipse').click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 75, 150, { force: true })
.trigger('mousemove', 130, 175, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_circle_change_fill_color', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#svg_2').click({ force: true })
cy.get('#js-se-palette').find('.square').eq(8)
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_circle_change_opacity', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_ellipse_change_rotation', function () {
cy.get('#svg_3').click({ force: true });
for(let n = 0; n < 5; n ++){
cy.get('#svg_3').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_ellipse_change_blur', function () {
cy.get('#svg_3').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_3').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_ellipse_change_cx_cy_coordinate', function () {
cy.get('#svg_3').click({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#svg_3').click({ force: true })
for (let n = 0; n < 25; n++) {
cy.get('#ellipse_cx').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#ellipse_cy').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_ellipse_change_rx_ry_radius', function () {
cy.get('#svg_3').click({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#svg_3').click({ force: true })
for (let n = 0; n < 25; n++) {
cy.get('#ellipse_rx').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#ellipse_ry').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_ellipse_bring_to_back', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_move_bottom').click({ force: true });
testSnapshot();
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_move_bottom').click({ force: true })
testSnapshot()
})
it('check tool_ellipse_bring_to_front', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_move_top').click({ force: true });
testSnapshot();
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_move_top').click({ force: true })
testSnapshot()
})
it('check tool_ellipse_clone', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_clone').click({ force: true });
testSnapshot();
});
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_clone').click({ force: true })
testSnapshot()
})
})

View File

@@ -1,31 +1,31 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</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 });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 50, 50, { force: true })
.trigger('mouseup', { force: true })
@@ -37,49 +37,49 @@ describe('use all parts of svg-edit', function () {
.trigger('mouseup', { force: true })
.trigger('mousemove', 0, 0, { force: true })
.trigger('mousedown', 0, 0, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
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('#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 });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
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').shadow().find('select').select('6').should('have.value', '6');
cy.get('#svg_1').click({ force: true })
cy.get('#svg_1').dblclick({ force: true })
cy.get('#seg_type').shadow().find('select').select('6').should('have.value', '6')
cy.get('#ctrlpointgrip_3c1')
.trigger('mousedown', { force: true })
.trigger('mousemove', 130, 175, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
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('#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 });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
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 });
testSnapshot();
});
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 })
testSnapshot()
})
/* it('check tool_path_add_subpath', function () {
cy.get('#tool_add_subpath').click({ force: true });
cy.get('#svgcontent')
@@ -97,4 +97,4 @@ describe('use all parts of svg-edit', function () {
cy.get('#tool_select').click({ force: true });
testSnapshot();
}); */
});
})

View File

@@ -1,164 +1,164 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_rect', function () {
cy.get('#tool_rect')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 150, 150, { force: true })
.trigger('mousemove', 250, 200, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_fhrect', function () {
cy.get('#tool_fhrect')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 200, 80, { force: true })
.trigger('mousemove', 320, 80, { force: true })
.trigger('mousemove', 320, 180, { force: true })
.trigger('mousemove', 200, 180, { force: true })
.trigger('mousemove', 200, 80, { force: true })
.trigger('mouseup', 200, 80, { force: true });
testSnapshot();
});
.trigger('mouseup', 200, 80, { force: true })
testSnapshot()
})
it('check tool_square', function () {
cy.get('#tool_square').click({ force: true });
cy.get('#tool_square').click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 75, 150, { force: true })
.trigger('mousemove', 125, 200, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_rect_change_fill_color', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#js-se-palette').find('.square').eq(8)
.click({ force: true });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_rect_change_rotation', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 5; n ++){
cy.get('#svg_1').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_rect_change_blur', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_1').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_rect_change_opacity', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_1').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_fhrect_change_x_y_coordinate', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 25; n ++){
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 });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_fhrect_change_width_height', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#svg_2').click({ force: true })
for (let n = 0; n < 25; n++) {
cy.get('#rect_width').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#rect_height').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_square_clone', function () {
cy.get('#svg_3').click({ force: true });
cy.get('#tool_clone').click({ force: true });
testSnapshot();
});
cy.get('#svg_3').click({ force: true })
cy.get('#tool_clone').click({ force: true })
testSnapshot()
})
it('check tool_square_bring_to_back', function () {
cy.get('#svg_3').click({ force: true });
cy.get('#tool_move_bottom').click({ force: true });
testSnapshot();
});
cy.get('#svg_3').click({ force: true })
cy.get('#tool_move_bottom').click({ force: true })
testSnapshot()
})
it('check tool_square_bring_to_front', function () {
cy.get('#svg_3').click({ force: true });
cy.get('#tool_move_top').click({ force: true });
testSnapshot();
});
cy.get('#svg_3').click({ force: true })
cy.get('#tool_move_top').click({ force: true })
testSnapshot()
})
it('check tool_square_change_corner_radius', function () {
cy.get('#svg_4').click({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#svg_4').click({ force: true })
for (let n = 0; n < 25; n++) {
cy.get('#rect_rx').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_rect_change_to_path', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_topath').click({ force: true });
testSnapshot();
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_topath').click({ force: true })
testSnapshot()
})
it('check tool_rect_delete', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#tool_delete').click({ force: true });
cy.get('#svg_3').click({ force: true });
cy.get('#tool_delete').click({ force: true });
testSnapshot();
});
cy.get('#svg_1').click({ force: true })
cy.get('#tool_delete').click({ force: true })
cy.get('#svg_3').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
})
it('check tool_rect_change_class', function () {
cy.get('#svg_2').click({ force: true });
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 });
.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');
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_2_class')
})
})
it('check tool_rect_change_id', function () {
cy.get('#svg_2').click({ force: true }).click({ force: true });
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 });
.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');
});
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_2_class')
})
})
})

View File

@@ -1,153 +1,153 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_line', function () {
cy.get('#tool_line')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousemove', 200, 200, { force: true })
.trigger('mousedown', 200, 200, { force: true })
.trigger('mousemove', 250, 250, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_line_change_class', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#elem_class').shadow().find('elix-input').eq(0).shadow().find('#inner').eq(0)
.type('svg_1_class{enter}', { force: true });
.type('svg_1_class{enter}', { force: true })
cy.get('#svg_1')
.should('satisfy', ($el) => {
const classList = Array.from($el[0].classList);
return classList.includes('svg_1_class');
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_1_class')
})
})
it('check tool_line_change_id', function () {
cy.get('#svg_1').click({ force: true }).click({ force: true });
cy.get('#svg_1').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 });
.type('_id{enter}', { force: true })
cy.get('#svg_1_id')
.should('satisfy', ($el) => {
const classList = Array.from($el[0].classList);
return classList.includes('svg_1_class');
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_1_class')
})
})
it('check tool_line_change_rotation', function () {
cy.get('#svg_1_id').click({ force: true });
for(let n = 0; n < 5; n ++){
cy.get('#svg_1_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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_line_change_blur', function () {
cy.get('#svg_1_id').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_1_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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_line_change_opacity', function () {
cy.get('#svg_1_id').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_1_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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_line_delete', function () {
cy.get('#svg_1_id').click({ force: true });
cy.get('#tool_delete').click({ force: true });
testSnapshot();
});
cy.get('#svg_1_id').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
})
it('check tool_line_clone', function () {
cy.get('#tool_line')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousemove', 200, 200, { force: true })
.trigger('mousedown', 200, 200, { force: true })
.trigger('mousemove', 250, 250, { force: true })
.trigger('mouseup', { force: true });
cy.get('#svg_2').click({ force: true });
cy.get('#tool_clone').click({ force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
cy.get('#svg_2').click({ force: true })
cy.get('#tool_clone').click({ force: true })
testSnapshot()
})
it('check tool_line_bring_to_back', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_move_bottom').click({ force: true });
testSnapshot();
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_move_bottom').click({ force: true })
testSnapshot()
})
it('check tool_line_bring_to_front', function () {
cy.get('#svg_2').click({ force: true });
cy.get('#tool_move_top').click({ force: true });
testSnapshot();
});
cy.get('#svg_2').click({ force: true })
cy.get('#tool_move_top').click({ force: true })
testSnapshot()
})
it('check tool_line_change_x_y_coordinate', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 25; n ++){
cy.get('#svg_2').click({ force: true })
for (let n = 0; n < 25; n++) {
cy.get('#line_x1').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#line_y1').shadow().find('elix-number-spin-box').eq(0).shadow().find('#downButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#line_x2').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
.click({ force: true })
}
for(let n = 0; n < 25; n ++){
for (let n = 0; n < 25; n++) {
cy.get('#line_y2').shadow().find('elix-number-spin-box').eq(0).shadow().find('#downButton').eq(0)
.click({ force: true });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_line_change_stroke_width', function () {
cy.get('#svg_2').click({ force: true });
for(let n = 0; n < 10; n ++){
cy.get('#svg_2').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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_line_change_stoke_color', function () {
cy.get('#svg_3').click({ force: true });
cy.get('#stroke_color').shadow().find('#picker').eq(0).click({ force: true });
cy.get('#svg_3').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(9).click({ force: true });
.find('.QuickColor').eq(9).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 });
testSnapshot();
});
.find('#Ok').eq(0).click({ force: true })
testSnapshot()
})
it('check tool_line_align_to_page', function () {
cy.get('#svg_3').click({ force: true });
cy.get('#tool_position').shadow().find('elix-dropdown-list').eq(0).invoke('attr', 'opened', 'opened');
cy.get('#svg_3').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 });
testSnapshot();
});
});
.click({ force: true })
testSnapshot()
})
})

View File

@@ -1,108 +1,108 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { force: true, parseSpecialCharSequences: false })
cy.get('#tool_source_save').click({ force: true })
testSnapshot()
})
it('check tool_polygon', function () {
cy.get('#tool_polygon')
.click({ force: true });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 325, 250, { force: true })
.trigger('mousemove', 325, 345, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.trigger('mouseup', { force: true })
testSnapshot()
})
it('check tool_polygon_clone', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#tool_clone').click({ force: true });
testSnapshot();
});
cy.get('#svg_1').click({ force: true })
cy.get('#tool_clone').click({ force: true })
testSnapshot()
})
it('check tool_polygon_change_class', function () {
cy.get('#svg_2').click({ force: true });
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 });
.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');
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_2_class')
})
})
it('check tool_polygon_change_id', function () {
cy.get('#svg_2').click({ force: true }).click({ force: true });
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 });
.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');
});
});
const classList = Array.from($el[0].classList)
return classList.includes('svg_2_class')
})
})
it('check tool_polygon_change_rotation', function () {
cy.get('#svg_2_id').click({ force: true });
for(let n = 0; n < 5; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_polygon_change_blur', function () {
cy.get('#svg_2_id').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_polygon_change_opacity', function () {
cy.get('#svg_2_id').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_polygon_bring_to_back', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_move_bottom').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_move_bottom').click({ force: true })
testSnapshot()
})
it('check tool_polygon_bring_to_front', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_move_top').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_move_top').click({ force: true })
testSnapshot()
})
it('check tool_polygon_delete', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_delete').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
})
it('check tool_polygon_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('#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 });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
/* it('check tool_polygon_change_x_y_coordinate', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 25; n ++){
@@ -116,35 +116,35 @@ describe('use all parts of svg-edit', function () {
testSnapshot();
}); */
it('check tool_polygon_change_stroke_width', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_polygon_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('#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 });
.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 });
.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 });
.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 });
testSnapshot();
});
.find('#Ok').eq(0).click({ force: true })
testSnapshot()
})
it('check tool_polygon_change_sides', function () {
cy.get('#svg_1').click({ force: true });
cy.get('#svg_1').click({ force: true })
cy.get('#polySides').shadow().find('elix-number-spin-box').eq(0).shadow().find('#upButton').eq(0)
.click({ force: true });
testSnapshot();
});
});
.click({ force: true })
testSnapshot()
})
})

View File

@@ -1,138 +1,138 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
const testSnapshot = () => {
cy.get('#svgcontent').cleanSnapshot();
};
cy.get('#svgcontent').cleanSnapshot()
}
describe('use all parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('check tool_source_set', function () {
cy.get('#tool_source').click({ force: true });
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();
});
</svg>`, { 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 });
.click({ force: true })
cy.get('#svgcontent')
.trigger('mousedown', 300, 150, { force: true })
.trigger('mousemove', 300, 250, { force: true })
.trigger('mouseup', { force: true });
testSnapshot();
});
.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 });
testSnapshot();
});
cy.get('#svg_1').click({ force: true })
cy.get('#tool_clone').click({ force: true })
testSnapshot()
})
it('check tool_star_change_class', function () {
cy.get('#svg_2').click({ force: true });
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 });
.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');
});
});
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('#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 });
.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');
});
});
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('#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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_star_change_blur', function () {
cy.get('#svg_2_id').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_star_change_opacity', function () {
cy.get('#svg_2_id').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
it('check tool_star_bring_to_back', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_move_bottom').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_move_bottom').click({ force: true })
testSnapshot()
})
it('check tool_star_bring_to_front', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_move_top').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_move_top').click({ force: true })
testSnapshot()
})
it('check tool_star_delete', function () {
cy.get('#svg_2_id').click({ force: true });
cy.get('#tool_delete').click({ force: true });
testSnapshot();
});
cy.get('#svg_2_id').click({ force: true })
cy.get('#tool_delete').click({ force: true })
testSnapshot()
})
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('#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 });
testSnapshot();
});
.click({ force: true })
testSnapshot()
})
it('check tool_star_change_stroke_width', function () {
cy.get('#svg_1').click({ force: true });
for(let n = 0; n < 10; n ++){
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 });
.click({ force: true })
}
testSnapshot();
});
testSnapshot()
})
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('#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 });
.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 });
.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 });
.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 });
testSnapshot();
});
.find('#Ok').eq(0).click({ force: true })
testSnapshot()
})
it('check tool_star_change_sides', function () {
cy.get('#svg_1').click({ force: true });
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 });
testSnapshot();
});
});
.click({ force: true })
testSnapshot()
})
})

View File

@@ -1,17 +1,17 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
} from '../../support/ui-test-helper.js'
describe('UI - Tool selection', function () {
beforeEach(() => {
visitAndApproveStorage();
});
visitAndApproveStorage()
})
it('should set rectangle selection by click', function () {
cy.get('#tools_rect')
.should('not.have.attr', 'pressed');
.should('not.have.attr', 'pressed')
cy.get('#tools_rect')
.trigger('click', { force: true })
.should('have.attr', 'pressed');
});
});
.should('have.attr', 'pressed')
})
})