Skip to content

Commit

Permalink
feat: integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Feb 21, 2024
1 parent 7347c9b commit dca8142
Show file tree
Hide file tree
Showing 87 changed files with 12,580 additions and 326 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/dist/
**.env
**.env
2 changes: 0 additions & 2 deletions .github/workflows/app-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ jobs:
uses: actions/cache@v3
env:
cache-name: cache-node-modules
# Workaround for bug https://github.com/typicode/husky/issues/991
HUSKY: 0
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/integration-tests-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Integration test - API
on: pull_request

jobs:
runTests:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
checks: write
strategy:
matrix:
node-version: ['lts/*'] # 18.17.1 or lts/*
test-pattern:
- accounts.test.ts
- addresses.test.ts
- batches.test.ts
- blocks.test.ts
- contracts.test.ts
- logs.test.ts
- stats.test.ts
- tokens.test.ts
- transactions.test.ts
name: 'API test set: ${{ matrix.test-pattern}} / Node: ${{ matrix.node-version}}'
steps:
- name: Checkout with Submodule
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: |
npm ci --no-audit
npx playwright install --with-deps chromium
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Start docker containers
run: |
docker-compose -f "docker-compose.yaml" up -d --build
- name: List running containers
run: docker ps

- name: API tests run (parallel)
run: |
cd packages/integration-tests
npx jest --verbose --testPathPattern=${{ matrix.test-pattern }}
- name: Stop containers
if: always()
run: |
docker-compose -f "docker-compose.yaml" down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ cypress/videos/
cypress/screenshots/
tests/e2e/reports/
**/tests/e2e/artifacts/
**/playbook/artifacts-zk/
**/playbook/artifacts/
**/playbook/buffer/
**/playbook/cache-zk/
**/playbook/cache/

# Logs
logs
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib",
"editor.tabSize": 2
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This repository is a monorepo consisting of 4 packages:
- [API](./packages/api) - a service providing Web API for retrieving structured [zkSync Era](https://zksync.io) blockchain data collected by [Worker](./packages/worker). It connects to the Worker's database to be able to query the collected data.
- [App](./packages/app) - a front-end app providing an easy-to-use interface for users to view and inspect transactions, blocks, contracts and more. It makes requests to the [API](./packages/api) to get the data and presents it in a way that's easy to read and understand.

Also the repository contains [integration-test](./packages/integration-tests) package with a set of API and UI tests. Follow this [Readme](./packages/integration-tests/README.md) for more details.

## 🏛 Architecture
The following diagram illustrates how are the block explorer components connected:

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ volumes:
geth:
postgres:
zksync-config:
zksync-data:
zksync-data:
Loading

0 comments on commit dca8142

Please sign in to comment.