Skip to content

Commit 3ffa6da

Browse files
authored
Merge pull request #19 from remotemobprogramming/cypress
added cypress smoketest
2 parents 767ed36 + a6b3dde commit 3ffa6da

8 files changed

Lines changed: 3447 additions & 6 deletions

File tree

.github/workflows/smoketest.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on:
2+
schedule:
3+
- cron: '*/5 * * * *'
4+
5+
jobs:
6+
smoketest:
7+
runs-on: ubuntu-latest
8+
name: Smoketest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
13+
- name: Cypress run
14+
uses: cypress-io/github-action@v4
15+
with:
16+
spec: cypress/cypress/e2e/smoketest.cy.js

.gitignore

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,135 @@ build/
3131

3232
### VS Code ###
3333
.vscode/
34+
35+
### Node ###
36+
# Logs
37+
logs
38+
*.log
39+
npm-debug.log*
40+
yarn-debug.log*
41+
yarn-error.log*
42+
lerna-debug.log*
43+
.pnpm-debug.log*
44+
45+
# Diagnostic reports (https://nodejs.org/api/report.html)
46+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
47+
48+
# Runtime data
49+
pids
50+
*.pid
51+
*.seed
52+
*.pid.lock
53+
54+
# Directory for instrumented libs generated by jscoverage/JSCover
55+
lib-cov
56+
57+
# Coverage directory used by tools like istanbul
58+
coverage
59+
*.lcov
60+
61+
# nyc test coverage
62+
.nyc_output
63+
64+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
65+
.grunt
66+
67+
# Bower dependency directory (https://bower.io/)
68+
bower_components
69+
70+
# node-waf configuration
71+
.lock-wscript
72+
73+
# Compiled binary addons (https://nodejs.org/api/addons.html)
74+
build/Release
75+
76+
# Dependency directories
77+
node_modules/
78+
jspm_packages/
79+
80+
# Snowpack dependency directory (https://snowpack.dev/)
81+
web_modules/
82+
83+
# TypeScript cache
84+
*.tsbuildinfo
85+
86+
# Optional npm cache directory
87+
.npm
88+
89+
# Optional eslint cache
90+
.eslintcache
91+
92+
# Optional stylelint cache
93+
.stylelintcache
94+
95+
# Microbundle cache
96+
.rpt2_cache/
97+
.rts2_cache_cjs/
98+
.rts2_cache_es/
99+
.rts2_cache_umd/
100+
101+
# Optional REPL history
102+
.node_repl_history
103+
104+
# Output of 'npm pack'
105+
*.tgz
106+
107+
# Yarn Integrity file
108+
.yarn-integrity
109+
110+
# dotenv environment variable files
111+
.env
112+
.env.development.local
113+
.env.test.local
114+
.env.production.local
115+
.env.local
116+
117+
# parcel-bundler cache (https://parceljs.org/)
118+
.cache
119+
.parcel-cache
120+
121+
# Next.js build output
122+
.next
123+
out
124+
125+
# Nuxt.js build / generate output
126+
.nuxt
127+
dist
128+
129+
# Gatsby files
130+
.cache/
131+
# Comment in the public line in if your project uses Gatsby and not Next.js
132+
# https://nextjs.org/blog/next-9-1#public-directory-support
133+
# public
134+
135+
# vuepress build output
136+
.vuepress/dist
137+
138+
# vuepress v2.x temp and cache directory
139+
.temp
140+
.cache
141+
142+
# Docusaurus cache and generated files
143+
.docusaurus
144+
145+
# Serverless directories
146+
.serverless/
147+
148+
# FuseBox cache
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
.dynamodb/
153+
154+
# TernJS port file
155+
.tern-port
156+
157+
# Stores VSCode versions used for testing VSCode extensions
158+
.vscode-test
159+
160+
# yarn v2
161+
.yarn/cache
162+
.yarn/unplugged
163+
.yarn/build-state.yml
164+
.yarn/install-state.gz
165+
.pnp.*

cypress/cypress.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { defineConfig } = require("cypress");
2+
3+
module.exports = defineConfig({
4+
e2e: {
5+
setupNodeEvents(on, config) {
6+
// implement node event listeners here
7+
},
8+
},
9+
});
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
describe('Mob.sh Timer', () => {
2+
const roomId = 'testroom-310a9c47-515c-4ad7-a229-ae8efbab7387';
3+
4+
it('index page is available', () => {
5+
cy.visit('https://timer.mob.sh')
6+
cy.contains('Mob Timer')
7+
})
8+
9+
it('room page is available', () => {
10+
cy.visit('https://timer.mob.sh/' + roomId)
11+
cy.contains('#' + roomId)
12+
})
13+
14+
it('help page is available', () => {
15+
cy.visit('https://timer.mob.sh/help' + roomId)
16+
cy.contains('Help')
17+
})
18+
19+
it('stats page is available', () => {
20+
cy.visit('https://timer.mob.sh/help' + roomId)
21+
cy.contains('Help')
22+
})
23+
24+
it('mob timer works', () => {
25+
cy.visit('https://timer.mob.sh/' + roomId)
26+
cy.get('[data-bs-toggle="modal"]').click()
27+
cy.get('#timer-input').clear().type("1")
28+
cy.wait(100)
29+
cy.get('.btn-close').click()
30+
cy.get('#timer-button').contains(1).click()
31+
cy.get('#timer').should('not.contain', '00:00')
32+
cy.get('#timer-type').should('not.contain', '☕')
33+
})
34+
35+
it('break timer works', () => {
36+
cy.visit('https://timer.mob.sh/' + roomId)
37+
cy.get('[data-bs-toggle="modal"]').click()
38+
cy.get('#breaktimer-input').clear().type("1")
39+
cy.wait(100)
40+
cy.get('.btn-close').click()
41+
cy.get('#breaktimer-button').contains(1).click()
42+
cy.get('#timer').should('not.contain', '00:00')
43+
cy.get('#timer-type').contains('☕')
44+
})
45+
46+
it('history increases for timer button', () => {
47+
cy.visit('https://timer.mob.sh/' + roomId)
48+
cy.get('[data-bs-toggle="modal"]').click()
49+
cy.get('#timer-input').clear().type("1")
50+
cy.wait(100)
51+
cy.get('.btn-close').click()
52+
let initialHistoryCountChainer = cy.get('#history-container').find('li').its('length')
53+
cy.get('#timer-button').contains(1).click().wait(100)
54+
cy.get('#history-container').find('li').its('length').then(currentCount => {
55+
initialHistoryCountChainer.should('eq', currentCount - 1)
56+
})
57+
})
58+
59+
it('history increases for breaktimer button', () => {
60+
cy.visit('https://timer.mob.sh/' + roomId)
61+
cy.get('[data-bs-toggle="modal"]').click()
62+
cy.get('#breaktimer-input').clear().type("1")
63+
cy.wait(100)
64+
cy.get('.btn-close').click()
65+
let initialHistoryCountChainer = cy.get('#history-container').find('li').its('length')
66+
cy.get('#breaktimer-button').contains(1).click().wait(100)
67+
cy.get('#history-container').find('li').its('length').then(currentCount => {
68+
initialHistoryCountChainer.should('eq', currentCount - 1)
69+
})
70+
})
71+
})

cypress/cypress/support/e2e.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

0 commit comments

Comments
 (0)