Skip to content

Commit 4a7081b

Browse files
committed
chore: add github actions to add automated tests
1 parent 2ab33e3 commit 4a7081b

File tree

13 files changed

+822
-10
lines changed

13 files changed

+822
-10
lines changed

.github/workflows/main.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Run Cypress Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-22.04
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
project:
18+
[
19+
"angular",
20+
"angular-standalone",
21+
# "react-next14-ts",
22+
# "react-next15-ts",
23+
# "react-vite-ts",
24+
# "react-webpack5-js",
25+
# "svelte-vite-ts",
26+
# "svelte-webpack-ts",
27+
# "vue3-vite-ts",
28+
# "vue3-webpack-ts",
29+
]
30+
31+
name: Cypress Tests
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 22
39+
# - name: Cypress Component Tests
40+
# uses: cypress-io/github-action@v6
41+
# with:
42+
# component: true
43+
# working-directory: "${{ matrix.project }}"
44+
# smoke tests the sample app and makes sure everything works as expected
45+
- name: Cypress E2E Tests
46+
uses: cypress-io/github-action@v6
47+
with:
48+
start: npm start
49+
wait-on: 'http://localhost:4200'
50+
working-directory: "${{ matrix.project }}"
51+
browser: chrome
52+

angular-standalone/cypress.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ export default defineConfig({
88
},
99
specPattern: "**/*.cy.ts",
1010
},
11+
12+
e2e: {
13+
setupNodeEvents(on, config) {
14+
// implement node event listeners here
15+
},
16+
},
1117
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Authentication', () => {
2+
it('Logs in', () => {
3+
cy.visit('http://localhost:4200')
4+
cy.get('[name="username"]').type('testuser')
5+
cy.get('[name="password"]').type('testpassword')
6+
cy.get('[type="submit"]').click()
7+
cy.get('h1').should('have.text', 'Welcome testuser')
8+
})
9+
})
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts 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'

angular-standalone/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular/cypress.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ export default defineConfig({
88
},
99
specPattern: "**/*.cy.ts",
1010
},
11+
12+
e2e: {
13+
setupNodeEvents(on, config) {
14+
// implement node event listeners here
15+
},
16+
},
1117
});

angular/cypress/e2e/login.cy.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Authentication', () => {
2+
it('Logs in', () => {
3+
cy.visit('http://localhost:4200')
4+
cy.get('[name="username"]').type('testuser')
5+
cy.get('[name="password"]').type('testpassword')
6+
cy.get('[type="submit"]').click()
7+
cy.get('h1').should('have.text', 'Welcome testuser')
8+
})
9+
})

angular/cypress/support/e2e.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.ts 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'

0 commit comments

Comments
 (0)