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 4a7081b
Show file tree
Hide file tree
Showing 13 changed files with 822 additions and 10 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 everything 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: {
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')
})
})
17 changes: 17 additions & 0 deletions angular-standalone/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
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: {
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')
})
})
17 changes: 17 additions & 0 deletions angular/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
Loading

0 comments on commit 4a7081b

Please sign in to comment.