Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
38363e0
collator test and yaml test
MariuszSzpyt Mar 31, 2025
0dbba18
Update requirements.txt
MariuszSzpyt Mar 31, 2025
0b3408b
feat: add python packages management using PDM with proper caching an…
tenequm Apr 1, 2025
0c4dca1
chore: clean the dependencies to leave only the ones that are actuall…
tenequm Apr 1, 2025
32174ad
fix: update playwright command to install missing required dependenci…
tenequm Apr 1, 2025
2ca730a
fix: test new headless approash
tenequm Apr 1, 2025
198924c
fix: configure playwright browser to run in headless mode when inside…
tenequm Apr 1, 2025
2771a03
fix: remove unnecessary dependencies from Playwright installation com…
tenequm Apr 1, 2025
0d4864b
Update collator_details_prod_test.py
MariuszSzpyt Apr 6, 2025
9b379a4
Create wallets_prod_test.py
MariuszSzpyt Apr 7, 2025
15b7e8a
organising utils
MariuszSzpyt Apr 7, 2025
1a187d6
marking tests
MariuszSzpyt Apr 7, 2025
d13bc5d
Update gasp-prod-smoke-test.yml
MariuszSzpyt Apr 7, 2025
e1d7747
Update gasp-prod-smoke-test.yml
MariuszSzpyt Apr 7, 2025
91ab985
Update pyproject.toml
MariuszSzpyt Apr 7, 2025
a71ca93
reorganising tests
MariuszSzpyt Apr 7, 2025
09e8e18
test naming
MariuszSzpyt Apr 7, 2025
d1a3ca5
swap test
MariuszSzpyt Apr 7, 2025
92859e2
Update test_prod_swap.py
MariuszSzpyt Apr 7, 2025
2ed0d1c
adding more utils
MariuszSzpyt Apr 9, 2025
55d8fcf
update wallet checks
MariuszSzpyt Apr 9, 2025
b58e5e9
externalising utils
MariuszSzpyt Apr 9, 2025
fbf58d7
Update test_prod_swap.py
MariuszSzpyt Apr 9, 2025
ee1e8aa
Update gasp-prod-smoke-test.yml
MariuszSzpyt Apr 10, 2025
8204db2
Update gasp-prod-smoke-test.yml
MariuszSzpyt Apr 10, 2025
c6eddd4
sync workflows
MariuszSzpyt Apr 15, 2025
b1a6bdd
Update pdm.lock
MariuszSzpyt Apr 15, 2025
07b776a
Update gasp-prod-smoke-test.yml
MariuszSzpyt Apr 22, 2025
4e16c3b
update workflow and tests
MariuszSzpyt Apr 22, 2025
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
177 changes: 70 additions & 107 deletions .github/workflows/gasp-prod-smoke-test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: GASP UI prod smoke tests
name: GASP UI Prod AI Tests

on:
workflow_dispatch:
schedule:
- cron: "30 7 * * *"

jobs:
setup-report:
name: setup testmo report
name: Setup Testmo Report
runs-on: ubuntu-latest
outputs:
testmo-run-id: ${{ steps.setTestRun.outputs.testmo-run-id }}
Expand All @@ -26,119 +27,85 @@ jobs:
- name: Create test run
run: |
testmo automation:run:create \
--instance https://mangata-finance.testmo.net \
--instance https://mangata-finance.testmo.net \
--project-id 2 \
--name "FE GASP prod smoke test run" \
--name "GASP UI Prod AI Tests" \
--resources resources.json \
--source "gasp-prod-e2e-job" > testmo-run-id.txt
--source "gasp-prod-ai-tests" > testmo-run-id.txt
ID=$(cat testmo-run-id.txt)
echo "testmo-run-id=$ID" >> $GITHUB_OUTPUT
echo "ID=$ID" >> $GITHUB_ENV

env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
id: setTestRun

e2e-tm:
name: Run UI tests
playwright-tests:
name: Run Playwright Tests - ${{ matrix.test_group }}
needs: [setup-report]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
command: ["first"]
runs-on: ubuntu-latest
test_group: ["wallet", "collator", "swap"]
env:
API_URL: "wss://collator-01-ws-rollup-prod.gasp.xyz"
UI_URL: https://app.gasp.xyz/
TEST_SUDO_NAME: ${{ secrets.DEV_SUDO_NAME }}
MNEMONIC_META: ${{ secrets.MNEMONIC_PROD_META }}
PRIVKEY_META: ${{ secrets.PRIVKEY_PROD_META }}
TEST_SCRIPT: "test-gasp-prod"
NODE_ENV: test
SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
UI_URL: https://app.gasp.xyz
LMNR_PROJECT_API_KEY: ${{ secrets.LMNR_PROJECT_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
TESTMO_RUN_ID: ${{needs.setup-report.outputs.testmo-run-id}}

steps:
- name: Start Selenoid Server
uses: Xotabu4/selenoid-github-action@v2
- uses: actions/checkout@v4
with:
selenoid-start-arguments: |
--args "-timeout 300s" --browsers 'chrome:119.0;chrome:129.0'
ref: 'FE-AI-tests'

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
node-version: 20
cache: yarn

- name: Install dependencies with Yarn
run: yarn
- name: Tsc code quality check
run: yarn tsc-lint
- name: ESLint code quality check
run: yarn eslint
- name: installed packages
run: yarn list

- name: is selenoid started?
run: curl http://localhost:4444/status

python-version-file: 'fe-ai-tests/.python-version'
cache: true
cache-dependency-path: 'fe-ai-tests/pdm.lock'

- name: Install dependencies with PDM
run: cd fe-ai-tests && pdm install

- name: Install Playwright browsers
run: cd fe-ai-tests && pdm run playwright install --only-shell chromium

- name: Create directories for test artifacts
run: mkdir -p fe-ai-tests/tmp/record_videos fe-ai-tests/tmp/agent_history-${{ matrix.test_group }} fe-ai-tests/reports

- name: Run tests
run: yarn test-gasp-prod-${{ matrix.command }}

- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: JEST UI Tests ${{ matrix.command }} # Name of the check run which will be created
path: reports/*.xml # Path to test results
reporter: jest-junit # Format of test results

run: cd fe-ai-tests && pdm run pytest tests/ -m "${{ matrix.test_group }}" -v --junitxml=reports/junit-${{ matrix.test_group }}.xml

- name: Install testmo
run: yarn global add @testmo/testmo-cli

- name: Submit results to the testmo-run
- name: Submit results to Testmo
if: always()
run: |
testmo automation:run:submit-thread \
--instance https://mangata-finance.testmo.net \
--run-id ${{needs.setup-report.outputs.testmo-run-id}} \
--results reports/*.xml
--results fe-ai-tests/reports/junit-${{ matrix.test_group }}.xml
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
continue-on-error: true

- name: Sleep for 5 seconds
run: sleep 10s #close buffers of videos.

- name: Copy video files to reports folder
if: success() || failure()
run: "cp ~/.aerokube/selenoid/* -r reports/artifacts/"

- name: Create reports zip
uses: vimtor/action-zip@v1
if: success() || failure()
with:
files: reports/
dest: reports.zip

- name: Archive report files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ReportData ${{ matrix.command }}
path: reports.zip

- name: Archive report files

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: TestReport ${{ matrix.command }}
path: reports/html-report/report.html

name: test-results-${{ matrix.test_group }}
path: |
fe-ai-tests/tmp/record_videos
fe-ai-tests/tmp/agent_history-${{ matrix.test_group }}
fe-ai-tests/reports/junit-${{ matrix.test_group }}.xml
retention-days: 7

test-complete:
needs: [setup-report, e2e-tm]
needs: [setup-report, playwright-tests]
if: always()
runs-on: ubuntu-latest

Expand All @@ -150,41 +117,37 @@ jobs:
run: |
npx testmo automation:run:complete \
--instance https://mangata-finance.testmo.net \
--run-id ${{needs.setup-report.outputs.testmo-run-id}} \
--run-id ${{needs.setup-report.outputs.testmo-run-id}}
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
continue-on-error: true

slack-notify-ok:
needs: [e2e-tm, setup-report]
needs: [playwright-tests, setup-report]
if: success()
runs-on: ubuntu-latest

steps:
- name: Slack Notification - OK
if: success()
- name: Slack Notification - Success
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.STG_SLACK_WEBHOOK }}
SLACK_TITLE: "PROD GASP smoke UI tests - results - OK"
SLACK_INCOMING_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "GASP UI Playwright Tests - Success"
SLACK_COLOR: "#00ff11"
SLACK_MESSAGE: "Test succeed in [ ${{ env.TEST_SCRIPT }} ]
testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"
GITHUB_REF: "https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}"

# slack-notify-nook:
# needs: [e2e-tm]
# if: failure()
# runs-on: ubuntu-latest

# steps:
# - name: Slack Notification - Error
# uses: bryannice/[email protected]
# env:
# SLACK_INCOMING_WEBHOOK: ${{ secrets.STG_SLACK_WEBHOOK }}
# SLACK_TITLE: "PROD GASP smoke UI tests - results - NOOK"
# SLACK_COLOR: "#ff0011"
# SLACK_MESSAGE: "Test failures [ ${{ env.TEST_SCRIPT }} ]
# testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"
# GITHUB_REF: "https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}"
SLACK_MESSAGE: "Playwright tests passed successfully!
Testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"

slack-notify-nook:
needs: [playwright-tests, setup-report]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Notification - Failure
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_TITLE: "GASP UI Playwright Tests - Failure"
SLACK_COLOR: "#ff0011"
SLACK_MESSAGE: "Playwright tests failed. Please check the logs for details.
Testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"

18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,21 @@ reports/**/*
.yarn/cache
.yarn/*.*
*.sqlite
/fe-ai-tests/tmp

tmp
**/tmp

# Python cache files
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/

# PDM
.pdm-build/
__pypackages__/
.pdm-python

# Virtual environment
.venv/
10 changes: 10 additions & 0 deletions fe-ai-tests/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# GASP Frontend Tests Environment Variables

# URL of the GASP application
UI_URL=https://app.gasp.xyz

# LMNR Project API Key (required for testing)
LMNR_PROJECT_API_KEY=your_lmnr_key_here

# Anthropic API Key (required for Claude AI interactions)
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
1 change: 1 addition & 0 deletions fe-ai-tests/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
55 changes: 55 additions & 0 deletions fe-ai-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# GASP Frontend AI Tests

Automated tests for the GASP UI using Playwright and PDM.

## Getting Started

This project uses [PDM](https://pdm-project.org/) for dependency management.

1. **Install PDM**: Follow the [official installation guide](https://pdm-project.org/en/latest/#installation)

2. **Setup project**:

```bash
cd fe-ai-tests
pdm install
pdm run playwright install chromium
```

3. **Run tests**:

```bash
# Run specific test
pdm run pytest collator_details_prod_test.py -v

# Run all tests
pdm run pytest
```

## Environment Variables

Create a `.env` file with:

```bash
UI_URL=https://app.gasp.xyz
LMNR_PROJECT_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
```

## Managing Dependencies

```bash
# Add a new dependency
pdm add package-name

# Add a development dependency (like testing tools)
pdm add -d pytest

# Update all dependencies
pdm update
```

## Common Issues

1. **Missing browsers**: Run `pdm run playwright install chromium`
2. **No environment activation needed**: Use `pdm run` to execute commands in the environment
Loading