Skip to content

Commit 8f4b6ec

Browse files
authored
Merge pull request #645 from pharindoko/feat/add-e2e-tests
refactor(server): add e2e tests for server pages
2 parents a69fc04 + 55eab11 commit 8f4b6ec

File tree

10 files changed

+2509
-1
lines changed

10 files changed

+2509
-1
lines changed

package-lock.json

Lines changed: 1478 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"homepage": "https://github.com/pharindoko/json-serverless.git#readme",
2020
"devDependencies": {
2121
"@types/jest": "26.0.14",
22+
"cypress": "^5.3.0",
2223
"cz-conventional-changelog": "3.3.0",
2324
"typescript": "4.0.3"
2425
},

packages/server/cypress.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('My First Test', () => {
2+
it('Open Swagger ui', () => {
3+
cy.visit('/ui');
4+
});
5+
6+
it('Open Graphql Interface', () => {
7+
cy.visit('/graphql');
8+
});
9+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference types="cypress" />
2+
// ***********************************************************
3+
// This example plugins/index.js can be used to load plugins
4+
//
5+
// You can change the location of this file or turn off loading
6+
// the plugins file with the 'pluginsFile' configuration option.
7+
//
8+
// You can read more here:
9+
// https://on.cypress.io/plugins-guide
10+
// ***********************************************************
11+
12+
// This function is called when a project is opened or re-opened (e.g. due to
13+
// the project's config changing)
14+
15+
/**
16+
* @type {Cypress.PluginConfig}
17+
*/
18+
module.exports = (on, config) => {
19+
// `on` is used to hook into various events Cypress emits
20+
// `config` is the resolved Cypress config
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Cypress.on('window:before:load', (win) => {
2+
cy.spy(win.console, 'error');
3+
cy.spy(win.console, 'warn');
4+
});
5+
6+
afterEach(() => {
7+
cy.window().then((win) => {
8+
expect(win.console.error).to.have.callCount(0);
9+
expect(win.console.warn).to.have.callCount(0);
10+
});
11+
});

0 commit comments

Comments
 (0)