2020-09-12 23:32:13 +00:00
|
|
|
import {
|
|
|
|
visitAndApproveStorage
|
|
|
|
} from '../../support/ui-test-helper.js';
|
|
|
|
|
2020-09-13 12:07:19 +00:00
|
|
|
const testSnapshot = () => {
|
|
|
|
cy.get('#tool_source').click({force: true});
|
|
|
|
cy.get('#svg_source_textarea').invoke('val').toMatchSnapshot();
|
|
|
|
cy.get('#tool_source_save').click({force: true});
|
|
|
|
};
|
|
|
|
|
2020-09-12 23:32:13 +00:00
|
|
|
describe('use various parts of svg-edit', function () {
|
|
|
|
before(() => {
|
|
|
|
visitAndApproveStorage();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('check tool_source', function () {
|
2020-09-13 12:07:19 +00:00
|
|
|
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>
|
|
|
|
</svg>`, {parseSpecialCharSequences: false});
|
2020-09-13 12:07:19 +00:00
|
|
|
cy.get('#tool_source_save').click({force: true});
|
|
|
|
testSnapshot();
|
2020-09-12 23:32:13 +00:00
|
|
|
});
|
2020-09-13 09:26:26 +00:00
|
|
|
/*
|
2020-09-12 23:32:13 +00:00
|
|
|
it('check tool_fhpath', function () {
|
|
|
|
cy.get('#tool_fhpath')
|
|
|
|
.click({force: true});
|
2020-09-13 09:26:26 +00:00
|
|
|
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();
|
|
|
|
});
|
2020-09-13 09:26:26 +00:00
|
|
|
*/
|
2020-09-12 23:32:13 +00:00
|
|
|
it('check tool_text', function () {
|
|
|
|
cy.get('#tool_text')
|
|
|
|
.click({force: true});
|
2020-09-13 09:26:26 +00:00
|
|
|
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
|
2020-09-13 09:26:26 +00:00
|
|
|
// cy.get('#text').type('1234', {force: true});
|
2020-09-13 12:07:19 +00:00
|
|
|
cy.get('#text').type('B', {force: true});
|
|
|
|
testSnapshot();
|
2020-09-13 09:26:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('check tool_clone', function () {
|
2020-09-13 12:07:19 +00:00
|
|
|
cy.get('#svg_1').click({force: true});
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_clone')
|
|
|
|
.click({force: true});
|
2020-09-13 12:07:19 +00:00
|
|
|
testSnapshot();
|
2020-09-13 09:26:26 +00:00
|
|
|
});
|
|
|
|
it('check tool_italic', function () {
|
2020-09-13 12:07:19 +00:00
|
|
|
cy.get('#svg_1').click({force: true});
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_italic')
|
|
|
|
.click({force: true});
|
2020-09-13 12:07:19 +00:00
|
|
|
testSnapshot();
|
2020-09-13 09:26:26 +00:00
|
|
|
});
|
|
|
|
it('check tool_bold', function () {
|
2020-09-13 12:07:19 +00:00
|
|
|
cy.get('#svg_1').click({force: true});
|
2020-09-13 09:26:26 +00:00
|
|
|
cy.get('#tool_bold')
|
|
|
|
.click({force: true});
|
2020-09-13 12:07:19 +00:00
|
|
|
testSnapshot();
|
2020-09-12 23:32:13 +00:00
|
|
|
});
|
|
|
|
});
|