Skip to content

Commit 4b86857

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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1308
-75
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 the login via msw 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+
e2e: {
12+
supportFile: false,
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+
})

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+
e2e: {
12+
supportFile: false,
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+
})

0 commit comments

Comments
 (0)