2021-08-19 14:48:18 +00:00
|
|
|
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_shape', function () {
|
|
|
|
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 });
|
|
|
|
cy.get('#selectorGrip_rotate')
|
|
|
|
.trigger('mousedown')
|
|
|
|
.trigger('mousemove', 20, 20, { force: true })
|
|
|
|
.trigger('mouseup', { force: true });
|
2021-12-27 23:54:49 +00:00
|
|
|
testSnapshot();
|
2021-08-19 14:48:18 +00:00
|
|
|
});
|
2021-08-23 13:01:55 +00:00
|
|
|
it('check tool_image', function () {
|
2021-08-19 14:48:18 +00:00
|
|
|
cy.get('#tool_image').click({ force: true });
|
|
|
|
cy.get('#svgcontent')
|
|
|
|
.trigger('mousedown', 100, 100, { force: true })
|
2021-08-24 13:31:51 +00:00
|
|
|
.trigger('mousemove', 120, 120, { force: true })
|
2021-08-19 14:48:18 +00:00
|
|
|
.trigger('mouseup', { force: true });
|
2021-08-24 14:07:55 +00:00
|
|
|
// 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');
|
|
|
|
});
|
2021-12-27 23:54:49 +00:00
|
|
|
testSnapshot();
|
2021-08-24 13:31:51 +00:00
|
|
|
});
|
2021-08-19 14:48:18 +00:00
|
|
|
});
|