Skip to content

Commit

Permalink
Merge pull request #86 from nation3/85-cypress
Browse files Browse the repository at this point in the history
✅ test: add cypress
  • Loading branch information
aahna-ashina authored Sep 2, 2024
2 parents ff546f5 + 1d8d8d2 commit 1dd1f74
Show file tree
Hide file tree
Showing 8 changed files with 2,879 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI - Build

on:
push:
Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI - Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: npm run build
start: npm start
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# cypress
cypress/downloads
cypress/screenshots
cypress/videos
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ npm run dev
```

Go to http://localhost:3000

## Integration Testing

Run the integration tests:
```
npm run cy:open
```

Run the integration tests headlessly:
```
npm run cy:run
```
8 changes: 8 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "cypress"

export default defineConfig({
e2e: {
supportFile: false,
baseUrl: 'http://localhost:3000'
}
})
9 changes: 9 additions & 0 deletions cypress/e2e/index.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Nation3 App UI', () => {

it('should load the index page', () => {
cy.visit('/')
cy.get('h1').contains('Nation3 Citizens')
})
})

export {}
Loading

0 comments on commit 1dd1f74

Please sign in to comment.