Skip to content

Commit

Permalink
chore: add github actions to add automated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Jan 17, 2025
1 parent 2ab33e3 commit 4b86857
Show file tree
Hide file tree
Showing 50 changed files with 1,308 additions and 75 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run Cypress Tests

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
project:
[
"angular",
"angular-standalone",
"react-next14-ts",
"react-next15-ts",
"react-vite-ts",
"react-webpack5-js",
"svelte-vite-ts",
"svelte-webpack-ts",
"vue3-vite-ts",
"vue3-webpack-ts",
]

name: Cypress Tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cypress Component Tests
uses: cypress-io/github-action@v6
with:
component: true
working-directory: "${{ matrix.project }}"
# smoke tests the sample app and makes sure the login via msw works as expected
- name: Cypress E2E Tests
uses: cypress-io/github-action@v6
with:
start: npm start
wait-on: 'http://localhost:4200'
working-directory: "${{ matrix.project }}"
browser: chrome

6 changes: 6 additions & 0 deletions angular-standalone/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ export default defineConfig({
},
specPattern: "**/*.cy.ts",
},
e2e: {
supportFile: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
9 changes: 9 additions & 0 deletions angular-standalone/cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Authentication', () => {
it('Logs in', () => {
cy.visit('http://localhost:4200')
cy.get('[name="username"]').type('testuser')
cy.get('[name="password"]').type('testpassword')
cy.get('[type="submit"]').click()
cy.get('h1').should('have.text', 'Welcome testuser')
})
})
4 changes: 2 additions & 2 deletions angular-standalone/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions angular/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ export default defineConfig({
},
specPattern: "**/*.cy.ts",
},
e2e: {
supportFile: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
9 changes: 9 additions & 0 deletions angular/cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Authentication', () => {
it('Logs in', () => {
cy.visit('http://localhost:4200')
cy.get('[name="username"]').type('testuser')
cy.get('[name="password"]').type('testpassword')
cy.get('[type="submit"]').click()
cy.get('h1').should('have.text', 'Welcome testuser')
})
})
Loading

0 comments on commit 4b86857

Please sign in to comment.