Improve end2end code.
@ -11,7 +11,7 @@ export default defineConfig({
|
|||||||
// We've imported your old cypress plugins here.
|
// We've imported your old cypress plugins here.
|
||||||
// You may want to clean this up later by importing these.
|
// You may want to clean this up later by importing these.
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
return require('./cypress/plugins/index.js')(on, config);
|
return require('./cypress/plugins/index.ts')(on, config);
|
||||||
},
|
},
|
||||||
baseUrl: 'http://localhost:8081',
|
baseUrl: 'http://localhost:8081',
|
||||||
},
|
},
|
||||||
|
@ -4,7 +4,7 @@ describe('Edit Topic', () => {
|
|||||||
// Remove storage for autosave ...
|
// Remove storage for autosave ...
|
||||||
cy.visit('/editor.html');
|
cy.visit('/editor.html');
|
||||||
cy.waitEditorLoaded();
|
cy.waitEditorLoaded();
|
||||||
cy.get('[test-id=2]').click();
|
cy.onFocusTopicById(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Copy and Paste', () => {
|
it('Copy and Paste', () => {
|
||||||
|
@ -13,7 +13,7 @@ describe('Relationship Topics', () => {
|
|||||||
// Create new relationship ...
|
// Create new relationship ...
|
||||||
cy.contains('Features').click({ force: true });
|
cy.contains('Features').click({ force: true });
|
||||||
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
||||||
cy.contains('Try it Now!').click();
|
cy.onFocusTopicByText('Try it Now!');
|
||||||
|
|
||||||
cy.get('[test-id="11-15-relationship"]').as('rel');
|
cy.get('[test-id="11-15-relationship"]').as('rel');
|
||||||
cy.get('@rel').click({ force: true });
|
cy.get('@rel').click({ force: true });
|
||||||
@ -49,7 +49,7 @@ describe('Relationship Topics', () => {
|
|||||||
|
|
||||||
it('Change Control Point', () => {
|
it('Change Control Point', () => {
|
||||||
// Create new relationship ...
|
// Create new relationship ...
|
||||||
cy.contains('Features').click({ force: true });
|
cy.onFocusTopicByText('Features');
|
||||||
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
||||||
cy.contains('Try it Now!').click();
|
cy.contains('Try it Now!').click();
|
||||||
|
|
||||||
|
@ -15,8 +15,7 @@ describe('Edit Topic', () => {
|
|||||||
it('Change Main Topic Text', () => {
|
it('Change Main Topic Text', () => {
|
||||||
cy.get('body').type('New Title Main Topic{enter}');
|
cy.get('body').type('New Title Main Topic{enter}');
|
||||||
cy.get('[test-id=1] > text > tspan').should('have.text', 'New Title Main Topic');
|
cy.get('[test-id=1] > text > tspan').should('have.text', 'New Title Main Topic');
|
||||||
|
cy.onFocusTopicByText('Mind Mapping');
|
||||||
cy.contains('Mind Mapping').click({ force: true });
|
|
||||||
cy.matchImageSnapshot('changeMainTopicText');
|
cy.matchImageSnapshot('changeMainTopicText');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ describe('Edit Topic', () => {
|
|||||||
|
|
||||||
cy.get('[test-id=1] > text').invoke('attr', 'fill').should('eq', '#cc0000');
|
cy.get('[test-id=1] > text').invoke('attr', 'fill').should('eq', '#cc0000');
|
||||||
|
|
||||||
cy.contains('Mind Mapping').click({ force: true });
|
cy.onFocusTopicByText('Mind Mapping');
|
||||||
cy.matchImageSnapshot('changeFontColor');
|
cy.matchImageSnapshot('changeFontColor');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@ describe('Node manager', () => {
|
|||||||
cy.waitEditorLoaded();
|
cy.waitEditorLoaded();
|
||||||
|
|
||||||
// Select root node ...
|
// Select root node ...
|
||||||
cy.contains('Mind Mapping').click({ force: true });
|
cy.onFocusTopicByText('Mind Mapping');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shortcut add sibling node', () => {
|
it('shortcut add sibling node', () => {
|
||||||
@ -26,7 +26,7 @@ describe('Node manager', () => {
|
|||||||
|
|
||||||
it('Delete topic', () => {
|
it('Delete topic', () => {
|
||||||
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
||||||
cy.get('[test-id=36]').click();
|
cy.onFocusTopicById(36);
|
||||||
cy.get('body').type('{del}');
|
cy.get('body').type('{del}');
|
||||||
|
|
||||||
cy.get('[test-id=37]').should('not.exist');
|
cy.get('[test-id=37]').should('not.exist');
|
||||||
|
@ -4,9 +4,6 @@ describe('Change topic position', () => {
|
|||||||
// Remove storage for autosave ...
|
// Remove storage for autosave ...
|
||||||
cy.visit('/editor.html');
|
cy.visit('/editor.html');
|
||||||
cy.waitEditorLoaded();
|
cy.waitEditorLoaded();
|
||||||
|
|
||||||
// Wait for load complate ...
|
|
||||||
cy.get('[aria-label="vortex-loading"]').should('not.exist');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Move up node "Mind Mapping"', () => {
|
it('Move up node "Mind Mapping"', () => {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// This function is called when a project is opened or re-opened (e.g. due to
|
// This function is called when a project is opened or re-opened (e.g. due to
|
||||||
// the project's config changing)
|
// the project's config changing)
|
||||||
|
|
||||||
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
|
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Cypress.PluginConfig}
|
* @type {Cypress.PluginConfig}
|
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 470 KiB |
Before Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 94 KiB |
@ -1,3 +1,5 @@
|
|||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
|
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
|
||||||
|
|
||||||
// make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set
|
// make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set
|
||||||
@ -17,7 +19,25 @@ if (Cypress.env('imageSnaphots')) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/
|
Cypress.Commands.add('waitEditorLoaded', () => {
|
||||||
Cypress.Commands.add('getIframeBody', () =>
|
// Wait editor ...
|
||||||
cy.get('iframe').its('0.contentDocument.body').should('not.be.empty').then(cy.wrap),
|
cy.get('svg > path').should('be.visible');
|
||||||
);
|
cy.get('[aria-label="vortex-loading"]', { timeout: 120000 }).should('not.exist');
|
||||||
|
cy.clearLocalStorage('welcome-xml');
|
||||||
|
|
||||||
|
// Wait for font ...
|
||||||
|
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitForLoad', () => {
|
||||||
|
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mindmap commands ...
|
||||||
|
Cypress.Commands.add('onFocusTopicById', (id: number) => {
|
||||||
|
cy.get(`[test-id=${id}]`).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('onFocusTopicByText', (text: string) => {
|
||||||
|
cy.contains(text).click({ force: true });
|
||||||
|
});
|
||||||
|
@ -1,28 +1,13 @@
|
|||||||
import './commands';
|
import './commands';
|
||||||
|
|
||||||
Cypress.Commands.add('waitEditorLoaded', () => {
|
|
||||||
// Wait editor ...
|
|
||||||
cy.get('svg > path').should('be.visible');
|
|
||||||
cy.get('[aria-label="vortex-loading"]', { timeout: 120000 }).should('not.exist');
|
|
||||||
cy.clearLocalStorage('welcome-xml');
|
|
||||||
|
|
||||||
// Wait for font ...
|
|
||||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add('waitForLoad', () => {
|
|
||||||
// Wait page be loaded...
|
|
||||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.on('window:before:load', (win) => {
|
Cypress.on('window:before:load', (win) => {
|
||||||
cy.spy(win.console, 'error');
|
cy.spy(win.console, 'error');
|
||||||
cy.spy(win.console, 'warn');
|
cy.spy(win.console, 'warn');
|
||||||
});
|
});
|
||||||
|
|
||||||
// afterEach(() => {
|
afterEach(() => {
|
||||||
// cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
// expect(win.console.error).to.have.callCount(0);
|
expect(win.console.error).to.have.callCount(0);
|
||||||
// expect(win.console.warn).to.have.callCount(0);
|
expect(win.console.warn).to.have.callCount(0);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@formatjs/cli": "^5.1.3",
|
"@formatjs/cli": "^5.1.3",
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
|
"@types/cypress-image-snapshot": "^3.1.6",
|
||||||
"@types/jest": "^29.0.0",
|
"@types/jest": "^29.0.0",
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"copy-webpack-plugin": "^10.2.1",
|
"copy-webpack-plugin": "^10.2.1",
|
||||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 50 KiB |
@ -3864,6 +3864,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/cypress-image-snapshot@npm:^3.1.6":
|
||||||
|
version: 3.1.6
|
||||||
|
resolution: "@types/cypress-image-snapshot@npm:3.1.6"
|
||||||
|
checksum: cd0128d330233702095dac1d2b4524c8bab9f9bc4070e27942e3e26e7701ec2f1d90faa7901bf335523160e4b9689eff9f6c192f30c0e90b9b846b8dde310ebc
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/eslint-scope@npm:^3.7.3":
|
"@types/eslint-scope@npm:^3.7.3":
|
||||||
version: 3.7.4
|
version: 3.7.4
|
||||||
resolution: "@types/eslint-scope@npm:3.7.4"
|
resolution: "@types/eslint-scope@npm:3.7.4"
|
||||||
@ -4732,6 +4739,7 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@formatjs/cli": ^5.1.3
|
"@formatjs/cli": ^5.1.3
|
||||||
"@testing-library/react": ^13.4.0
|
"@testing-library/react": ^13.4.0
|
||||||
|
"@types/cypress-image-snapshot": ^3.1.6
|
||||||
"@types/jest": ^29.0.0
|
"@types/jest": ^29.0.0
|
||||||
"@wisemapping/mindplot": ^5.0.15
|
"@wisemapping/mindplot": ^5.0.15
|
||||||
babel-polyfill: ^6.26.0
|
babel-polyfill: ^6.26.0
|
||||||
|