add TestCafe UI test

master
cuixiping 2019-03-15 16:38:33 +08:00
parent 573544b41b
commit 5691b7b1e7
1 changed files with 20 additions and 0 deletions

View File

@ -20,3 +20,23 @@ test('Editor - No parameters: Export button clicking', async (t) => {
.click('#tool_export') .click('#tool_export')
.expect(Selector('#dialog_content select')).ok('Export dialog opens'); .expect(Selector('#dialog_content select')).ok('Export dialog opens');
}); });
test('Editor - No parameters: Drag control point of arc path', async (t) => {
const randomOffset = () => Math.round(10 + Math.random() * 40);
await t
.click('#dialog_buttons > input[type=button][value=OK]')
.click('#tool_source')
.selectTextAreaContent('#svg_source_textarea')
.typeText('#svg_source_textarea', `<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
<path d="m187,194a114,62 0 1 0 219,2" fill="#FF0000" stroke="#000000" stroke-width="5"/>
</g>
</svg>`)
.click('#tool_source_save')
.click('#svg_1')
.click('#svg_1')
.drag('#pathpointgrip_0', randomOffset(), randomOffset(), { offsetX: 2, offsetY: 2 })
.drag('#pathpointgrip_1', randomOffset(), randomOffset(), { offsetX: 2, offsetY: 2 })
.expect(Selector('#svg_1').getAttribute('d')).notContains('NaN');
});