Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add nitric run tests via dashboard tests #756

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/dashboard-run-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: Dashboard Tests with nitric run

on:
push:
branches:
- main
- develop
pull_request:

concurrency:
group: ci-dash-run-tests-${{ github.ref_name }}
cancel-in-progress: true

env:
GOPROXY: https://proxy.golang.org
FATHOM_SITE: FAKE1234

jobs:
nitric-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: cli

- uses: actions/setup-node@v4
with:
node-version: 21

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.22

- name: Build Nitric
run: |
cd ${{ github.workspace }}/cli
make build
mv bin/nitric $(go env GOPATH)/bin/nitric

- name: Run nitric run with test-app in the background
run: |
cd ${{ github.workspace }}/cli/pkg/dashboard/frontend/test-app
yarn install
nitric run --ci &
sleep 15

- name: Run Tests
uses: cypress-io/github-action@v5
with:
install: false
wait-on: "http://localhost:49152"
# wait for 3 minutes for the server to respond
wait-on-timeout: 180
working-directory: cli/pkg/dashboard/frontend
browser: chrome

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cli/pkg/dashboard/frontend/cypress/screenshots

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: cli/pkg/dashboard/frontend/cypress/videos
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Dashboard Tests
name: Dashboard Tests with nitric start

on:
push:
Expand All @@ -9,13 +9,12 @@ on:
pull_request:

concurrency:
group: ci-dash-tests-${{ github.ref_name }}
group: ci-dash-start-tests-${{ github.ref_name }}
cancel-in-progress: true

env:
GOPROXY: https://proxy.golang.org
FATHOM_SITE: FAKE1234
NITRIC_HTTP_PROXY_PORT: 8000

jobs:
nitric-dashboard:
Expand All @@ -28,7 +27,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 21

- name: Lint Dashboard
working-directory: cli/pkg/dashboard/frontend
Expand All @@ -40,7 +39,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.22

- name: Build Nitric
run: |
Expand All @@ -64,13 +63,13 @@ jobs:
working-directory: cli/pkg/dashboard/frontend
browser: chrome

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cli/pkg/dashboard/frontend/cypress/screenshots

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/frontend/cypress/e2e/api-explorer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('APIs spec', () => {
beforeEach(() => {
cy.viewport('macbook-16')
cy.visit('/')
cy.wait(500)
cy.wait(1000)
})

it('should retrieve correct apis and endpoints', () => {
Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/frontend/cypress/e2e/architecture.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const expectedNodes = [
'test-bucket',
'subscribe-tests',
'subscribe-tests-2',
':8000',
':',
'my-db',
'my-second-db',
'services/my-test-service.ts',
Expand Down
2 changes: 1 addition & 1 deletion pkg/dashboard/frontend/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "nitric typescript starter template",
"private": true,
"dependencies": {
"@nitric/sdk": "^1.2.2",
"@nitric/sdk": "^1.3.0",
"express": "^4.18.2",
"pg": "^8.12.0"
},
Expand Down
Loading
Loading