- Testing: Switch to Cypress with code coverage
- npm: Add peerDeps
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
export const approveStorage = (t) => {
|
||||
return t
|
||||
.click('#dialog_buttons > input[type=button][data-ok]');
|
||||
};
|
||||
|
||||
export const openMainMenu = (t) => {
|
||||
return t.click('#main_icon');
|
||||
};
|
||||
|
||||
export const openEditorPreferences = (t) => {
|
||||
return openMainMenu(t).click('#tool_prefs_option');
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
// https://github.com/DevExpress/testcafe
|
||||
// https://devexpress.github.io/testcafe/documentation/test-api/
|
||||
// https://github.com/helen-dikareva/axe-testcafe
|
||||
import {axeCheck, createReport} from 'axe-testcafe';
|
||||
|
||||
/**
|
||||
* @external AxeResult
|
||||
*/
|
||||
/**
|
||||
* @external TestcafeTest
|
||||
*/
|
||||
/**
|
||||
* @param {external.TestcafeTest} t
|
||||
* @returns {Promise<external:AxeResult>}
|
||||
*/
|
||||
async function axeCheckWithConfig (t) {
|
||||
const /* error, */ {violations} = await axeCheck(
|
||||
t,
|
||||
// context: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter
|
||||
undefined,
|
||||
// https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter
|
||||
{
|
||||
rules: {
|
||||
'meta-viewport': {enabled: false}
|
||||
}
|
||||
}
|
||||
// , (err, results) {} // https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#results-object
|
||||
);
|
||||
await t.expect(violations.length === 0).ok(createReport(violations));
|
||||
}
|
||||
|
||||
fixture`TestCafe Axe accessibility tests (Editor - no parameters)`
|
||||
.page`http://localhost:8000/editor/svg-editor.html`;
|
||||
|
||||
test('Editor - no parameters', async (t) => {
|
||||
await axeCheckWithConfig(t); // , axeContent, axeOptions: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axerun
|
||||
});
|
||||
|
||||
fixture`TestCafe Axe accessibility tests (Editor - with all extensions)`
|
||||
.page`http://localhost:8000/editor/svg-editor.html?extensions=ext-arrows.js,ext-closepath.js,ext-foreignobject.js,ext-helloworld.js,ext-mathjax.js,ext-php_savefile.js,ext-server_moinsave.js,ext-server_opensave.js,ext-webappfind.js,ext-xdomain-messaging.js`;
|
||||
|
||||
test('Editor - with all extensions', async (t) => {
|
||||
await axeCheckWithConfig(t); // , axeContent, axeOptions: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axerun
|
||||
});
|
||||
|
||||
/* eslint-disable qunit/no-commented-tests */
|
||||
// Waiting for https://github.com/DevExpress/testcafe-hammerhead/issues/1725 (also https://github.com/DevExpress/testcafe/issues/2734 )
|
||||
/**
|
||||
fixture`TestCafe Axe accessibility tests (Editor ES - no parameters)`
|
||||
.page`http://localhost:8000/editor/svg-editor-es.html`;
|
||||
|
||||
test('Editor ES - no parameters', async t => {
|
||||
await axeCheckWithConfig(t); // , axeContent, axeOptions: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axerun
|
||||
});
|
||||
|
||||
fixture`TestCafe Axe accessibility tests (Editor ES - with all extensions)`
|
||||
.page`http://localhost:8000/editor/svg-editor-es.html?extensions=ext-arrows.js,ext-closepath.js,ext-foreignobject.js,ext-helloworld.js,ext-mathjax.js,ext-php_savefile.js,ext-server_moinsave.js,ext-server_opensave.js,ext-webappfind.js,ext-xdomain-messaging.js`;
|
||||
|
||||
test('Editor ES - with all extensions', async t => {
|
||||
await axeCheckWithConfig(t); // , axeContent, axeOptions: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axerun
|
||||
});
|
||||
|
||||
fixture`TestCafe Axe accessibility tests (Embedded - no parameters)`
|
||||
.page`http://localhost:8000/editor/embedapi.html`;
|
||||
|
||||
test('Embedded - no parameters', async t => {
|
||||
await axeCheckWithConfig(t); // , axeContent, axeOptions: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axerun
|
||||
});
|
||||
*/
|
||||
/* eslint-enable qunit/no-commented-tests */
|
||||
@@ -1,46 +0,0 @@
|
||||
// https://github.com/DevExpress/testcafe
|
||||
// https://devexpress.github.io/testcafe/documentation/test-api/
|
||||
// https://github.com/helen-dikareva/axe-testcafe
|
||||
import {Selector} from 'testcafe';
|
||||
import {
|
||||
approveStorage, openMainMenu,
|
||||
openEditorPreferences
|
||||
} from '../ui-test-helper.js';
|
||||
|
||||
fixture`TestCafe UI tests`
|
||||
.page`http://localhost:8000/editor/svg-editor.html`
|
||||
.beforeEach((t) => {
|
||||
// Ensure we test against English regardless of the original locale
|
||||
return openEditorPreferences(approveStorage(t))
|
||||
.click('#lang_select').click('#lang_en').click('#tool_prefs_save');
|
||||
});
|
||||
|
||||
test('Editor - No parameters: Export button', async (t) => {
|
||||
await openMainMenu(t)
|
||||
.expect(Selector('#tool_export')).ok('Has open button');
|
||||
});
|
||||
|
||||
test('Editor - No parameters: Export button clicking', async (t) => {
|
||||
await openMainMenu(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('#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');
|
||||
});
|
||||
Reference in New Issue
Block a user