Skip to content

Commit

Permalink
test(cat-voices): refactoring playwright tests (#1164)
Browse files Browse the repository at this point in the history
* test(cat-voices): refactoring playwright tests

* test(cat-voices): playwright refactoring
  • Loading branch information
emiride authored Dec 5, 2024
1 parent 34de044 commit 5a42e7c
Show file tree
Hide file tree
Showing 27 changed files with 1,377 additions and 432 deletions.
2 changes: 2 additions & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ tablestats
tacho
testcov
testdocs
testid
testplan
testunit
thiserror
Expand All @@ -284,6 +285,7 @@ Toastify
todos
toggleable
tojunit
tomjs
Traceback
traefik
trailings
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.12.2
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ deps:

src:
FROM +deps
COPY keys.txt .
COPY --dir pages ./pages
COPY --dir tests ./tests
COPY --dir utils ./utils
COPY playwright.config.ts .
COPY global-setup.ts .
COPY wallet-tests.spec.ts .
COPY utils.ts .
COPY test-fixtures.ts .
COPY setup.ts .

package-test:
FROM +src
Expand All @@ -42,7 +43,9 @@ build-web:
package-app:
FROM nginx:alpine3.20-slim
ARG tag='latest'
COPY +build-web/web /usr/share/nginx/html/
COPY +build-web/web /app
COPY ./nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
SAVE IMAGE test-app:$tag

nightly-test:
Expand All @@ -51,12 +54,10 @@ nightly-test:
WITH DOCKER \
--compose compose.yml \
--load test-app:latest=(+package-app) \
--load test:latest=(+package-test) \
--service test-app \
--allow-privileged
--load test:latest=(+package-test)

RUN docker run --network=default_default --name=test test:latest && \
docker cp test:/results/cardano-wallet.junit-report.xml cardano-wallet.junit-report.xml
RUN docker run --network=default_default --name=test test:latest ; \
docker cp test:/results/cardano-wallet.junit-report.xml cardano-wallet.junit-report.xml ;
END
WAIT
SAVE ARTIFACT cardano-wallet.junit-report.xml AS LOCAL cardano-wallet.junit-report.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Wallet Automation

Welcome to wallet automation, a testing package in Playwright that tests wallet integration for Catalyst Voices.

## Introduction

Wallet automation is a testing package in Playwright that automates the wallet creation process for the Catalyst project.
It is a part of the Catalyst Voices ecosystem.

## Getting Started

1. Clone this repository:

```sh
git clone
cd catalyst-voices
```

2. Install Flutter and Dart:

```sh
brew install flutter
```

3. Bootstrap the project:

```sh
melos bootstrap
```

4. Execute earthly command from this directory:

```sh
earthly +package-app
```

5. Use docker compose to run the app:

```sh
docker compose up
```

The app should be running on `localhost:8000`.

6. You can now run tests with the following command:

```sh
npx playwright test
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ services:
test-app:
image: test-app:latest
ports:
- 8000:80
- "8000:80"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;

# https://cjycode.com/flutter_rust_bridge/manual/miscellaneous/web-cross-origin#background
add_header Cross-Origin-Opener-Policy "same-origin";
add_header Cross-Origin-Embedder-Policy "require-corp";

location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
# Ensure that /m4 (and any other SPA path) serves index.html
location /m4 {
root /app;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@types/node": "^20.14.12"
},
"dependencies": {
"@tomjs/unzip-crx": "^1.1.3",
"@types/node-fetch": "^2.6.11",
"dotenv": "^16.3.1",
"fs-extra": "^11.2.0",
Expand Down
Loading

0 comments on commit 5a42e7c

Please sign in to comment.