Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan committed Feb 2, 2024
1 parent 13513b2 commit 32197e8
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 34 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,20 @@ jobs:

- name: Run Backend unit tests
run: npm run backend:test

e2e:
name: Test/E2E
runs-on: ubuntu-latest
# needs:
# - unit-frontend
# - unit-backend
steps:
- uses: convictional/[email protected]
with:
owner: topos-protocol
repo: e2e-tests
github_token: ${{ secrets.ROBOT_PAT_TRIGGER_E2E_WORKFLOWS }}
workflow_file_name: frontend:faucet.yml
ref: seb/too-343
wait_interval: 60
client_payload: '{ "faucet-ref": "${{ github.head_ref }}" }'
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.env
dist
dist-ssr
*.local

Expand All @@ -24,5 +21,10 @@ dist-ssr
*.sln
*.sw?

# Test coverage
**/node_modules
**/.env
**/dist
**/cypress/screenshots
# **/cypress/videos
**/coverage

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"frontend:test": "npm run test --workspace=frontend",
"frontend:test:coverage": "npm run test:coverage --workspace=frontend",
"frontend:test:e2e": "npm run test:e2e --workspace=frontend",
"test:e2e": "start-server-and-test 'npm run backend:start' http-get://localhost:3001 'npm run frontend:test:e2e'"
"test:e2e": "start-server-and-test 'npm run backend:start' http-get://localhost:3002 'npm run frontend:test:e2e'"
},
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:4173',
baseUrl: 'http://localhost:3002',
setupNodeEvents(on, config) {
// implement node event listeners here
},
Expand Down
25 changes: 3 additions & 22 deletions packages/frontend/cypress/e2e/home.cy.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
import { INFO } from '../../src/constants/wordings'

describe('Home', () => {
beforeEach(() => {
cy.visit('/')
})

it('should have Builders Program banner', () => {
cy.get('.ant-alert-banner')
.as('banner')
.find('span')
.contains(INFO.JOIN_BUILDERS_PROGRAM)
.should('exist')
.and('be.visible')
cy.get('@banner')
.find('a')
.as('banner-link')
.should('have.text', INFO.BUILDERS_PROGRAM)
.and(
'have.attr',
'href',
'https://builders.toposware.com/topos-builders-program-v1-0'
)
.and('not.be.disabled')
it('should have visible and enabled address input', () => {
cy.get('#faucet_address').should('be.visible').and('be.enabled')
})

it('should have disabled address input', () => {
cy.get('#faucet_address').should('be.visible').and('be.disabled')
})
// 0x4aab25b4fad0beaac466050f3a7142a502f4cf0a
})
Binary file removed packages/frontend/cypress/videos/home.cy.ts.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "tsc && vite build --mode development --watch --sourcemap true",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"test:e2e": "start-server-and-test 'npm run preview' http-get://localhost:4173 'cypress run'"
"test:e2e": "env-cmd --silent cypress run"
},
"dependencies": {
"@ant-design/icons": "^5.0.1",
Expand Down
5 changes: 0 additions & 5 deletions packages/frontend/src/constants/wordings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
export enum INFO {
BUILDERS_PROGRAM = 'Builders Program',
JOIN_BUILDERS_PROGRAM = 'Building with Topos? Apply for a grant!',
}

export enum SUCCESS {
GET_SUBNET_ASSET = 'Coins were successfully sent to your address on the selected subnets 🎉',
}
Expand Down

0 comments on commit 32197e8

Please sign in to comment.