Fix tests
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
name: Cypress Tests
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cypress-run:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
# Install NPM dependencies, cache them correctly
|
||||||
|
# and run all Cypress tests
|
||||||
|
- name: Cypress run
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
with:
|
||||||
|
build: yarn build
|
||||||
|
start: yarn preview
|
||||||
@@ -8,6 +8,7 @@ describe('Auto sync tests', () => {
|
|||||||
cy.get('#view').should('not.have.class', 'outOfSync');
|
cy.get('#view').should('not.have.class', 'outOfSync');
|
||||||
cy.get('#editor').type(' C --> Test');
|
cy.get('#editor').type(' C --> Test');
|
||||||
cy.get('#view').should('have.class', 'outOfSync');
|
cy.get('#view').should('have.class', 'outOfSync');
|
||||||
|
cy.getLocalStorage('codeStore').snapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show/hide sync button with auto sync', () => {
|
it('should show/hide sync button with auto sync', () => {
|
||||||
@@ -27,6 +28,6 @@ describe('Auto sync tests', () => {
|
|||||||
cy.get('#autoSync').check();
|
cy.get('#autoSync').check();
|
||||||
cy.get('#editor').type('ing');
|
cy.get('#editor').type('ing');
|
||||||
cy.get('#view').should('not.have.class', 'outOfSync');
|
cy.get('#view').should('not.have.class', 'outOfSync');
|
||||||
cy.wrap(localStorage).snapshot();
|
cy.getLocalStorage('codeStore').snapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe('Site Loads', () => {
|
|||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.url().should('include', '/edit');
|
cy.url().should('include', '/edit');
|
||||||
cy.contains('History').click();
|
cy.contains('History').click();
|
||||||
cy.wrap(localStorage).snapshot();
|
cy.getLocalStorage('codeStore').snapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Check Redirect from old URL', () => {
|
it('Check Redirect from old URL', () => {
|
||||||
@@ -19,6 +19,6 @@ describe('Site Loads', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
cy.contains('History').click();
|
cy.contains('History').click();
|
||||||
cy.wrap(localStorage).snapshot();
|
cy.getLocalStorage('codeStore').snapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+6
-28
@@ -1,41 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"Site Loads": {
|
"Site Loads": {
|
||||||
"Check Home page load": {
|
"Check Home page load": {
|
||||||
"1": {
|
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n \",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":true,\"autoSync\":true,\"updateDiagram\":true}"
|
||||||
"manualHistoryStore": "[]",
|
|
||||||
"autoHistoryMode": "false",
|
|
||||||
"codeStore": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n \",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}",
|
|
||||||
"autoHistoryStore": "[]"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Check Redirect from old URL": {
|
"Check Redirect from old URL": {
|
||||||
"1": {
|
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}"
|
||||||
"manualHistoryStore": "[]",
|
|
||||||
"autoHistoryMode": "false",
|
|
||||||
"codeStore": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}",
|
|
||||||
"autoHistoryStore": "[]"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"__version": "7.3.0",
|
"__version": "7.3.0",
|
||||||
"Diagram updates when code is edited": {
|
|
||||||
"Editor Test": {
|
|
||||||
"1": {
|
|
||||||
"manualHistoryStore": "[]",
|
|
||||||
"autoHistoryMode": "false",
|
|
||||||
"codeStore": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Test\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}",
|
|
||||||
"autoHistoryStore": "[]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Auto sync tests": {
|
"Auto sync tests": {
|
||||||
|
"should dim diagram when code is edited": {
|
||||||
|
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Test\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":false,\"updateDiagram\":false}"
|
||||||
|
},
|
||||||
"should not dim diagram when code is in sync": {
|
"should not dim diagram when code is in sync": {
|
||||||
"1": {
|
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Testing\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}"
|
||||||
"manualHistoryStore": "[]",
|
|
||||||
"autoHistoryMode": "false",
|
|
||||||
"codeStore": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Testing\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}",
|
|
||||||
"autoHistoryStore": "[]"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,3 +25,4 @@
|
|||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||||
import * as snapshot from '@cypress/snapshot';
|
import * as snapshot from '@cypress/snapshot';
|
||||||
snapshot.register();
|
snapshot.register();
|
||||||
|
import 'cypress-localstorage-commands';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"types": ["cypress"]
|
"types": ["cypress", "cypress-localstorage-commands"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.*"]
|
"include": ["**/*.*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"cssnano": "^5.0.1",
|
"cssnano": "^5.0.1",
|
||||||
"cypress": "^7.3.0",
|
"cypress": "^7.3.0",
|
||||||
|
"cypress-localstorage-commands": "^1.4.4",
|
||||||
"eslint": "^7.27.0",
|
"eslint": "^7.27.0",
|
||||||
"eslint-config-prettier": "^8.1.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-plugin-cypress": "^2.11.3",
|
"eslint-plugin-cypress": "^2.11.3",
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1131,6 +1131,11 @@ csso@^4.2.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
css-tree "^1.1.2"
|
css-tree "^1.1.2"
|
||||||
|
|
||||||
|
cypress-localstorage-commands@^1.4.4:
|
||||||
|
version "1.4.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/cypress-localstorage-commands/-/cypress-localstorage-commands-1.4.4.tgz#96ebce71b78895bd34a96c6d424b5de18a257b82"
|
||||||
|
integrity sha512-j502dbaQxTkz8iXYPClpYn2AIFyMZvvODNNHVZVoKBSkKOEuWAx3/RT4RvH0naV4/T05oUw2O9Cm5VxeZbyxiw==
|
||||||
|
|
||||||
cypress@^7.3.0:
|
cypress@^7.3.0:
|
||||||
version "7.3.0"
|
version "7.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-7.3.0.tgz#17345b8d18681c120f033e7d8fd0f0271e9d0d51"
|
resolved "https://registry.yarnpkg.com/cypress/-/cypress-7.3.0.tgz#17345b8d18681c120f033e7d8fd0f0271e9d0d51"
|
||||||
|
|||||||
Reference in New Issue
Block a user