- Testing: Separate tests into unit/ui; split UI tests by specific domain;

setup browser-bug folder and ui issues folder
- Testing: Create test utilities for selecting English and visiting and
  approving storage
- Testing: Add test for tool selection
master
Brett Zamir 2019-12-23 18:34:28 +08:00
parent 31a98c1408
commit fc41ea7a43
24 changed files with 147 additions and 92 deletions

View File

@ -15,6 +15,10 @@
- Testing: Switch to Cypress with code coverage for UI testing;
use ESM version for faster debugging
- Testing: Add map file for underscore
- Testing: Separate tests into unit/ui; split UI tests by specific domain;
setup browser-bug folder and ui issues folder
- Testing: Create test utilities for selecting English and visiting and
approving storage
- npm: Update scripts to reflect removal of `all_tests.html`;
remove `browser-test` script
- npm: Update devDeps, peerDeps

View File

@ -1,17 +1,17 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="20">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20">
<linearGradient id="smooth" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="round">
<rect width="110" height="20" rx="3" fill="#fff"/>
<rect width="116" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#round)">
<rect width="63" height="20" fill="#555"/>
<rect x="63" width="47" height="20" fill="#fe7d37"/>
<rect width="110" height="20" fill="url(#smooth)"/>
<rect x="63" width="53" height="20" fill="#fe7d37"/>
<rect width="116" height="20" fill="url(#smooth)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
@ -20,8 +20,8 @@
<text x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
<text x="325" y="140" transform="scale(0.1)" textLength="530" lengthAdjust="spacing">Coverage</text>
<text x="855" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="370" lengthAdjust="spacing">40.9%</text>
<text x="855" y="140" transform="scale(0.1)" textLength="370" lengthAdjust="spacing">40.9%</text>
<text x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">22.02%</text>
<text x="885" y="140" transform="scale(0.1)" textLength="430" lengthAdjust="spacing">22.02%</text>
</g>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,4 +1,4 @@
describe('Accessibility', function () {
describe('UI - Accessibility', function () {
beforeEach(() => {
cy.visit('/instrumented/svg-editor-es.html');
cy.injectAxe();

View File

@ -1,27 +1,10 @@
import {
approveStorage, openMainMenu,
openEditorPreferences
} from '../support/ui-test-helper.js';
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
describe('UI tests', function () {
describe('UI - Control Points', function () {
beforeEach(() => {
cy.visit('/instrumented/svg-editor-es.html');
// Ensure we test against English regardless of the original locale
approveStorage();
openEditorPreferences();
cy.get('#lang_select').select('en');
cy.get('#tool_prefs_save').click();
});
it('Editor - No parameters: Has export button', () => {
openMainMenu();
cy.get('#tool_export');
});
it('Editor - No parameters: Export button clicking; dialog opens', () => {
openMainMenu();
cy.get('#tool_export').click();
cy.get('#dialog_content select');
visitAndApproveStorage();
});
it('Editor - No parameters: Drag control point of arc path', () => {

View File

@ -0,0 +1,20 @@
import {
visitAndApproveStorage, openMainMenu
} from '../../support/ui-test-helper.js';
describe('UI - Export tests', function () {
beforeEach(() => {
visitAndApproveStorage();
});
it('Editor - No parameters: Has export button', () => {
openMainMenu();
cy.get('#tool_export');
});
it('Editor - No parameters: Export button clicking; dialog opens', () => {
openMainMenu();
cy.get('#tool_export').click();
cy.get('#dialog_content select');
});
});

View File

@ -0,0 +1,19 @@
import {
visitAndApproveStorage
} from '../../../support/ui-test-helper.js';
// See https://github.com/SVG-Edit/svgedit/issues/364
describe('Issue 364; IE errorwith rectangle selection by click', function () {
beforeEach(() => {
visitAndApproveStorage();
});
it('should set rectangle selection after click', function () {
cy.get('#tools_rect_show')
.trigger('mousedown', {force: true})
.trigger('mouseup', {force: true})
.should((button) => {
expect(button).to.have.class('tool_button_current');
});
});
});

View File

@ -0,0 +1,18 @@
import {
visitAndApproveStorage
} from '../../support/ui-test-helper.js';
describe('UI - Tool selection', function () {
beforeEach(() => {
visitAndApproveStorage();
});
it('should set rectangle selection by click', function () {
cy.get('#tools_rect_show')
.trigger('mousedown', {force: true})
.trigger('mouseup', {force: true})
.should((button) => {
expect(button).to.have.class('tool_button_current');
});
});
});

View File

@ -1,5 +1,5 @@
import '../../instrumented/jquery.min.js';
import * as contextmenu from '../../instrumented/contextmenu.js';
import '../../../instrumented/jquery.min.js';
import * as contextmenu from '../../../instrumented/contextmenu.js';
describe('contextmenu', function () {
/**

View File

@ -1,8 +1,8 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as utilities from '../../instrumented/utilities.js';
import * as coords from '../../instrumented/coords.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as coords from '../../../instrumented/coords.js';
describe('coords', function () {
let elemId = 1;

View File

@ -1,8 +1,8 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as draw from '../../instrumented/draw.js';
import * as units from '../../instrumented/units.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as draw from '../../../instrumented/draw.js';
import * as units from '../../../instrumented/units.js';
describe('draw.Drawing', function () {
const addOwnSpies = (obj) => {

View File

@ -1,9 +1,9 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as transformlist from '../../instrumented/svgtransformlist.js';
import * as utilities from '../../instrumented/utilities.js';
import * as hstory from '../../instrumented/history.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as hstory from '../../../instrumented/history.js';
describe('history', function () {
// TODO(codedread): Write tests for handling history events.

View File

@ -1,7 +1,7 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as math from '../../instrumented/math.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as math from '../../../instrumented/math.js';
describe('math', function () {
const svg = document.createElementNS(NS.SVG, 'svg');

View File

@ -1,10 +1,10 @@
/* globals SVGPathSeg */
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import '../../instrumented/svgpathseg.js';
import {NS} from '../../instrumented/namespaces.js';
import * as utilities from '../../instrumented/utilities.js';
import * as pathModule from '../../instrumented/path.js';
import '../../../instrumented/svgpathseg.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as pathModule from '../../../instrumented/path.js';
describe('path', function () {
/**

View File

@ -1,9 +1,9 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as utilities from '../../instrumented/utilities.js';
import * as coords from '../../instrumented/coords.js';
import * as recalculate from '../../instrumented/recalculate.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as coords from '../../../instrumented/coords.js';
import * as recalculate from '../../../instrumented/recalculate.js';
describe('recalculate', function () {
// eslint-disable-next-line no-shadow

View File

@ -1,7 +1,7 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as sanitize from '../../instrumented/sanitize.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as sanitize from '../../../instrumented/sanitize.js';
describe('sanitize', function () {
const svg = document.createElementNS(NS.SVG, 'svg');

View File

@ -1,7 +1,7 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import * as select from '../../instrumented/select.js';
import {NS} from '../../instrumented/namespaces.js';
import * as select from '../../../instrumented/select.js';
import {NS} from '../../../instrumented/namespaces.js';
describe('select', function () {
const sandbox = document.createElement('div');

View File

@ -1,11 +1,11 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import {NS} from '../../instrumented/namespaces.js';
import * as transformlist from '../../instrumented/svgtransformlist.js';
import {disableSupportsNativeTransformLists} from '../../instrumented/browser.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js';
import {disableSupportsNativeTransformLists} from '../../../instrumented/browser.js';
import almostEqualsPlugin from '../support/assert-almostEquals.js';
import expectOutOfBoundsExceptionPlugin from '../support/assert-expectOutOfBoundsException.js';
import almostEqualsPlugin from '../../support/assert-almostEquals.js';
import expectOutOfBoundsExceptionPlugin from '../../support/assert-expectOutOfBoundsException.js';
chai.use(almostEqualsPlugin);
chai.use(expectOutOfBoundsExceptionPlugin);

View File

@ -1,8 +1,8 @@
import '../../instrumented/jquery.min.js';
import '../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js';
import '../../../instrumented/jquery.min.js';
import '../../../instrumented/jquery-ui/jquery-ui-1.8.17.custom.min.js';
import '../../instrumented/svgpathseg.js';
import SvgCanvas from '../../instrumented/svgcanvas.js';
import '../../../instrumented/svgpathseg.js';
import SvgCanvas from '../../../instrumented/svgcanvas.js';
describe('Basic Module', function () {
// helper functions

View File

@ -1,6 +1,6 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import * as units from '../../instrumented/units.js';
import * as units from '../../../instrumented/units.js';
describe('units', function () {
/**

View File

@ -1,12 +1,12 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import '../../instrumented/svgpathseg.js';
import {NS} from '../../instrumented/namespaces.js';
import * as utilities from '../../instrumented/utilities.js';
import * as transformlist from '../../instrumented/svgtransformlist.js';
import * as math from '../../instrumented/math.js';
import * as path from '../../instrumented/path.js';
import setAssertionMethods from '../support/assert-close.js';
import '../../../instrumented/svgpathseg.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js';
import * as math from '../../../instrumented/math.js';
import * as path from '../../../instrumented/path.js';
import setAssertionMethods from '../../support/assert-close.js';
chai.use(setAssertionMethods);

View File

@ -1,10 +1,10 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import '../../instrumented/svgpathseg.js';
import {NS} from '../../instrumented/namespaces.js';
import * as utilities from '../../instrumented/utilities.js';
import * as transformlist from '../../instrumented/svgtransformlist.js';
import * as math from '../../instrumented/math.js';
import '../../../instrumented/svgpathseg.js';
import {NS} from '../../../instrumented/namespaces.js';
import * as utilities from '../../../instrumented/utilities.js';
import * as transformlist from '../../../instrumented/svgtransformlist.js';
import * as math from '../../../instrumented/math.js';
describe('utilities performance', function () {
let currentLayer, groupWithMatrixTransform, textWithMatrixTransform;

View File

@ -1,8 +1,8 @@
import '../../instrumented/jquery.min.js';
import '../../../instrumented/jquery.min.js';
import * as browser from '../../instrumented/browser.js';
import * as utilities from '../../instrumented/utilities.js';
import {NS} from '../../instrumented/namespaces.js';
import * as browser from '../../../instrumented/browser.js';
import * as utilities from '../../../instrumented/utilities.js';
import {NS} from '../../../instrumented/namespaces.js';
describe('utilities', function () {
/**

View File

@ -3,6 +3,11 @@ export const approveStorage = () => {
.click();
};
export const visitAndApproveStorage = () => {
cy.visit('/instrumented/svg-editor-es.html');
approveStorage();
};
export const openMainMenu = () => {
return cy.get('#main_icon').click();
};
@ -11,3 +16,9 @@ export const openEditorPreferences = () => {
openMainMenu();
return cy.get('#tool_prefs_option').click();
};
export const selectEnglish = () => {
openEditorPreferences();
cy.get('#lang_select').select('en');
cy.get('#tool_prefs_save').click();
};