Update cypress

This commit is contained in:
Paulo Gustavo Veiga 2023-01-07 21:10:13 -08:00
parent 46d4a1c31a
commit 62ea491623
23 changed files with 28 additions and 38 deletions

View File

@ -7,7 +7,9 @@
"eslint:recommended", "eslint:recommended",
"prettier", "prettier",
"plugin:react/recommended", "plugin:react/recommended",
"plugin:@typescript-eslint/recommended" "plugin:@typescript-eslint/recommended",
"plugin:cypress/recommended"
], ],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {

View File

@ -1,4 +1,4 @@
context('Relationship Topics', () => { describe('Relationship Topics', () => {
beforeEach(() => { beforeEach(() => {
// Remove storage for autosave ... // Remove storage for autosave ...
cy.visit('/editor.html'); cy.visit('/editor.html');

View File

@ -1,4 +1,4 @@
context('Render all sample maps', () => { describe('Render all sample maps', () => {
[ [
'complex', 'complex',
'emoji', 'emoji',

View File

@ -1,4 +1,4 @@
context('Edit Topic', () => { describe('Edit Topic', () => {
beforeEach(() => { beforeEach(() => {
// Remove storage for autosave ... // Remove storage for autosave ...
cy.visit('/editor.html'); cy.visit('/editor.html');
@ -14,7 +14,6 @@ context('Edit Topic', () => {
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.wait(200);
cy.matchImageSnapshot('changeMainTopicText'); cy.matchImageSnapshot('changeMainTopicText');
}); });
@ -43,7 +42,6 @@ context('Edit Topic', () => {
cy.get('@bigger').eq(1).click(); cy.get('@bigger').eq(1).click();
cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2'); cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2');
cy.wait(200);
cy.matchImageSnapshot('changeFontSizeHuge'); cy.matchImageSnapshot('changeFontSizeHuge');
}); });
@ -53,7 +51,6 @@ context('Edit Topic', () => {
cy.get('[test-id=1] > text').invoke('attr', 'font-style').should('eq', 'italic'); cy.get('[test-id=1] > text').invoke('attr', 'font-style').should('eq', 'italic');
cy.wait(200);
cy.matchImageSnapshot('changeFontItalic'); cy.matchImageSnapshot('changeFontItalic');
}); });
@ -63,7 +60,6 @@ context('Edit Topic', () => {
cy.get('[test-id=1] > text').invoke('attr', 'font-weight').should('eq', 'normal'); cy.get('[test-id=1] > text').invoke('attr', 'font-weight').should('eq', 'normal');
cy.wait(200);
cy.matchImageSnapshot('changeFontBold'); cy.matchImageSnapshot('changeFontBold');
}); });
@ -74,7 +70,6 @@ context('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.wait(200);
cy.matchImageSnapshot('changeFontColor'); cy.matchImageSnapshot('changeFontColor');
}); });
}); });

View File

@ -1,65 +1,61 @@
context('Node manager', () => { describe('Node manager', () => {
before(() => { beforeEach(() => {
cy.visit('/editor.html'); cy.visit('/editor.html');
// Wait for load complate ... // Wait for load complate ...
cy.get('[aria-label="vortex-loading"]').should('not.exist'); cy.get('[aria-label="vortex-loading"]').should('not.exist');
// Select root node ...
cy.contains('Mind Mapping').click({ force: true });
}); });
it('shortcut add sibling node', () => { it('shortcut add sibling node', () => {
cy.contains('Mind Mapping').click({ force: true });
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] > text > tspan').should('exist'); cy.get('[test-id=36] > text > tspan').should('exist');
cy.wait(200);
cy.matchImageSnapshot('editor-shortcut-edit'); cy.matchImageSnapshot('editor-shortcut-edit');
}); });
it('shortcut add child node', () => { it('shortcut add child node', () => {
cy.contains('Mind Mapping rocks!!').click({ force: true });
cy.get('body').type('{insert}').type('Child 1 mind Mapping rocks!!').type('{enter}'); cy.get('body').type('{insert}').type('Child 1 mind Mapping rocks!!').type('{enter}');
cy.get('body').type('{enter}').type('Child 2 mind Mapping rocks!!').type('{enter}'); cy.get('body').type('{enter}').type('Child 2 mind Mapping rocks!!').type('{enter}');
cy.get('[test-id=36] > text > tspan').should('exist'); cy.get('[test-id=36] > text > tspan').should('exist');
cy.get('[test-id=37] > text > tspan').should('exist'); cy.get('[test-id=37] > text > tspan').should('exist');
cy.wait(200);
cy.matchImageSnapshot('addChildNodeSortcut'); cy.matchImageSnapshot('addChildNodeSortcut');
}); });
it('Delete topic', () => { it('Delete topic', () => {
cy.get('[test-id=37]').click(); cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
cy.get('[test-id=36]').click();
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');
cy.wait(200);
cy.matchImageSnapshot('deleteTopicShortcut'); cy.matchImageSnapshot('deleteTopicShortcut');
}); });
it('undo changes', () => { it('undo changes', () => {
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
cy.get('[data-testid="UndoOutlinedIcon"]').click(); cy.get('[data-testid="UndoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist'); cy.get('[test-id=36] > text > tspan').should('exist');
cy.wait(200);
cy.matchImageSnapshot('undoChange'); cy.matchImageSnapshot('undoChange');
}); });
it('redo changes', () => { it('redo changes', () => {
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
cy.get('[data-testid="UndoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist');
cy.get('[data-testid="RedoOutlinedIcon"]').click(); cy.get('[data-testid="RedoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist'); cy.get('[test-id=36] > text > tspan').should('exist');
cy.wait(200);
cy.matchImageSnapshot('redoChange'); cy.matchImageSnapshot('redoChange');
}); });
it('Save changes', () => { it('Save changes', () => {
cy.contains('Mind Mapping rocks!!').click({ force: true });
cy.get('body').type('{ctrl}s'); cy.get('body').type('{ctrl}s');
cy.wait(200);
cy.matchImageSnapshot('saveChagesShortcut'); cy.matchImageSnapshot('saveChagesShortcut');
}); });
}); });

View File

@ -1,4 +1,4 @@
context('Change topic position', () => { describe('Change topic position', () => {
beforeEach(() => { beforeEach(() => {
// Remove storage for autosave ... // Remove storage for autosave ...
cy.visit('/editor.html'); cy.visit('/editor.html');

View File

@ -1,4 +1,4 @@
context('Change Topic shape', () => { describe('Change Topic shape', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/editor.html'); cy.visit('/editor.html');
cy.reload(); cy.reload();
@ -16,7 +16,6 @@ context('Change Topic shape', () => {
.should('be.a', 'number') .should('be.a', 'number')
.should('eq', 0); .should('eq', 0);
cy.wait(200);
cy.matchImageSnapshot('changeToSquareShape'); cy.matchImageSnapshot('changeToSquareShape');
}); });
@ -40,7 +39,6 @@ context('Change Topic shape', () => {
.should('be.a', 'number') .should('be.a', 'number')
.should('be.lt', 5); .should('be.lt', 5);
cy.wait(200);
cy.matchImageSnapshot('changeToRoundedRectangle'); cy.matchImageSnapshot('changeToRoundedRectangle');
}); });
@ -50,7 +48,6 @@ context('Change Topic shape', () => {
cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover'); cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Line shape"]`).first().click(); cy.get(`[aria-label="Line shape"]`).first().click();
cy.wait(200);
cy.matchImageSnapshot('changeToLine'); cy.matchImageSnapshot('changeToLine');
}); });
@ -74,7 +71,6 @@ context('Change Topic shape', () => {
.should('be.a', 'number') .should('be.a', 'number')
.should('be.lt', 15); .should('be.lt', 15);
cy.wait(200);
cy.matchImageSnapshot('changeToEllipseShape'); cy.matchImageSnapshot('changeToEllipseShape');
}); });
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -6,6 +6,7 @@
"build": "webpack --config webpack.prod.js", "build": "webpack --config webpack.prod.js",
"playground": "webpack serve --config webpack.playground.js", "playground": "webpack serve --config webpack.playground.js",
"cy:run": "cypress run", "cy:run": "cypress run",
"cy:open": "cypress open",
"lint": "eslint src --ext js,ts,tsx", "lint": "eslint src --ext js,ts,tsx",
"test:integration": "start-server-and-test 'yarn playground' http-get://localhost:8081 'yarn cy:run'", "test:integration": "start-server-and-test 'yarn playground' http-get://localhost:8081 'yarn cy:run'",
"test": "yarn test:unit && yarn test:integration", "test": "yarn test:unit && yarn test:integration",
@ -29,6 +30,7 @@
"cypress-image-snapshot": "^4.0.1", "cypress-image-snapshot": "^4.0.1",
"eslint": "^7.14.0", "eslint": "^7.14.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-react": "^7.31.10", "eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",

View File

@ -1,4 +1,4 @@
context('Editor Page', () => { describe('Editor Page', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/c/maps/11/edit'); cy.visit('/c/maps/11/edit');
cy.get('[aria-label="vortex-loading"]', { timeout: 120000 }).should('not.exist'); cy.get('[aria-label="vortex-loading"]', { timeout: 120000 }).should('not.exist');

View File

@ -1,6 +1,4 @@
import MapsPage from '../pageObject/MapsPage'; describe('Forgot Password Page', () => {
context('Forgot Password Page', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/c/forgot-password'); cy.visit('/c/forgot-password');
}); });

View File

@ -1,4 +1,4 @@
context('Login Page', () => { describe('Login Page', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/c/login'); cy.visit('/c/login');
}); });

View File

@ -1,4 +1,4 @@
context('Maps Page', () => { describe('Maps Page', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/c/maps'); cy.visit('/c/maps');
cy.get('.MuiCard-root').should('have.length', 3); cy.get('.MuiCard-root').should('have.length', 3);

View File

@ -1,4 +1,4 @@
context('Registration Page', () => { describe('Registration Page', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/c/registration'); cy.visit('/c/registration');
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -4785,6 +4785,7 @@ __metadata:
emoji-picker-react: ^4.4.7 emoji-picker-react: ^4.4.7
eslint: ^7.14.0 eslint: ^7.14.0
eslint-config-prettier: ^8.5.0 eslint-config-prettier: ^8.5.0
eslint-plugin-cypress: ^2.12.1
eslint-plugin-react: ^7.31.10 eslint-plugin-react: ^7.31.10
eslint-plugin-react-hooks: ^4.6.0 eslint-plugin-react-hooks: ^4.6.0
html-webpack-plugin: ^5.5.0 html-webpack-plugin: ^5.5.0