focus on the svg content to test snapshots

master
jfh 2020-09-13 14:07:19 +02:00
parent 3167363742
commit e05a6aeb33
2 changed files with 49 additions and 284 deletions

View File

@ -1,295 +1,51 @@
exports[`use various parts of svg-edit > check tool_fhpath #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_source #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
</g>
<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 fill="#FF0000" height="70" id="rect" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_text #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
A
</text>
</g>
<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 fill="#FF0000" height="70" id="rect" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
<text fill="#000000" font-family="serif" font-size="24" id="svg_1" stroke="#000000" stroke-width="0" text-anchor="middle" x="116" xml:space="preserve" y="87">B</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_clone #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
A
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
>
A
</text>
</g>
<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 fill="#FF0000" height="70" id="rect" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
<text fill="#000000" font-family="serif" font-size="24" id="svg_1" stroke="#000000" stroke-width="0" text-anchor="middle" x="116" xml:space="preserve" y="87">B</text>
<text fill="#000000" font-family="serif" font-size="24" id="svg_2" stroke="#000000" stroke-width="0" text-anchor="middle" x="136" xml:space="preserve" y="107">B</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_italic #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
A
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
font-style="italic"
>
A
</text>
</g>
<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 fill="#FF0000" height="70" id="rect" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
<text fill="#000000" font-family="serif" font-size="24" font-style="italic" id="svg_1" stroke="#000000" stroke-width="0" text-anchor="middle" x="116" xml:space="preserve" y="87">B</text>
<text fill="#000000" font-family="serif" font-size="24" id="svg_2" stroke="#000000" stroke-width="0" text-anchor="middle" x="136" xml:space="preserve" y="107">B</text>
</g>
</svg>
`;
exports[`use various parts of svg-edit > check tool_bold #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>
<rect
id="rect"
fill="#FF0000"
height="70"
stroke="#000000"
stroke-width="5"
width="94"
x="69.5"
y="51.5"
style="pointer-events:inherit"
></rect>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="116"
y="87"
id="svg_1"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
>
A
</text>
<text
fill="#000000"
stroke="#000000"
stroke-width="0"
style="pointer-events: inherit; cursor: move;"
x="136"
y="107"
font-size="24"
font-family="serif"
text-anchor="middle"
xml:space="preserve"
fill-opacity="1"
stroke-opacity="1"
id="svg_2"
font-style="italic"
font-weight="bold"
>
A
</text>
</g>
<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 fill="#FF0000" height="70" id="rect" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
<text fill="#000000" font-family="serif" font-size="24" font-style="italic" font-weight="bold" id="svg_1" stroke="#000000" stroke-width="0" text-anchor="middle" x="116" xml:space="preserve" y="87">B</text>
<text fill="#000000" font-family="serif" font-size="24" id="svg_2" stroke="#000000" stroke-width="0" text-anchor="middle" x="136" xml:space="preserve" y="107">B</text>
</g>
</svg>
`;

View File

@ -2,13 +2,19 @@ import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
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});
};
describe('use various parts of svg-edit', function () {
before(() => {
visitAndApproveStorage();
});
it('check tool_source', function () {
cy.get('#tool_source').click();
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">
@ -17,8 +23,8 @@ describe('use various parts of svg-edit', function () {
<rect id="rect" fill="#FF0000" height="70" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/>
</g>
</svg>`, {parseSpecialCharSequences: false});
cy.get('#tool_source_save').click();
cy.get('#svgcontent').toMatchSnapshot();
cy.get('#tool_source_save').click({force: true});
testSnapshot();
});
/*
it('check tool_fhpath', function () {
@ -40,23 +46,26 @@ describe('use various parts of svg-edit', function () {
.trigger('mouseup', {force: true});
// svgedit use the #text text field to capture the text
// cy.get('#text').type('1234', {force: true});
cy.get('#text').type('A', {force: true});
cy.get('#svgcontent').toMatchSnapshot();
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});
cy.get('#svgcontent').toMatchSnapshot();
testSnapshot();
});
it('check tool_italic', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_italic')
.click({force: true});
cy.get('#svgcontent').toMatchSnapshot();
testSnapshot();
});
it('check tool_bold', function () {
cy.get('#svg_1').click({force: true});
cy.get('#tool_bold')
.click({force: true});
cy.get('#svgcontent').toMatchSnapshot();
testSnapshot();
});
});