Skip to content

Commit 8a0a964

Browse files
committed
Add cypress to CI
1 parent 10ea5bd commit 8a0a964

File tree

8 files changed

+3298
-108
lines changed

8 files changed

+3298
-108
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/.idea
55
tsconfig.tsbuildinfo
66
/coverage
7+
/cypress/videos/
8+
/.nyc_output/

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
language: node_js
22
node_js:
33
- '14'
4+
addons:
5+
apt:
6+
packages:
7+
- libgconf-2-4
8+
cache:
9+
# cache both npm modules and Cypress binary
10+
directories:
11+
- ~/.npm
12+
- ~/.cache
413
branches:
514
only:
615
- master
716
script:
817
- npm test -- --coverage
18+
- npm run cypress:run
919
- npm run report-coverage

cypress.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"componentFolder": "cypress/component",
3-
"testFiles": "**/*.tsx"
3+
"testFiles": "**/*.tsx",
4+
"video": false
45
}

cypress/component/click.spec.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ it('should select cell on click', () => {
6767
},
6868
})
6969
})
70+
71+
cy.get('.dsg-container')
72+
.click(20, 20)
73+
.then(() => {
74+
expect(ref.current.selection).to.deep.equal({
75+
min: {
76+
col: 0,
77+
row: 0,
78+
colId: 'a',
79+
},
80+
max: {
81+
col: 1,
82+
row: 1,
83+
colId: 'b',
84+
},
85+
})
86+
})
7087
})
7188

7289
export {}

cypress/plugins/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
/// <reference types="cypress" />
22
import injectDevServer from '@cypress/react/plugins/react-scripts'
3+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4+
// @ts-ignore
5+
import injectCoverage from '@cypress/code-coverage/task'
36

47
const pluginConfig: Cypress.PluginConfig = (on, config) => {
8+
injectCoverage(on, config)
9+
510
if (config.testingType === 'component') {
611
injectDevServer(on, config)
712
}

cypress/support/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
// @ts-ignore
33
import './commands'
4+
import '@cypress/code-coverage/support'
45

56
Cypress.on('uncaught:exception', (err) => {
67
if (err.message.includes('ResizeObserver loop limit exceeded')) {

0 commit comments

Comments
 (0)