Skip to content

Commit

Permalink
Critical user flows testing against the real lightweight network + ES…
Browse files Browse the repository at this point in the history
…M migration (#447)

Co-authored-by: Yoni Mekuria <[email protected]>
  • Loading branch information
shimkiv and ymekuria authored Sep 9, 2023
1 parent 75c14c9 commit 6799b4c
Show file tree
Hide file tree
Showing 56 changed files with 7,003 additions and 4,662 deletions.
26 changes: 26 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"root": true,
"env": {
"browser": true,
"node": true,
"jest": true
},
"extends": ["eslint:recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest"
},
"plugins": ["@typescript-eslint"],
"rules": {
"no-constant-condition": "off"
},
"ignorePatterns": [
"*.md",
"**/*.css",
"**/*.png",
"**/*.svg",
"**/*.woff",
"**/*.woff2",
"**/*.ico"
]
}
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

65 changes: 65 additions & 0 deletions .github/actions/e2e-shared/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Shared E2E testing steps"
description: "Shared steps for the E2E testing jobs"
inputs:
node-version:
description: "Node version"
required: true
os-type:
description: "OS type"
required: true
shell:
description: "Shell to use"
required: true
default: "bash"
test-script:
description: "Test script to run"
required: false
default: "npm run e2e:test"
artifacts-prefix:
description: "Job artifacts prefix"
required: false
default: "nightly-e2e-tests"
runs:
using: "composite"
steps:
- name: Setup NodeJS ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: Install Node dependencies, build and link the CLI app
run: |
npm ci
npm run build --if-present
npm link
shell: ${{ inputs.shell }}
- name: Install Playwright dependencies
run: npm run e2e:install
shell: ${{ inputs.shell }}
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "E2E Tests"
shell: ${{ inputs.shell }}
- name: Execute E2E tests on ${{ inputs.os-type }}
run: ${{ inputs.test-script }}
shell: ${{ inputs.shell }}
env:
CI: "true"
- name: Upload Mina logs
uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
if-no-files-found: ignore
name: mina-logs-${{ inputs.artifacts-prefix }}-node${{ inputs.node-version }}-${{ inputs.os-type }}
path: /tmp/*.log
retention-days: 5
- name: Upload E2E test artifacts
uses: actions/upload-artifact@v3
continue-on-error: true
if: always()
with:
if-no-files-found: ignore
name: ${{ inputs.artifacts-prefix }}-report-node${{ inputs.node-version }}-${{ inputs.os-type }}
path: reports/html-report/
retention-days: 30
36 changes: 0 additions & 36 deletions .github/workflows/e2e-test-ci.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/nightly-e2e-ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# We want to fail fast but we don't want platform specific issues to impact other workflows.
# So we extracted the tests into 3 separate jobs, one for each platform.
#

name: Nightly E2E tests (default branch)
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
jobs:
against-real-network-on-linux:
timeout-minutes: 125
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# https://github.com/shelljs/shelljs/issues/1133
node: [18, 20.6.1]
os: [ubuntu-latest]
services:
mina-local-network:
image: o1labs/mina-local-network:rampup-latest-lightnet
env:
NETWORK_TYPE: 'single-node'
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
volumes:
- /tmp:/root/logs
steps:
- name: Wait for Mina network readiness
uses: o1-labs/wait-for-mina-network-action@v1
with:
mina-graphql-port: 8080
max-attempts: 60
polling-interval-ms: 10000
- uses: actions/checkout@v3
- name: Use shared E2E testing steps
uses: ./.github/actions/e2e-shared
with:
node-version: ${{ matrix.node }}
os-type: ${{ matrix.os }}
shell: bash
against-mocked-network-on-macos:
timeout-minutes: 95
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# https://github.com/shelljs/shelljs/issues/1133
node: [18, 20.6.1]
os: [macos-latest]
steps:
- uses: actions/checkout@v3
- name: Use shared E2E testing steps
uses: ./.github/actions/e2e-shared
with:
node-version: ${{ matrix.node }}
os-type: ${{ matrix.os }}
shell: bash
against-mocked-network-on-windows:
timeout-minutes: 95
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# https://github.com/shelljs/shelljs/issues/1133
node: [18, 20.6.1]
os: [windows-latest]
steps:
- uses: actions/checkout@v3
- name: Use shared E2E testing steps
uses: ./.github/actions/e2e-shared
with:
node-version: ${{ matrix.node }}
os-type: ${{ matrix.os }}
shell: powershell
44 changes: 44 additions & 0 deletions .github/workflows/smoke-e2e-ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Smoke E2E tests
on:
push:
pull_request:
workflow_dispatch: {}
jobs:
against-real-network-on-linux:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# https://github.com/shelljs/shelljs/issues/1133
node: [18, 20.6.1]
os: [ubuntu-latest]
services:
mina-local-network:
image: o1labs/mina-local-network:rampup-latest-lightnet
env:
NETWORK_TYPE: 'single-node'
PROOF_LEVEL: 'none'
ports:
- 3085:3085
- 5432:5432
- 8080:8080
- 8181:8181
volumes:
- /tmp:/root/logs
steps:
- name: Wait for Mina network readiness
uses: o1-labs/wait-for-mina-network-action@v1
with:
mina-graphql-port: 8080
max-attempts: 60
polling-interval-ms: 10000
- uses: actions/checkout@v3
- name: Use shared E2E testing steps
uses: ./.github/actions/e2e-shared
with:
node-version: ${{ matrix.node }}
os-type: ${{ matrix.os }}
shell: bash
test-script: 'npm run e2e:test:smoke'
artifacts-prefix: 'smoke-e2e-tests'
11 changes: 8 additions & 3 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename "$0")"
readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
Expand All @@ -19,13 +19,18 @@ if [ -z "$husky_skip_init" ]; then
. ~/.huskyrc
fi

export readonly husky_skip_init=1
readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.12.0] - 2023-09-09

### Changed

- Project migrated to ESM [#447](https://github.com/o1-labs/zkapp-cli/pull/447).

### Added

- E2E tests for critical user flows against mocked and real networks [#447](https://github.com/o1-labs/zkapp-cli/pull/447).

## [0.11.2] - 2023-09-05

### Changed

- Update all instances of `SnarkyJS` to `o1js` throught the CLI to coincide with the rebrand of the package [#481](https://github.com/o1-labs/zkapp-cli/pull/481)
- Update all instances of `SnarkyJS` to `o1js` throught the CLI to coincide with the rebrand of the package [#481](https://github.com/o1-labs/zkapp-cli/pull/481)

## [0.11.1] - 2023-08-16

### Added

- A post build script was added to prepend a project repo name to built css asset urls so a NextJS UI project can be correctly deployed to GitHub Pages [#468](https://github.com/o1-labs/zkapp-cli/pull/468)
- A post build script was added to prepend a project repo name to built css asset urls so a NextJS UI project can be correctly deployed to GitHub Pages [#468](https://github.com/o1-labs/zkapp-cli/pull/468)

### Fixed

- A fix to deploy a NextJS UI project to GitHub Pages without manual configuration by running `npm run deploy` [#468](https://github.com/o1-labs/zkapp-cli/pull/468)


## [0.11.0] - 2023-07-14

### Changed
Expand Down
Loading

0 comments on commit 6799b4c

Please sign in to comment.