- Linting (ESLint): Apply coding standards

- Testing (Refactoring): Abstract out to helper file functions for approving local storage and opening the main menu
- Docs (CHANGES): Update
- npm: Update devDeps; update nested deps for security audit
This commit is contained in:
Brett Zamir
2019-03-16 12:30:23 +08:00
parent 5691b7b1e7
commit dade2a7b37
28 changed files with 521 additions and 537 deletions

View File

@@ -2,29 +2,27 @@
// https://devexpress.github.io/testcafe/documentation/test-api/
// https://github.com/helen-dikareva/axe-testcafe
import {Selector} from 'testcafe';
import {
approveStorage, approveStorageAndOpenMainMenu
} from '../ui-test-helper.js';
fixture`TestCafe UI tests`
.page`http://localhost:8000/editor/svg-editor.html`;
test('Editor - No parameters: Export button', async (t) => {
await t
.click('#dialog_buttons > input[type=button][value=OK]')
.click('#main_icon')
await approveStorageAndOpenMainMenu(t)
.expect(Selector('#tool_export')).ok('Has open button');
});
test('Editor - No parameters: Export button clicking', async (t) => {
await t
.click('#dialog_buttons > input[type=button][value=OK]')
.click('#main_icon')
await approveStorageAndOpenMainMenu(t)
.click('#tool_export')
.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]')
await approveStorage(t)
.click('#tool_source')
.selectTextAreaContent('#svg_source_textarea')
.typeText('#svg_source_textarea', `<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
@@ -36,7 +34,7 @@ test('Editor - No parameters: Drag control point of arc path', async (t) => {
.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 })
.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');
});