From ec50ef0d5f6cd63abe40493e90cdb5fc13e1fa30 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 22 Apr 2025 20:29:04 +0200 Subject: [PATCH 01/46] fix(workflow): make 'network' input a choice type for workflow_dispatch --- .github/workflows/playground_selenium.yaml | 57 +++++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index cab2e2f180..395c753c31 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -2,38 +2,69 @@ name: Playground Selenium Tests on: workflow_dispatch: + inputs: + network: + description: "Select the target environment for Selenium tests" + required: true + type: choice + default: "dev" + options: + - "local" + - "dev" + - "qa" + - "test" + - "main" schedule: - cron: "0 6 * * *" jobs: selenium-run: runs-on: ubuntu-latest + env: + NETWORK: ${{ github.event.inputs.network }} steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 - - name: Setting up Python + + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Installing all necessary packages - run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - - name: Node install + + - name: Install Python dependencies + run: | + pip install -r packages/playground/tests/frontend_selenium/requirements.txt + pip install pytest-html + + - name: Set up Node.js 18 uses: actions/setup-node@v4 with: node-version: 18 - - name: Yarn install - run: yarn install - - name: Lerna Build - run: yarn lerna run build - - name: Yarn Serve + + - name: Install JS dependencies & build + run: | + yarn install + yarn lerna run build + + - name: Start playground server run: make run project=playground & - - name: Wait for localhost + + - name: Wait for server to be ready run: sleep 60 - - name: Run tests + + - name: Run Selenium tests working-directory: ./packages/playground/tests/frontend_selenium env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} - run: python -m pytest -v + NETWORK: ${{ env.NETWORK }} + run: | + python -m pytest -v --html=report.html + + - name: Upload HTML report + uses: actions/upload-artifact@v3 + with: + name: selenium-report-${{ env.NETWORK }} + path: packages/playground/tests/frontend_selenium/report.html From 6c4fc38fe1ef586d74e0e6be0fc32a17319f905e Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Wed, 23 Apr 2025 08:15:43 +0200 Subject: [PATCH 02/46] adding branch choosing and making lerna only runs on local --- .github/workflows/playground_selenium.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 395c753c31..fcf764e2b9 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -3,17 +3,21 @@ name: Playground Selenium Tests on: workflow_dispatch: inputs: + branch: + description: "Select which Git branch to run against" + required: true + default: "development" network: - description: "Select the target environment for Selenium tests" + description: "Select the target environment" required: true type: choice default: "dev" options: - - "local" - - "dev" - - "qa" - - "test" - - "main" + - local + - dev + - qa + - test + - main schedule: - cron: "0 6 * * *" @@ -22,9 +26,12 @@ jobs: runs-on: ubuntu-latest env: NETWORK: ${{ github.event.inputs.network }} + steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch }} - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -39,9 +46,10 @@ jobs: - name: Set up Node.js 18 uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "18" - name: Install JS dependencies & build + if: ${{ github.event.inputs.network == 'local' }} run: | yarn install yarn lerna run build From 6c76dd649c36700534f8ce8d709c5dc946296e68 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Mon, 5 May 2025 19:01:30 +0300 Subject: [PATCH 03/46] adding workflow to be build on any network or to run on the current network --- .github/workflows/playground_selenium.yaml | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index fcf764e2b9..8b561d8062 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -3,14 +3,9 @@ name: Playground Selenium Tests on: workflow_dispatch: inputs: - branch: - description: "Select which Git branch to run against" - required: true - default: "development" network: - description: "Select the target environment" + description: "Target environment" required: true - type: choice default: "dev" options: - local @@ -18,20 +13,27 @@ on: - qa - test - main + local_build: + description: "Build & serve dashboard locally?" + required: false + type: boolean + default: false + schedule: - cron: "0 6 * * *" jobs: - selenium-run: + selenium: runs-on: ubuntu-latest + + # fall back to 'dev' and 'false' when triggered by schedule env: - NETWORK: ${{ github.event.inputs.network }} + NETWORK: ${{ github.event.inputs.network || 'dev' }} + LOCAL_BUILD: ${{ github.event.inputs.local_build || false }} steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.branch }} - name: Set up Python 3.10 uses: actions/setup-python@v5 @@ -46,18 +48,21 @@ jobs: - name: Set up Node.js 18 uses: actions/setup-node@v4 with: - node-version: "18" + node-version: 18 - - name: Install JS dependencies & build - if: ${{ github.event.inputs.network == 'local' }} + # Only build & serve locally when local_build=true + - name: Install JS deps & build dashboard + if: ${{ env.LOCAL_BUILD == 'true' }} run: | yarn install yarn lerna run build - - name: Start playground server + - name: Start local dashboard + if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & - - name: Wait for server to be ready + - name: Wait for local server + if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - name: Run Selenium tests @@ -68,8 +73,10 @@ jobs: STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} NETWORK: ${{ env.NETWORK }} + # Decide which URL to hit + DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard-%s.grid.tf', env.NETWORK) }} run: | - python -m pytest -v --html=report.html + python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" - name: Upload HTML report uses: actions/upload-artifact@v3 From eb49c47004351afe1f4d1fb117ce5bfecfb942c5 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 13:15:23 +0300 Subject: [PATCH 04/46] removing local from choices --- .github/workflows/playground_selenium.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 8b561d8062..9cab062945 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: network: - description: "Target environment" + description: "Select the target environment" required: true + type: choice default: "dev" options: - - local - dev - qa - test @@ -26,7 +26,7 @@ jobs: selenium: runs-on: ubuntu-latest - # fall back to 'dev' and 'false' when triggered by schedule + # fall back to 'dev' and 'false' when triggered by schedule (dev is default value) env: NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || false }} @@ -50,7 +50,7 @@ jobs: with: node-version: 18 - # Only build & serve locally when local_build=true + # Only builds & serve locally when local_build=true - name: Install JS deps & build dashboard if: ${{ env.LOCAL_BUILD == 'true' }} run: | @@ -73,7 +73,6 @@ jobs: STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} NETWORK: ${{ env.NETWORK }} - # Decide which URL to hit DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard-%s.grid.tf', env.NETWORK) }} run: | python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" From bee570244c78701b565cab7912351e68b7622c9b Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 13:31:48 +0300 Subject: [PATCH 05/46] fixing checkout --- .github/workflows/playground_selenium.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 9cab062945..1c2ace8d21 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -26,10 +26,10 @@ jobs: selenium: runs-on: ubuntu-latest - # fall back to 'dev' and 'false' when triggered by schedule (dev is default value) + # Fall back to 'dev' (default) and 'false' when triggered by schedule env: - NETWORK: ${{ github.event.inputs.network || 'dev' }} - LOCAL_BUILD: ${{ github.event.inputs.local_build || false }} + NETWORK: ${{ github.event.inputs.network || 'dev' }} + LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} steps: - name: Checkout repository @@ -50,12 +50,14 @@ jobs: with: node-version: 18 - # Only builds & serve locally when local_build=true - - name: Install JS deps & build dashboard + # Only build and serve dashboard locally when local_build=true + - name: Install JS dependencies if: ${{ env.LOCAL_BUILD == 'true' }} - run: | - yarn install - yarn lerna run build + run: yarn install + + - name: Build dashboard with Lerna + if: ${{ env.LOCAL_BUILD == 'true' }} + run: yarn lerna run build - name: Start local dashboard if: ${{ env.LOCAL_BUILD == 'true' }} @@ -78,7 +80,7 @@ jobs: python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.0 with: name: selenium-report-${{ env.NETWORK }} path: packages/playground/tests/frontend_selenium/report.html From 20ba723ed438298a3fadb93b6a5c7c94f1f4e2e5 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 14:17:34 +0300 Subject: [PATCH 06/46] fixing checkout --- .github/workflows/playground_selenium.yaml | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 1c2ace8d21..b010ba4e7d 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -23,51 +23,50 @@ on: - cron: "0 6 * * *" jobs: - selenium: + selenium-run: runs-on: ubuntu-latest - # Fall back to 'dev' (default) and 'false' when triggered by schedule env: + # Fallbacks for scheduled runs NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Setting up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install Python dependencies + - name: Installing Python packages run: | pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html - - name: Set up Node.js 18 + - name: Node install uses: actions/setup-node@v4 with: node-version: 18 - # Only build and serve dashboard locally when local_build=true - - name: Install JS dependencies + - name: Yarn install if: ${{ env.LOCAL_BUILD == 'true' }} run: yarn install - - name: Build dashboard with Lerna + - name: Lerna Build if: ${{ env.LOCAL_BUILD == 'true' }} run: yarn lerna run build - - name: Start local dashboard + - name: Yarn Serve if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & - - name: Wait for local server + - name: Wait for localhost if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Run Selenium tests + - name: Run tests working-directory: ./packages/playground/tests/frontend_selenium env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} @@ -77,6 +76,7 @@ jobs: NETWORK: ${{ env.NETWORK }} DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard-%s.grid.tf', env.NETWORK) }} run: | + echo "Running against: $DASHBOARD_URL" python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" - name: Upload HTML report From d13f8c80de1c291f0cd77060fce1dae05d83e245 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 14:30:17 +0300 Subject: [PATCH 07/46] fixing checkout --- .github/workflows/playground_selenium.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index b010ba4e7d..b7aa4af653 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest env: - # Fallbacks for scheduled runs + # Fallback for scheduled runs NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} @@ -35,17 +35,17 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setting up Python + - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Installing Python packages + - name: Install Python packages run: | pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html - - name: Node install + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 18 @@ -62,11 +62,11 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & - - name: Wait for localhost + - name: Wait for local server if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Run tests + - name: Run Selenium tests working-directory: ./packages/playground/tests/frontend_selenium env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} @@ -80,7 +80,7 @@ jobs: python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" - name: Upload HTML report - uses: actions/upload-artifact@v3.1.0 + uses: actions/upload-artifact@v4 with: name: selenium-report-${{ env.NETWORK }} path: packages/playground/tests/frontend_selenium/report.html From aa1e941972e9bc04ad41e3ce57f1ba7d012cda3c Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 15:49:16 +0300 Subject: [PATCH 08/46] fixing confest.py --- .../tests/frontend_selenium/tests/conftest.py | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/playground/tests/frontend_selenium/tests/conftest.py b/packages/playground/tests/frontend_selenium/tests/conftest.py index 3aae3f0e30..3fa350b146 100644 --- a/packages/playground/tests/frontend_selenium/tests/conftest.py +++ b/packages/playground/tests/frontend_selenium/tests/conftest.py @@ -5,30 +5,42 @@ from pyvirtualdisplay import Display """ -This module contains shared browser fixtures. +This module contains shared browser fixtures and CLI options. """ +# Add --base-url CLI option to pytest +def pytest_addoption(parser): + parser.addoption( + "--base-url", + action="store", + default="http://localhost:8080", + help="Base URL for the dashboard", + ) + +# Fixture to access the base URL from command line or default +@pytest.fixture(scope="session") +def base_url(request): + return request.config.getoption("--base-url") + +# Selenium browser fixture with virtual display @pytest.fixture def browser(): - - # Virtual display for the browser, allowing it to run in headless mode + # Start virtual display (headless) display = Display(visible=0, size=(1920, 1080)) display.start() - # Initialize the ChromeDriver instance with options + # Configure Chrome WebDriver options = webdriver.ChromeOptions() - #options.add_extension('extension.crx') # For Adding Extension - driver = webdriver.Chrome(options=options) - # driver = webdriver.Chrome(options=options, service=ChromeService(ChromeDriverManager().install())) + # options.add_extension('extension.crx') # Optional: add extension if needed + driver = webdriver.Chrome( + options=options, + service=ChromeService(ChromeDriverManager().install()) + ) driver.set_window_size(1920, 1080) + driver.implicitly_wait(60) # Wait up to 60s for elements - # Make its calls wait up to 60 seconds for elements to appear - driver.implicitly_wait(60) - - # Return the WebDriver instance for the setup - yield driver + yield driver # Hand off driver to test - # Quit the WebDriver instance for the cleanup + # Clean up driver.quit() - # Ending virtual display for the browser - display.stop() \ No newline at end of file + display.stop() From 0a3ce8319860f4838249b0484ca4fb13b7360b7e Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 16:08:51 +0300 Subject: [PATCH 09/46] fixing workflow link --- .github/workflows/playground_selenium.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index b7aa4af653..b45f649b94 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -74,7 +74,7 @@ jobs: STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} NETWORK: ${{ env.NETWORK }} - DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard-%s.grid.tf', env.NETWORK) }} + DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard.%s.grid.tf', env.NETWORK) }} run: | echo "Running against: $DASHBOARD_URL" python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" From 49c7eb67a2712d38b72badf42265370abc744e72 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 16:30:51 +0300 Subject: [PATCH 10/46] fixing workflow link --- .github/workflows/playground_selenium.yaml | 8 +++--- .../tests/frontend_selenium/tests/conftest.py | 26 ++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index b45f649b94..37a2b1418e 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -27,7 +27,6 @@ jobs: runs-on: ubuntu-latest env: - # Fallback for scheduled runs NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} @@ -58,7 +57,7 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: yarn lerna run build - - name: Yarn Serve + - name: Serve Dashboard if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & @@ -74,7 +73,10 @@ jobs: STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} NETWORK: ${{ env.NETWORK }} - DASHBOARD_URL: ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || format('https://dashboard.%s.grid.tf', env.NETWORK) }} + DASHBOARD_URL: >- + ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || ( + env.NETWORK == 'main' && 'https://dashboard.grid.tf' || format('https://dashboard.%s.grid.tf', env.NETWORK) + ) }} run: | echo "Running against: $DASHBOARD_URL" python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" diff --git a/packages/playground/tests/frontend_selenium/tests/conftest.py b/packages/playground/tests/frontend_selenium/tests/conftest.py index 3fa350b146..43f21751e7 100644 --- a/packages/playground/tests/frontend_selenium/tests/conftest.py +++ b/packages/playground/tests/frontend_selenium/tests/conftest.py @@ -1,46 +1,48 @@ import pytest +import os from selenium import webdriver -from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.service import Service as ChromeService +from webdriver_manager.chrome import ChromeDriverManager from pyvirtualdisplay import Display """ -This module contains shared browser fixtures and CLI options. +This module contains shared browser fixtures and CLI/environment options. """ -# Add --base-url CLI option to pytest +# Add --base-url CLI option def pytest_addoption(parser): parser.addoption( "--base-url", action="store", default="http://localhost:8080", - help="Base URL for the dashboard", + help="Base URL for the dashboard" ) -# Fixture to access the base URL from command line or default +# Fixture to access --base-url @pytest.fixture(scope="session") def base_url(request): return request.config.getoption("--base-url") -# Selenium browser fixture with virtual display +# Fixture to access NETWORK from environment +@pytest.fixture(scope="session") +def network(): + return os.getenv("NETWORK", "dev") + +# Selenium WebDriver with headless display @pytest.fixture def browser(): - # Start virtual display (headless) display = Display(visible=0, size=(1920, 1080)) display.start() - # Configure Chrome WebDriver options = webdriver.ChromeOptions() - # options.add_extension('extension.crx') # Optional: add extension if needed driver = webdriver.Chrome( options=options, service=ChromeService(ChromeDriverManager().install()) ) driver.set_window_size(1920, 1080) - driver.implicitly_wait(60) # Wait up to 60s for elements + driver.implicitly_wait(60) - yield driver # Hand off driver to test + yield driver - # Clean up driver.quit() display.stop() From 449967634ae5f6b3081c526a6ef97ef6c4f227d0 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Tue, 6 May 2025 18:01:31 +0300 Subject: [PATCH 11/46] fixing workflow link --- .github/workflows/playground_selenium.yaml | 32 ++++++-------- .../tests/frontend_selenium/tests/conftest.py | 42 +++++++------------ 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 37a2b1418e..c77f01bc5f 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -65,24 +65,18 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Run Selenium tests - working-directory: ./packages/playground/tests/frontend_selenium - env: - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} - NETWORK: ${{ env.NETWORK }} - DASHBOARD_URL: >- - ${{ env.LOCAL_BUILD == 'true' && 'http://localhost:8080' || ( - env.NETWORK == 'main' && 'https://dashboard.grid.tf' || format('https://dashboard.%s.grid.tf', env.NETWORK) - ) }} + - name: Set Config.ini values dynamically run: | - echo "Running against: $DASHBOARD_URL" - python -m pytest -v --html=report.html --base-url="$DASHBOARD_URL" + echo "[Base]" > Config.ini + echo "port=5173" >> Config.ini + echo "net=${{ env.LOCAL_BUILD == 'true' && 'local' || env.NETWORK }}" >> Config.ini + echo "[Utils]" >> Config.ini + echo "seed=${{ secrets.TFCHAIN_MNEMONICS }}" >> Config.ini + echo "node_seed=${{ secrets.TFCHAIN_NODE_MNEMONICS }}" >> Config.ini + echo "address=${{ secrets.STELLAR_ADDRESS }}" >> Config.ini + echo "email=${{ secrets.EMAIL }}" >> Config.ini + working-directory: ./packages/playground/tests/frontend_selenium - - name: Upload HTML report - uses: actions/upload-artifact@v4 - with: - name: selenium-report-${{ env.NETWORK }} - path: packages/playground/tests/frontend_selenium/report.html + - name: Run Selenium tests + working-directory: ./packages/playground/tests/frontend_selenium + run: python -m pytest -v diff --git a/packages/playground/tests/frontend_selenium/tests/conftest.py b/packages/playground/tests/frontend_selenium/tests/conftest.py index 43f21751e7..3aae3f0e30 100644 --- a/packages/playground/tests/frontend_selenium/tests/conftest.py +++ b/packages/playground/tests/frontend_selenium/tests/conftest.py @@ -1,48 +1,34 @@ import pytest -import os from selenium import webdriver -from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager +from selenium.webdriver.chrome.service import Service as ChromeService from pyvirtualdisplay import Display """ -This module contains shared browser fixtures and CLI/environment options. +This module contains shared browser fixtures. """ -# Add --base-url CLI option -def pytest_addoption(parser): - parser.addoption( - "--base-url", - action="store", - default="http://localhost:8080", - help="Base URL for the dashboard" - ) - -# Fixture to access --base-url -@pytest.fixture(scope="session") -def base_url(request): - return request.config.getoption("--base-url") - -# Fixture to access NETWORK from environment -@pytest.fixture(scope="session") -def network(): - return os.getenv("NETWORK", "dev") - -# Selenium WebDriver with headless display @pytest.fixture def browser(): + + # Virtual display for the browser, allowing it to run in headless mode display = Display(visible=0, size=(1920, 1080)) display.start() + # Initialize the ChromeDriver instance with options options = webdriver.ChromeOptions() - driver = webdriver.Chrome( - options=options, - service=ChromeService(ChromeDriverManager().install()) - ) + #options.add_extension('extension.crx') # For Adding Extension + driver = webdriver.Chrome(options=options) + # driver = webdriver.Chrome(options=options, service=ChromeService(ChromeDriverManager().install())) driver.set_window_size(1920, 1080) + + # Make its calls wait up to 60 seconds for elements to appear driver.implicitly_wait(60) + # Return the WebDriver instance for the setup yield driver + # Quit the WebDriver instance for the cleanup driver.quit() - display.stop() + # Ending virtual display for the browser + display.stop() \ No newline at end of file From 2b5a8c3ec6af01bfbc01d8771c4be60dca0b6fac Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Wed, 7 May 2025 15:18:52 +0300 Subject: [PATCH 12/46] fixing workflow link --- .github/workflows/playground_selenium.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index c77f01bc5f..63f90dd734 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -65,16 +65,20 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Set Config.ini values dynamically + - name: Set Config.ini values (safe fallback) run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini echo "net=${{ env.LOCAL_BUILD == 'true' && 'local' || env.NETWORK }}" >> Config.ini echo "[Utils]" >> Config.ini - echo "seed=${{ secrets.TFCHAIN_MNEMONICS }}" >> Config.ini - echo "node_seed=${{ secrets.TFCHAIN_NODE_MNEMONICS }}" >> Config.ini - echo "address=${{ secrets.STELLAR_ADDRESS }}" >> Config.ini - echo "email=${{ secrets.EMAIL }}" >> Config.ini + echo "seed=dummy-seed" >> Config.ini + echo "node_seed=dummy-node-seed" >> Config.ini + echo "address=dummy-address" >> Config.ini + echo "email=dummy@example.com" >> Config.ini + working-directory: ./packages/playground/tests/frontend_selenium + + - name: Print Config.ini + run: cat Config.ini working-directory: ./packages/playground/tests/frontend_selenium - name: Run Selenium tests From 5a7b0c92b76f447e04562deac7929a261d004b87 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 10:18:46 +0300 Subject: [PATCH 13/46] fixing url work flow --- .github/workflows/playground_selenium.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 63f90dd734..a997d9856d 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -29,6 +29,10 @@ jobs: env: NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} steps: - name: Checkout @@ -65,16 +69,16 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Set Config.ini values (safe fallback) + - name: Set Config.ini values from environment run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini echo "net=${{ env.LOCAL_BUILD == 'true' && 'local' || env.NETWORK }}" >> Config.ini echo "[Utils]" >> Config.ini - echo "seed=dummy-seed" >> Config.ini - echo "node_seed=dummy-node-seed" >> Config.ini - echo "address=dummy-address" >> Config.ini - echo "email=dummy@example.com" >> Config.ini + echo "seed=${TFCHAIN_MNEMONICS}" >> Config.ini + echo "node_seed=${TFCHAIN_NODE_MNEMONICS}" >> Config.ini + echo "address=${STELLAR_ADDRESS}" >> Config.ini + echo "email=${EMAIL}" >> Config.ini working-directory: ./packages/playground/tests/frontend_selenium - name: Print Config.ini From ffb01f6d7cf47650d9d43dc1d5519cba30ea1b6c Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 10:47:12 +0300 Subject: [PATCH 14/46] fixing url work flow --- .github/workflows/playground_selenium.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index a997d9856d..cd708149a8 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -29,10 +29,6 @@ jobs: env: NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} steps: - name: Checkout From 249b5282565f88c06f2eaf48f6b60ad1945d0878 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 12:51:03 +0300 Subject: [PATCH 15/46] fixing url work flow --- .github/workflows/playground_selenium.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index cd708149a8..a997d9856d 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -29,6 +29,10 @@ jobs: env: NETWORK: ${{ github.event.inputs.network || 'dev' }} LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} steps: - name: Checkout From 7d9a2a9b93777ca3b386676aae2059e8b1c5f4ae Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 12:53:51 +0300 Subject: [PATCH 16/46] trial 1 --- .github/workflows/playground_selenium.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index a997d9856d..e18ce8264c 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -69,20 +69,27 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 + - name: Validate secrets are set + run: | + if [ -z "${TFCHAIN_MNEMONICS}" ] || [ -z "${TFCHAIN_NODE_MNEMONICS}" ] || [ -z "${STELLAR_ADDRESS}" ] || [ -z "${EMAIL}" ]; then + echo "❌ One or more required secrets are missing or empty!" + exit 1 + fi + - name: Set Config.ini values from environment run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini echo "net=${{ env.LOCAL_BUILD == 'true' && 'local' || env.NETWORK }}" >> Config.ini echo "[Utils]" >> Config.ini - echo "seed=${TFCHAIN_MNEMONICS}" >> Config.ini - echo "node_seed=${TFCHAIN_NODE_MNEMONICS}" >> Config.ini - echo "address=${STELLAR_ADDRESS}" >> Config.ini - echo "email=${EMAIL}" >> Config.ini + echo "seed=$(echo "$TFCHAIN_MNEMONICS" | tr -d '\n' | sed 's/"/\\"/g')" >> Config.ini + echo "node_seed=$(echo "$TFCHAIN_NODE_MNEMONICS" | tr -d '\n' | sed 's/"/\\"/g')" >> Config.ini + echo "address=$(echo "$STELLAR_ADDRESS" | tr -d '\n')" >> Config.ini + echo "email=$(echo "$EMAIL" | tr -d '\n')" >> Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Print Config.ini - run: cat Config.ini + - name: Print Config.ini with line numbers + run: nl Config.ini working-directory: ./packages/playground/tests/frontend_selenium - name: Run Selenium tests From 01b1d7f5880de29c079d73baf517fb36320e44a7 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:18:25 +0300 Subject: [PATCH 17/46] trial --- .github/workflows/playground_selenium.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index e18ce8264c..d259ca790b 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -76,7 +76,7 @@ jobs: exit 1 fi - - name: Set Config.ini values from environment + - name: Set Config.ini dynamically (for local or remote network) run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini @@ -94,4 +94,10 @@ jobs: - name: Run Selenium tests working-directory: ./packages/playground/tests/frontend_selenium - run: python -m pytest -v + run: python -m pytest -v --html=report.html + + - name: Upload HTML report + uses: actions/upload-artifact@v3 + with: + name: selenium-report + path: packages/playground/tests/frontend_selenium/report.html From e433efcb20ddb5752d8e7fa7ad131f67b512dc6a Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:22:55 +0300 Subject: [PATCH 18/46] trial --- .github/workflows/playground_selenium.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index d259ca790b..755caf553f 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -92,12 +92,12 @@ jobs: run: nl Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Run Selenium tests + - name: Run Selenium tests and generate report working-directory: ./packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html From 866d15dd0580165064a916e948c5506d51f6205f Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:26:31 +0300 Subject: [PATCH 19/46] trial --- .github/workflows/playground_selenium.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 755caf553f..06e17736d6 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -35,7 +35,7 @@ jobs: EMAIL: ${{ secrets.EMAIL }} steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - name: Set up Python @@ -53,30 +53,30 @@ jobs: with: node-version: 18 - - name: Yarn install + - name: Yarn install (only for local build) if: ${{ env.LOCAL_BUILD == 'true' }} run: yarn install - - name: Lerna Build + - name: Lerna build (only for local build) if: ${{ env.LOCAL_BUILD == 'true' }} run: yarn lerna run build - - name: Serve Dashboard + - name: Serve Dashboard (only for local build) if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & - - name: Wait for local server + - name: Wait for local server to boot (only for local build) if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Validate secrets are set + - name: Validate secrets are present run: | if [ -z "${TFCHAIN_MNEMONICS}" ] || [ -z "${TFCHAIN_NODE_MNEMONICS}" ] || [ -z "${STELLAR_ADDRESS}" ] || [ -z "${EMAIL}" ]; then - echo "❌ One or more required secrets are missing or empty!" + echo "❌ One or more secrets are missing!" exit 1 fi - - name: Set Config.ini dynamically (for local or remote network) + - name: Create Config.ini dynamically run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini @@ -88,16 +88,16 @@ jobs: echo "email=$(echo "$EMAIL" | tr -d '\n')" >> Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Print Config.ini with line numbers + - name: Print Config.ini (for debugging) run: nl Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Run Selenium tests and generate report + - name: Run Selenium tests with HTML report working-directory: ./packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v3.1.3 + uses: actions/upload-artifact@v3 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html From a852a3d40b40739b56e910f5207ee1060697ad91 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:30:05 +0300 Subject: [PATCH 20/46] trial --- .github/workflows/playground_selenium.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 06e17736d6..60e8ac2710 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -65,18 +65,18 @@ jobs: if: ${{ env.LOCAL_BUILD == 'true' }} run: make run project=playground & - - name: Wait for local server to boot (only for local build) + - name: Wait for local server (only for local build) if: ${{ env.LOCAL_BUILD == 'true' }} run: sleep 60 - - name: Validate secrets are present + - name: Validate secrets run: | if [ -z "${TFCHAIN_MNEMONICS}" ] || [ -z "${TFCHAIN_NODE_MNEMONICS}" ] || [ -z "${STELLAR_ADDRESS}" ] || [ -z "${EMAIL}" ]; then - echo "❌ One or more secrets are missing!" + echo "❌ Missing secrets!" exit 1 fi - - name: Create Config.ini dynamically + - name: Create Config.ini run: | echo "[Base]" > Config.ini echo "port=5173" >> Config.ini @@ -88,11 +88,11 @@ jobs: echo "email=$(echo "$EMAIL" | tr -d '\n')" >> Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Print Config.ini (for debugging) + - name: Print Config.ini (debug) run: nl Config.ini working-directory: ./packages/playground/tests/frontend_selenium - - name: Run Selenium tests with HTML report + - name: Run Selenium tests working-directory: ./packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html From eca183bd3c3a5ce194e3cd8f56a12e41341b397f Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:34:05 +0300 Subject: [PATCH 21/46] trial --- .github/workflows/playground_selenium.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 60e8ac2710..7f57d0cb2e 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -97,7 +97,7 @@ jobs: run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v2.3.1 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html From d313e5f8c0cf66cabf5244e18e09789978df134f Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 16:35:57 +0300 Subject: [PATCH 22/46] trial --- .github/workflows/playground_selenium.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 7f57d0cb2e..266f86fc73 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -95,9 +95,3 @@ jobs: - name: Run Selenium tests working-directory: ./packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html - - - name: Upload HTML report - uses: actions/upload-artifact@v2.3.1 - with: - name: selenium-report - path: packages/playground/tests/frontend_selenium/report.html From 52e4a30303879e8e692699936a1c5a2671fb3a28 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 17:08:55 +0300 Subject: [PATCH 23/46] checking --- .github/workflows/playground_selenium.yaml | 108 ++++++++++----------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 266f86fc73..655a1d8725 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -4,94 +4,94 @@ on: workflow_dispatch: inputs: network: - description: "Select the target environment" + description: "Select the network to run tests on (dev, qa, test, main)" required: true + default: "dev" # Default to 'dev' if no network is selected type: choice - default: "dev" options: - dev - qa - test - main - local_build: - description: "Build & serve dashboard locally?" - required: false - type: boolean - default: false - - schedule: - - cron: "0 6 * * *" + mode: + description: "Select the mode to run tests (build locally or use existing URL)" + required: true + default: "build" # Default to 'build' if no mode is selected + type: choice + options: + - build + - remote jobs: selenium-run: runs-on: ubuntu-latest - env: - NETWORK: ${{ github.event.inputs.network || 'dev' }} - LOCAL_BUILD: ${{ github.event.inputs.local_build || 'false' }} - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} - steps: - - name: Checkout code + # Step 1: Checkout the repository + - name: Checkout uses: actions/checkout@v4 - - name: Set up Python + # Step 2: Set up Python + - name: Setting up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install Python packages - run: | - pip install -r packages/playground/tests/frontend_selenium/requirements.txt - pip install pytest-html + # Step 3: Install Python dependencies + - name: Install Python Dependencies + run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - - name: Set up Node.js + # Step 4: Set up Node.js + - name: Node Install uses: actions/setup-node@v4 with: node-version: 18 - - name: Yarn install (only for local build) - if: ${{ env.LOCAL_BUILD == 'true' }} + # Step 5: Install Node.js dependencies + - name: Install Node Dependencies run: yarn install - - name: Lerna build (only for local build) - if: ${{ env.LOCAL_BUILD == 'true' }} + # Step 6: Build the project + - name: Build Project run: yarn lerna run build - - name: Serve Dashboard (only for local build) - if: ${{ env.LOCAL_BUILD == 'true' }} + # Step 7: Start the local environment (only for "build" mode) + - name: Start Local Environment + if: ${{ inputs.mode == 'build' }} run: make run project=playground & - - name: Wait for local server (only for local build) - if: ${{ env.LOCAL_BUILD == 'true' }} + # Step 8: Wait for the local environment to start + - name: Wait for Local Environment + if: ${{ inputs.mode == 'build' }} run: sleep 60 - - name: Validate secrets + # Step 9: Configure Environment + - name: Configure Environment run: | - if [ -z "${TFCHAIN_MNEMONICS}" ] || [ -z "${TFCHAIN_NODE_MNEMONICS}" ] || [ -z "${STELLAR_ADDRESS}" ] || [ -z "${EMAIL}" ]; then - echo "❌ Missing secrets!" - exit 1 + echo "[Base]" > packages/playground/tests/frontend_selenium/Config.ini + echo "port = 5173" >> packages/playground/tests/frontend_selenium/Config.ini + echo "net = ${{ inputs.network }}" >> packages/playground/tests/frontend_selenium/Config.ini + if [ "${{ inputs.mode }}" == "build" ]; then + echo "base_url = http://localhost:5173" >> packages/playground/tests/frontend_selenium/Config.ini + else + case ${{ inputs.network }} in + dev) echo "base_url = https://staging.dashboard.dev.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; + qa) echo "base_url = https://dashboard.qa.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; + test) echo "base_url = https://dashboard.test.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; + main) echo "base_url = https://dashboard.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; + esac fi - - name: Create Config.ini - run: | - echo "[Base]" > Config.ini - echo "port=5173" >> Config.ini - echo "net=${{ env.LOCAL_BUILD == 'true' && 'local' || env.NETWORK }}" >> Config.ini - echo "[Utils]" >> Config.ini - echo "seed=$(echo "$TFCHAIN_MNEMONICS" | tr -d '\n' | sed 's/"/\\"/g')" >> Config.ini - echo "node_seed=$(echo "$TFCHAIN_NODE_MNEMONICS" | tr -d '\n' | sed 's/"/\\"/g')" >> Config.ini - echo "address=$(echo "$STELLAR_ADDRESS" | tr -d '\n')" >> Config.ini - echo "email=$(echo "$EMAIL" | tr -d '\n')" >> Config.ini - working-directory: ./packages/playground/tests/frontend_selenium - - - name: Print Config.ini (debug) - run: nl Config.ini - working-directory: ./packages/playground/tests/frontend_selenium + # Step 10: Debug Config File + - name: Debug Config File + run: cat packages/playground/tests/frontend_selenium/Config.ini - - name: Run Selenium tests + # Step 11: Run Tests + - name: Run Selenium Tests working-directory: ./packages/playground/tests/frontend_selenium - run: python -m pytest -v --html=report.html + env: + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} + run: python -m pytest -v From d57645b2659e07e9fb8765ec61d5b6c5d9f332bf Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 19:20:39 +0300 Subject: [PATCH 24/46] trying remote --- .github/workflows/playground_selenium.yaml | 110 ++++++++---------- .../tests/frontend_selenium/Config.ini | 8 -- 2 files changed, 48 insertions(+), 70 deletions(-) delete mode 100644 packages/playground/tests/frontend_selenium/Config.ini diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 655a1d8725..e5b843bd7f 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -6,92 +6,78 @@ on: network: description: "Select the network to run tests on (dev, qa, test, main)" required: true - default: "dev" # Default to 'dev' if no network is selected + default: "dev" type: choice options: - dev - qa - test - main - mode: - description: "Select the mode to run tests (build locally or use existing URL)" - required: true - default: "build" # Default to 'build' if no mode is selected - type: choice - options: - - build - - remote jobs: - selenium-run: + remote-tests: runs-on: ubuntu-latest + env: + NETWORK: ${{ github.event.inputs.network }} + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} + steps: - # Step 1: Checkout the repository - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - # Step 2: Set up Python - - name: Setting up Python + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: python-version: "3.10" - # Step 3: Install Python dependencies - - name: Install Python Dependencies - run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt + - name: Install Python deps + run: | + pip install -r packages/playground/tests/frontend_selenium/requirements.txt + pip install pytest-html - # Step 4: Set up Node.js - - name: Node Install + - name: Set up Node 18 uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "18" - # Step 5: Install Node.js dependencies - - name: Install Node Dependencies + - name: Install Node deps run: yarn install - # Step 6: Build the project - - name: Build Project - run: yarn lerna run build - - # Step 7: Start the local environment (only for "build" mode) - - name: Start Local Environment - if: ${{ inputs.mode == 'build' }} - run: make run project=playground & - - # Step 8: Wait for the local environment to start - - name: Wait for Local Environment - if: ${{ inputs.mode == 'build' }} - run: sleep 60 + # ─── Patch base.py for DevNet URL ─────────────────────────────────────── + - name: Patch base.py for DevNet URL + if: ${{ inputs.network == 'dev' }} + run: | + sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ + packages/playground/tests/frontend_selenium/utils/base.py - # Step 9: Configure Environment - - name: Configure Environment + # ─── Replace Config.ini ───────────────────────────────────────────────── + - name: Replace Config.ini run: | - echo "[Base]" > packages/playground/tests/frontend_selenium/Config.ini - echo "port = 5173" >> packages/playground/tests/frontend_selenium/Config.ini - echo "net = ${{ inputs.network }}" >> packages/playground/tests/frontend_selenium/Config.ini - if [ "${{ inputs.mode }}" == "build" ]; then - echo "base_url = http://localhost:5173" >> packages/playground/tests/frontend_selenium/Config.ini - else - case ${{ inputs.network }} in - dev) echo "base_url = https://staging.dashboard.dev.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; - qa) echo "base_url = https://dashboard.qa.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; - test) echo "base_url = https://dashboard.test.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; - main) echo "base_url = https://dashboard.grid.tf/" >> packages/playground/tests/frontend_selenium/Config.ini ;; - esac - fi + rm -f packages/playground/tests/frontend_selenium/Config.ini + cat > packages/playground/tests/frontend_selenium/Config.ini < Date: Thu, 8 May 2025 19:25:21 +0300 Subject: [PATCH 25/46] trying remote --- .github/workflows/playground_selenium.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index e5b843bd7f..86b0801e91 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -1,4 +1,4 @@ -name: Playground Selenium Tests +name: "Playground Selenium Tests (Phase 1: Remote)" on: workflow_dispatch: @@ -47,14 +47,12 @@ jobs: - name: Install Node deps run: yarn install - # ─── Patch base.py for DevNet URL ─────────────────────────────────────── - name: Patch base.py for DevNet URL if: ${{ inputs.network == 'dev' }} run: | sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ - packages/playground/tests/frontend_selenium/utils/base.py + packages/playground/tests/frontend_selenium/utils/base.py - # ─── Replace Config.ini ───────────────────────────────────────────────── - name: Replace Config.ini run: | rm -f packages/playground/tests/frontend_selenium/Config.ini @@ -75,9 +73,3 @@ jobs: - name: Run Selenium tests working-directory: packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html - - - name: Upload HTML report - uses: actions/upload-artifact@v3 - with: - name: selenium-report - path: packages/playground/tests/frontend_selenium/report.html From 6c5b3f3c547dbff867dc96051610f8496840c06d Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 8 May 2025 19:28:51 +0300 Subject: [PATCH 26/46] trying remote --- .github/workflows/playground_selenium.yaml | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 86b0801e91..60db3420aa 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -53,19 +53,18 @@ jobs: sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ packages/playground/tests/frontend_selenium/utils/base.py - - name: Replace Config.ini + - name: Replace Config.ini (strip newlines from secrets) run: | - rm -f packages/playground/tests/frontend_selenium/Config.ini - cat > packages/playground/tests/frontend_selenium/Config.ini < Config.ini + echo "port = 5173" >> Config.ini + echo "net = ${NETWORK}" >> Config.ini + echo "[Utils]" >> Config.ini + echo "seed = $(echo "${TFCHAIN_MNEMONICS}" | tr -d '\n')" >> Config.ini + echo "node_seed = $(echo "${TFCHAIN_NODE_MNEMONICS}" | tr -d '\n')" >> Config.ini + echo "address = $(echo "${STELLAR_ADDRESS}" | tr -d '\n')" >> Config.ini + echo "email = $(echo "${EMAIL}" | tr -d '\n')" >> Config.ini - name: Debug Config.ini run: nl packages/playground/tests/frontend_selenium/Config.ini From d3dac8ccf19dc1774c24ae016299733f39ddfd7f Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Sun, 11 May 2025 09:26:08 +0300 Subject: [PATCH 27/46] step1 --- .github/workflows/playground_selenium.yaml | 46 ++++++++++------------ 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 60db3420aa..3d92d12210 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: network: - description: "Select the network to run tests on (dev, qa, test, main)" + description: "Select network (dev, qa, test, main)" required: true default: "dev" type: choice @@ -17,54 +17,50 @@ on: jobs: remote-tests: runs-on: ubuntu-latest - env: - NETWORK: ${{ github.event.inputs.network }} TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + name: Checkout - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" + - uses: actions/setup-python@v5 + name: Set up Python + with: { python-version: "3.10" } - name: Install Python deps run: | pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html - - name: Set up Node 18 - uses: actions/setup-node@v4 - with: - node-version: "18" + - uses: actions/setup-node@v4 + name: Set up Node.js + with: { node-version: "18" } - name: Install Node deps run: yarn install - - name: Patch base.py for DevNet URL + - name: Patch base.py for DevNet if: ${{ inputs.network == 'dev' }} run: | sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ packages/playground/tests/frontend_selenium/utils/base.py - - name: Replace Config.ini (strip newlines from secrets) + - name: Write Config.ini run: | - cd packages/playground/tests/frontend_selenium - rm -f Config.ini - echo "[Base]" > Config.ini - echo "port = 5173" >> Config.ini - echo "net = ${NETWORK}" >> Config.ini - echo "[Utils]" >> Config.ini - echo "seed = $(echo "${TFCHAIN_MNEMONICS}" | tr -d '\n')" >> Config.ini - echo "node_seed = $(echo "${TFCHAIN_NODE_MNEMONICS}" | tr -d '\n')" >> Config.ini - echo "address = $(echo "${STELLAR_ADDRESS}" | tr -d '\n')" >> Config.ini - echo "email = $(echo "${EMAIL}" | tr -d '\n')" >> Config.ini + cat > packages/playground/tests/frontend_selenium/Config.ini < Date: Sun, 11 May 2025 09:32:13 +0300 Subject: [PATCH 28/46] step2 --- .github/workflows/playground_selenium.yaml | 49 ++++++++++++---------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 3d92d12210..4c1acd5c97 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: network: - description: "Select network (dev, qa, test, main)" + description: "Select the network to run tests on (dev, qa, test, main)" required: true default: "dev" type: choice @@ -17,6 +17,7 @@ on: jobs: remote-tests: runs-on: ubuntu-latest + env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} @@ -24,43 +25,49 @@ jobs: EMAIL: ${{ secrets.EMAIL }} steps: - - uses: actions/checkout@v4 - name: Checkout + - name: Checkout code + uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Set up Python - with: { python-version: "3.10" } + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" - name: Install Python deps run: | pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html - - uses: actions/setup-node@v4 - name: Set up Node.js - with: { node-version: "18" } + - name: Set up Node.js 18 + uses: actions/setup-node@v4 + with: + node-version: "18" - name: Install Node deps run: yarn install - - name: Patch base.py for DevNet + - name: Patch base.py for DevNet URL if: ${{ inputs.network == 'dev' }} run: | sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ packages/playground/tests/frontend_selenium/utils/base.py - - name: Write Config.ini + - name: Write clean Config.ini run: | - cat > packages/playground/tests/frontend_selenium/Config.ini < Config.ini + echo "port = 5173" >> Config.ini + echo "net = ${{ inputs.network }}" >> Config.ini + + # Utils section + echo "[Utils]" >> Config.ini + echo "seed = \"$(echo "${TFCHAIN_MNEMONICS}" | tr -d '\n')\"" >> Config.ini + echo "node_seed = \"$(echo "${TFCHAIN_NODE_MNEMONICS}" | tr -d '\n')\"" >> Config.ini + echo "address = \"$(echo "${STELLAR_ADDRESS}" | tr -d '\n')\"" >> Config.ini + echo "email = \"$(echo "${EMAIL}" | tr -d '\n')\"" >> Config.ini - name: Debug Config.ini run: nl packages/playground/tests/frontend_selenium/Config.ini From c4a0be99a202a3edfbd19d9942c7b3103994fd57 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Sun, 11 May 2025 09:51:28 +0300 Subject: [PATCH 29/46] step3 --- .github/workflows/playground_selenium.yaml | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 4c1acd5c97..d94e466447 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -13,6 +13,8 @@ on: - qa - test - main + schedule: + - cron: "0 6 * * *" jobs: remote-tests: @@ -33,7 +35,7 @@ jobs: with: python-version: "3.10" - - name: Install Python deps + - name: Install Python dependencies run: | pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html @@ -43,7 +45,7 @@ jobs: with: node-version: "18" - - name: Install Node deps + - name: Install Node.js dependencies run: yarn install - name: Patch base.py for DevNet URL @@ -57,17 +59,23 @@ jobs: cd packages/playground/tests/frontend_selenium rm -f Config.ini + # strip newline characters out of secrets + CLEAN_SEED=$(printf "%s" "$TFCHAIN_MNEMONICS" | tr -d '\r\n') + CLEAN_NODE=$(printf "%s" "$TFCHAIN_NODE_MNEMONICS" | tr -d '\r\n') + CLEAN_ADDRESS=$(printf "%s" "$STELLAR_ADDRESS" | tr -d '\r\n') + CLEAN_EMAIL=$(printf "%s" "$EMAIL" | tr -d '\r\n') + # Base section - echo "[Base]" > Config.ini - echo "port = 5173" >> Config.ini - echo "net = ${{ inputs.network }}" >> Config.ini + echo "[Base]" > Config.ini + echo "port = 5173" >> Config.ini + echo "net = ${{ inputs.network }}" >> Config.ini - # Utils section - echo "[Utils]" >> Config.ini - echo "seed = \"$(echo "${TFCHAIN_MNEMONICS}" | tr -d '\n')\"" >> Config.ini - echo "node_seed = \"$(echo "${TFCHAIN_NODE_MNEMONICS}" | tr -d '\n')\"" >> Config.ini - echo "address = \"$(echo "${STELLAR_ADDRESS}" | tr -d '\n')\"" >> Config.ini - echo "email = \"$(echo "${EMAIL}" | tr -d '\n')\"" >> Config.ini + # Utils section + echo "[Utils]" >> Config.ini + echo "seed = $CLEAN_SEED" >> Config.ini + echo "node_seed = $CLEAN_NODE" >> Config.ini + echo "address = $CLEAN_ADDRESS" >> Config.ini + echo "email = $CLEAN_EMAIL" >> Config.ini - name: Debug Config.ini run: nl packages/playground/tests/frontend_selenium/Config.ini From 9bf7a407eb7ae789389da087af8b5020952d7cbe Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Sun, 11 May 2025 10:10:31 +0300 Subject: [PATCH 30/46] trial 2 step 1 --- .github/workflows/playground_selenium.yaml | 69 +++++++++------------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index d94e466447..1c8a2ec0d1 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -1,4 +1,4 @@ -name: "Playground Selenium Tests (Phase 1: Remote)" +name: Playground Selenium Tests on: workflow_dispatch: @@ -17,69 +17,54 @@ on: - cron: "0 6 * * *" jobs: - remote-tests: + selenium-run: runs-on: ubuntu-latest + # expose the chosen network alongside your secrets env: + NETWORK: ${{ inputs.network }} TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Setting up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install Python dependencies - run: | - pip install -r packages/playground/tests/frontend_selenium/requirements.txt - pip install pytest-html + - name: Installing all necessary Python packages + run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - - name: Set up Node.js 18 + - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version: 18 - - name: Install Node.js dependencies + - name: Yarn install run: yarn install - - name: Patch base.py for DevNet URL - if: ${{ inputs.network == 'dev' }} - run: | - sed -i 's|staging.dashboard.dev.grid.tf|dashboard.dev.grid.tf|g' \ - packages/playground/tests/frontend_selenium/utils/base.py - - - name: Write clean Config.ini - run: | - cd packages/playground/tests/frontend_selenium - rm -f Config.ini - - # strip newline characters out of secrets - CLEAN_SEED=$(printf "%s" "$TFCHAIN_MNEMONICS" | tr -d '\r\n') - CLEAN_NODE=$(printf "%s" "$TFCHAIN_NODE_MNEMONICS" | tr -d '\r\n') - CLEAN_ADDRESS=$(printf "%s" "$STELLAR_ADDRESS" | tr -d '\r\n') - CLEAN_EMAIL=$(printf "%s" "$EMAIL" | tr -d '\r\n') + - name: Lerna Build + run: yarn lerna run build - # Base section - echo "[Base]" > Config.ini - echo "port = 5173" >> Config.ini - echo "net = ${{ inputs.network }}" >> Config.ini + - name: Serve Dashboard locally + run: make run project=playground & - # Utils section - echo "[Utils]" >> Config.ini - echo "seed = $CLEAN_SEED" >> Config.ini - echo "node_seed = $CLEAN_NODE" >> Config.ini - echo "address = $CLEAN_ADDRESS" >> Config.ini - echo "email = $CLEAN_EMAIL" >> Config.ini + - name: Wait for local server + run: sleep 60 - - name: Debug Config.ini - run: nl packages/playground/tests/frontend_selenium/Config.ini + - name: Debug env + run: | + echo "NETWORK=$NETWORK" + echo "TFCHAIN_MNEMONICS is set? ${TFCHAIN_MNEMONICS:+yes}" + echo "TFCHAIN_NODE_MNEMONICS is set? ${TFCHAIN_NODE_MNEMONICS:+yes}" + echo "STELLAR_ADDRESS is set? ${STELLAR_ADDRESS:+yes}" + echo "EMAIL is set? ${EMAIL:+yes}" - - name: Run Selenium tests - working-directory: packages/playground/tests/frontend_selenium - run: python -m pytest -v --html=report.html + - name: Run tests + working-directory: ./packages/playground/tests/frontend_selenium + run: python -m pytest -v From cbf78ea63d566ff91cb3ed47533b956befad7ff3 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Sun, 11 May 2025 10:22:30 +0300 Subject: [PATCH 31/46] trial 2 step 2 --- .github/workflows/playground_selenium.yaml | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 1c8a2ec0d1..1c05129a69 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -20,7 +20,7 @@ jobs: selenium-run: runs-on: ubuntu-latest - # expose the chosen network alongside your secrets + # expose both the chosen network and your secrets env: NETWORK: ${{ inputs.network }} TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} @@ -32,12 +32,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setting up Python + - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Installing all necessary Python packages + - name: Install Python packages run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - name: Set up Node.js @@ -45,7 +45,7 @@ jobs: with: node-version: 18 - - name: Yarn install + - name: Install Node.js dependencies run: yarn install - name: Lerna Build @@ -54,16 +54,24 @@ jobs: - name: Serve Dashboard locally run: make run project=playground & - - name: Wait for local server + - name: Wait for localhost run: sleep 60 - - name: Debug env + - name: Generate Config.ini run: | - echo "NETWORK=$NETWORK" - echo "TFCHAIN_MNEMONICS is set? ${TFCHAIN_MNEMONICS:+yes}" - echo "TFCHAIN_NODE_MNEMONICS is set? ${TFCHAIN_NODE_MNEMONICS:+yes}" - echo "STELLAR_ADDRESS is set? ${STELLAR_ADDRESS:+yes}" - echo "EMAIL is set? ${EMAIL:+yes}" + cd packages/playground/tests/frontend_selenium + rm -f Config.ini + echo "[Base]" > Config.ini + echo "port = 5173" >> Config.ini + echo "net = $NETWORK" >> Config.ini + echo "[Utils]" >> Config.ini + echo "seed = $TFCHAIN_MNEMONICS" >> Config.ini + echo "node_seed = $TFCHAIN_NODE_MNEMONICS" >> Config.ini + echo "address = $STELLAR_ADDRESS" >> Config.ini + echo "email = $EMAIL" >> Config.ini + + - name: Debug Config.ini + run: nl packages/playground/tests/frontend_selenium/Config.ini - name: Run tests working-directory: ./packages/playground/tests/frontend_selenium From 169a685e9000de678fe836ba72dc7017734381c0 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:07:01 +0300 Subject: [PATCH 32/46] startegy 2 --- .github/workflows/playground_selenium.yaml | 112 +++++++++++++++------ 1 file changed, 82 insertions(+), 30 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 1c05129a69..b2330a8b50 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -13,6 +13,15 @@ on: - qa - test - main + mode: + description: "Select mode: build locally or use existing URL" + required: true + default: "remote" + type: choice + options: + - build + - remote + schedule: - cron: "0 6 * * *" @@ -20,16 +29,16 @@ jobs: selenium-run: runs-on: ubuntu-latest - # expose both the chosen network and your secrets - env: - NETWORK: ${{ inputs.network }} - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} - steps: - - name: Checkout + - name: Determine network and mode + id: vars + run: | + network="${{ github.event.inputs.network || 'dev' }}" + mode="${{ github.event.inputs.mode || 'remote' }}" + echo "network=$network" >> $GITHUB_OUTPUT + echo "mode=$mode" >> $GITHUB_OUTPUT + + - name: Checkout code uses: actions/checkout@v4 - name: Set up Python @@ -37,7 +46,7 @@ jobs: with: python-version: "3.10" - - name: Install Python packages + - name: Install Python dependencies run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - name: Set up Node.js @@ -45,34 +54,77 @@ jobs: with: node-version: 18 - - name: Install Node.js dependencies + - name: Install Node dependencies run: yarn install - - name: Lerna Build + - name: Build project (only local build) + if: ${{ steps.vars.outputs.mode == 'build' }} run: yarn lerna run build - - name: Serve Dashboard locally - run: make run project=playground & - - - name: Wait for localhost - run: sleep 60 + - name: Serve dashboard locally (only local build) + if: ${{ steps.vars.outputs.mode == 'build' }} + run: | + nohup make run project=playground > server.log 2>&1 & + echo "Waiting for server to start..." + for i in {1..60}; do + if curl -s http://localhost:5173 >/dev/null; then + echo "Server is up!" + exit 0 + fi + sleep 1 + done + echo "Server failed to start within 60 seconds." + exit 1 - name: Generate Config.ini + working-directory: ./packages/playground/tests/frontend_selenium run: | - cd packages/playground/tests/frontend_selenium rm -f Config.ini - echo "[Base]" > Config.ini - echo "port = 5173" >> Config.ini - echo "net = $NETWORK" >> Config.ini - echo "[Utils]" >> Config.ini - echo "seed = $TFCHAIN_MNEMONICS" >> Config.ini - echo "node_seed = $TFCHAIN_NODE_MNEMONICS" >> Config.ini - echo "address = $STELLAR_ADDRESS" >> Config.ini - echo "email = $EMAIL" >> Config.ini + cat < Config.ini + [Base] + port = 5173 + net = ${{ steps.vars.outputs.network }} + base_url = $( + if [ "${{ steps.vars.outputs.mode }}" = "build" ]; then + echo "http://localhost:5173" + else + case "${{ steps.vars.outputs.network }}" in + dev) echo "https://staging.dashboard.dev.grid.tf/" ;; + qa) echo "https://dashboard.qa.grid.tf/" ;; + test) echo "https://dashboard.test.grid.tf/" ;; + main) echo "https://dashboard.grid.tf/" ;; + esac + fi + ) + [Utils] + seed = "${TFCHAIN_MNEMONICS}" + node_seed = "${TFCHAIN_NODE_MNEMONICS}" + address = "${STELLAR_ADDRESS}" + email = "${EMAIL}" + EOF - name: Debug Config.ini - run: nl packages/playground/tests/frontend_selenium/Config.ini - - - name: Run tests working-directory: ./packages/playground/tests/frontend_selenium - run: python -m pytest -v + run: nl Config.ini + + - name: Run Selenium tests + env: + NETWORK: ${{ steps.vars.outputs.network }} + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} + run: python -m pytest -v --html=report.html + + - name: Upload HTML report + uses: actions/upload-artifact@v3 + with: + name: selenium-report + path: packages/playground/tests/frontend_selenium/report.html + + - name: Upload server logs (if build failed) + if: ${{ failure() && steps.vars.outputs.mode == 'build' }} + uses: actions/upload-artifact@v3 + with: + name: server-logs + path: server.log From f3a82e5a068c5d21858f8e9afcedc57353e81f34 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:10:01 +0300 Subject: [PATCH 33/46] startegy 2 update 1 --- .github/workflows/playground_selenium.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index b2330a8b50..098122544f 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -117,14 +117,14 @@ jobs: run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v2 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html - name: Upload server logs (if build failed) if: ${{ failure() && steps.vars.outputs.mode == 'build' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v2 with: name: server-logs path: server.log From 076c6f1a50e2c794773739c7744ba8a6315f6598 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:12:14 +0300 Subject: [PATCH 34/46] startegy 2 update 2 --- .github/workflows/playground_selenium.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 098122544f..37140f1afb 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -117,14 +117,14 @@ jobs: run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v1 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html - name: Upload server logs (if build failed) if: ${{ failure() && steps.vars.outputs.mode == 'build' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v1 with: name: server-logs path: server.log From 77e12e5143cd2e1ba1f9a39076b3f41b3fcb30f3 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:17:00 +0300 Subject: [PATCH 35/46] startegy 2 update 3 --- .github/workflows/playground_selenium.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 37140f1afb..a9438d1a6d 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -117,14 +117,14 @@ jobs: run: python -m pytest -v --html=report.html - name: Upload HTML report - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: selenium-report path: packages/playground/tests/frontend_selenium/report.html - name: Upload server logs (if build failed) if: ${{ failure() && steps.vars.outputs.mode == 'build' }} - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: server-logs path: server.log From 8fd7e106b04efee4c736395098620e029e7b3c28 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:24:14 +0300 Subject: [PATCH 36/46] startegy 2 update 4 --- .github/workflows/playground_selenium.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index a9438d1a6d..623f23aefe 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -47,7 +47,9 @@ jobs: python-version: "3.10" - name: Install Python dependencies - run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt + run: | + pip install -r packages/playground/tests/frontend_selenium/requirements.txt + pip install pytest-html - name: Set up Node.js uses: actions/setup-node@v4 From 9dae3e20e2f250ec79e27bc9967eeb5d5103b38f Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:33:15 +0300 Subject: [PATCH 37/46] startegy 2 update 5 --- .github/workflows/playground_selenium.yaml | 35 +++++++--------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 623f23aefe..39560b41d4 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -8,20 +8,13 @@ on: required: true default: "dev" type: choice - options: - - dev - - qa - - test - - main + options: [dev, qa, test, main] mode: description: "Select mode: build locally or use existing URL" required: true default: "remote" type: choice - options: - - build - - remote - + options: [build, remote] schedule: - cron: "0 6 * * *" @@ -67,22 +60,21 @@ jobs: if: ${{ steps.vars.outputs.mode == 'build' }} run: | nohup make run project=playground > server.log 2>&1 & - echo "Waiting for server to start..." for i in {1..60}; do - if curl -s http://localhost:5173 >/dev/null; then - echo "Server is up!" - exit 0 - fi + if curl -s http://localhost:5173 >/dev/null; then exit 0; fi sleep 1 done - echo "Server failed to start within 60 seconds." exit 1 - name: Generate Config.ini working-directory: ./packages/playground/tests/frontend_selenium + env: + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} run: | - rm -f Config.ini - cat < Config.ini + cat > Config.ini < Date: Thu, 15 May 2025 18:39:42 +0300 Subject: [PATCH 38/46] startegy 2 update 6 --- .github/workflows/playground_selenium.yaml | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 39560b41d4..ab82ab36e0 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -8,13 +8,20 @@ on: required: true default: "dev" type: choice - options: [dev, qa, test, main] + options: + - dev + - qa + - test + - main mode: description: "Select mode: build locally or use existing URL" required: true default: "remote" type: choice - options: [build, remote] + options: + - build + - remote + schedule: - cron: "0 6 * * *" @@ -60,10 +67,15 @@ jobs: if: ${{ steps.vars.outputs.mode == 'build' }} run: | nohup make run project=playground > server.log 2>&1 & + echo "Waiting for server to start..." for i in {1..60}; do - if curl -s http://localhost:5173 >/dev/null; then exit 0; fi + if curl -s http://localhost:5173 >/dev/null; then + echo "Server is up!" + exit 0 + fi sleep 1 done + echo "Server failed to start within 60 seconds." exit 1 - name: Generate Config.ini @@ -85,11 +97,12 @@ jobs: echo "https://dashboard.${{ steps.vars.outputs.network }}.grid.tf/" fi ) + [Utils] - seed = "${TFCHAIN_MNEMONICS}" - node_seed = "${TFCHAIN_NODE_MNEMONICS}" - address = "${STELLAR_ADDRESS}" - email = "${EMAIL}" + seed = $TFCHAIN_MNEMONICS + node_seed = $TFCHAIN_NODE_MNEMONICS + address = $STELLAR_ADDRESS + email = $EMAIL EOF - name: Debug Config.ini From b4f0fd024530b452bbc40f8978767a293d19a425 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 18:52:47 +0300 Subject: [PATCH 39/46] startegy 2 update 9 --- .github/workflows/playground_selenium.yaml | 117 ++++++++++----------- 1 file changed, 53 insertions(+), 64 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index ab82ab36e0..09e0554782 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -28,103 +28,92 @@ on: jobs: selenium-run: runs-on: ubuntu-latest + env: + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} + defaults: + run: + working-directory: packages/playground/tests/frontend_selenium steps: - - name: Determine network and mode + - name: Determine network + mode id: vars run: | - network="${{ github.event.inputs.network || 'dev' }}" - mode="${{ github.event.inputs.mode || 'remote' }}" - echo "network=$network" >> $GITHUB_OUTPUT - echo "mode=$mode" >> $GITHUB_OUTPUT + echo "network=${{ github.event.inputs.network }}" >> $GITHUB_OUTPUT + echo "mode=${{ github.event.inputs.mode }}" >> $GITHUB_OUTPUT - - name: Checkout code + - name: Checkout repo uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install Python dependencies + - name: Install Python deps run: | - pip install -r packages/playground/tests/frontend_selenium/requirements.txt + pip install -r requirements.txt pip install pytest-html - - name: Set up Node.js + - name: Generate Config.ini via Python + run: | + python3 - <<'EOF' + import os, configparser + + cfg = configparser.ConfigParser() + base_url = ( + "http://localhost:5173" if os.environ["mode"] == "build" + else f"https://dashboard.{os.environ['network']}.grid.tf/" + ) + cfg["Base"] = { + "port": "5173", + "net": os.environ["network"], + "base_url": base_url + } + cfg["Utils"] = { + "seed": os.environ["TFCHAIN_MNEMONICS"], + "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"], + "address": os.environ["STELLAR_ADDRESS"], + "email": os.environ["EMAIL"] + } + with open("Config.ini", "w") as f: + cfg.write(f) + EOF + + - name: Debug Config.ini + run: nl Config.ini + + - name: Set up Node.js 18 uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "18" - - name: Install Node dependencies + - name: Install Node deps run: yarn install - - name: Build project (only local build) - if: ${{ steps.vars.outputs.mode == 'build' }} - run: yarn lerna run build - - - name: Serve dashboard locally (only local build) + - name: Build & serve (only build-mode) if: ${{ steps.vars.outputs.mode == 'build' }} run: | + yarn lerna run build nohup make run project=playground > server.log 2>&1 & - echo "Waiting for server to start..." for i in {1..60}; do - if curl -s http://localhost:5173 >/dev/null; then - echo "Server is up!" - exit 0 - fi + curl -sf http://localhost:5173 && exit sleep 1 done - echo "Server failed to start within 60 seconds." - exit 1 - - - name: Generate Config.ini - working-directory: ./packages/playground/tests/frontend_selenium - env: - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} - run: | - cat > Config.ini < Date: Thu, 15 May 2025 20:55:06 +0300 Subject: [PATCH 40/46] fixing work flow uses --- .github/workflows/playground_selenium.yaml | 102 ++++++++++----------- 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 09e0554782..05d6a97fd0 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -4,24 +4,17 @@ on: workflow_dispatch: inputs: network: - description: "Select the network to run tests on (dev, qa, test, main)" + description: "Select network (dev, qa, test, main)" required: true - default: "dev" + default: dev type: choice - options: - - dev - - qa - - test - - main + options: [dev, qa, test, main] mode: - description: "Select mode: build locally or use existing URL" + description: "Select mode (build|remote)" required: true - default: "remote" + default: remote type: choice - options: - - build - - remote - + options: [build, remote] schedule: - cron: "0 6 * * *" @@ -33,20 +26,17 @@ jobs: TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} - defaults: - run: - working-directory: packages/playground/tests/frontend_selenium steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Determine network + mode id: vars run: | echo "network=${{ github.event.inputs.network }}" >> $GITHUB_OUTPUT echo "mode=${{ github.event.inputs.mode }}" >> $GITHUB_OUTPUT - - name: Checkout repo - uses: actions/checkout@v4 - - name: Set up Python 3.10 uses: actions/setup-python@v5 with: @@ -54,37 +44,9 @@ jobs: - name: Install Python deps run: | - pip install -r requirements.txt + pip install -r packages/playground/tests/frontend_selenium/requirements.txt pip install pytest-html - - name: Generate Config.ini via Python - run: | - python3 - <<'EOF' - import os, configparser - - cfg = configparser.ConfigParser() - base_url = ( - "http://localhost:5173" if os.environ["mode"] == "build" - else f"https://dashboard.{os.environ['network']}.grid.tf/" - ) - cfg["Base"] = { - "port": "5173", - "net": os.environ["network"], - "base_url": base_url - } - cfg["Utils"] = { - "seed": os.environ["TFCHAIN_MNEMONICS"], - "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"], - "address": os.environ["STELLAR_ADDRESS"], - "email": os.environ["EMAIL"] - } - with open("Config.ini", "w") as f: - cfg.write(f) - EOF - - - name: Debug Config.ini - run: nl Config.ini - - name: Set up Node.js 18 uses: actions/setup-node@v4 with: @@ -93,27 +55,59 @@ jobs: - name: Install Node deps run: yarn install - - name: Build & serve (only build-mode) + - name: Build & serve (local build only) if: ${{ steps.vars.outputs.mode == 'build' }} run: | yarn lerna run build nohup make run project=playground > server.log 2>&1 & + echo "Waiting for http://localhost:5173…" for i in {1..60}; do - curl -sf http://localhost:5173 && exit + curl -sf http://localhost:5173 && break sleep 1 done - echo "Server failed to start" && exit 1 + + - name: Generate Config.ini + working-directory: packages/playground/tests/frontend_selenium + run: | + cat > Config.ini < Date: Thu, 15 May 2025 21:11:14 +0300 Subject: [PATCH 41/46] fixing the priniting of the seed --- .github/workflows/playground_selenium.yaml | 49 ++++++++++++---------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 05d6a97fd0..e2740b47a9 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -66,35 +66,38 @@ jobs: sleep 1 done - - name: Generate Config.ini + - name: Generate Config.ini via Python working-directory: packages/playground/tests/frontend_selenium run: | - cat > Config.ini < Date: Thu, 15 May 2025 21:14:40 +0300 Subject: [PATCH 42/46] fixing the priniting of the seed --- .github/workflows/playground_selenium.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index e2740b47a9..f9079d6af1 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -103,16 +103,3 @@ jobs: - name: Run Selenium tests working-directory: packages/playground/tests/frontend_selenium run: python -m pytest -v --html=report.html - - - name: Upload HTML report - uses: actions/upload-artifact@v3 - with: - name: selenium-report - path: packages/playground/tests/frontend_selenium/report.html - - - name: Upload server logs (if build failed) - if: ${{ failure() && steps.vars.outputs.mode == 'build' }} - uses: actions/upload-artifact@v3 - with: - name: server-logs - path: server.log From 0ab59b3fee708e52abaf3e9fa69f546823863b7a Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 21:24:16 +0300 Subject: [PATCH 43/46] fixing the priniting of the seed --- .github/workflows/playground_selenium.yaml | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index f9079d6af1..a9a0aad540 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -68,26 +68,35 @@ jobs: - name: Generate Config.ini via Python working-directory: packages/playground/tests/frontend_selenium + env: + NETWORK: ${{ steps.vars.outputs.network }} + MODE: ${{ steps.vars.outputs.mode }} + TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} + STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} + EMAIL: ${{ secrets.EMAIL }} run: | python3 - <<'EOF' import os, configparser + net = os.environ["NETWORK"] + mode = os.environ["MODE"] + cfg = configparser.ConfigParser() - # Base section - net = os.environ["network"] - mode = os.environ["mode"] base_url = ( "http://localhost:5173" if mode == "build" else f"https://dashboard.{net}.grid.tf/" ) - cfg["Base"] = { "port": "5173", "net": net, "base_url": base_url } - - # Utils section + cfg["Base"] = { + "port": "5173", + "net": net, + "base_url": base_url + } cfg["Utils"] = { - "seed": os.getenv("TFCHAIN_MNEMONICS", ""), - "node_seed": os.getenv("TFCHAIN_NODE_MNEMONICS", ""), - "address": os.getenv("STELLAR_ADDRESS", ""), - "email": os.getenv("EMAIL", "") + "seed": os.environ["TFCHAIN_MNEMONICS"], + "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"], + "address": os.environ["STELLAR_ADDRESS"], + "email": os.environ["EMAIL"] } with open("Config.ini", "w") as f: From 6c91eadf0db181703c1586ff54a60e82fa24cf46 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 22:45:03 +0300 Subject: [PATCH 44/46] fixing seeds field --- .github/workflows/playground_selenium.yaml | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index c2b7b8cd4a..08f794a205 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -67,32 +67,32 @@ jobs: env: NETWORK: ${{ steps.vars.outputs.network }} MODE: ${{ steps.vars.outputs.mode }} - TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} - TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} - STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} - EMAIL: ${{ secrets.EMAIL }} run: | python3 - <<'EOF' import os, configparser - net = os.environ["NETWORK"] - mode = os.environ["MODE"] - cfg = configparser.ConfigParser() + # Prevent line wrapping in config values + cfg._interpolation = configparser.ExtendedInterpolation() + base_url = ( - "http://localhost:5173" if mode == "build" - else f"https://dashboard.{net}.grid.tf/" + "http://localhost:5173" + if os.environ["MODE"] == "build" + else f"https://dashboard.{os.environ['NETWORK']}.grid.tf/" ) + cfg["Base"] = { - "port": "5173", - "net": net, + "port": "5173", + "net": os.environ["NETWORK"], "base_url": base_url } + + # Format secrets as single-line values cfg["Utils"] = { - "seed": os.environ["TFCHAIN_MNEMONICS"], - "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"], - "address": os.environ["STELLAR_ADDRESS"], - "email": os.environ["EMAIL"] + "seed": os.environ["TFCHAIN_MNEMONICS"].replace('\n', ' '), + "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"].replace('\n', ' '), + "address": os.environ["STELLAR_ADDRESS"], + "email": os.environ["EMAIL"] } with open("Config.ini", "w") as f: From dcf3ca8df5135d52f6072bc0bd81f3a796d043f1 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 22:55:05 +0300 Subject: [PATCH 45/46] fixing seeds field --- .github/workflows/playground_selenium.yaml | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 08f794a205..a56fa9e86c 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -69,28 +69,28 @@ jobs: MODE: ${{ steps.vars.outputs.mode }} run: | python3 - <<'EOF' - import os, configparser + import os, configparser, re + + def clean_mnemonic(mnemonic): + """Normalize mnemonic to single-space separated format""" + return ' '.join(mnemonic.split()).strip() cfg = configparser.ConfigParser() - # Prevent line wrapping in config values - cfg._interpolation = configparser.ExtendedInterpolation() - - base_url = ( - "http://localhost:5173" - if os.environ["MODE"] == "build" - else f"https://dashboard.{os.environ['NETWORK']}.grid.tf/" - ) cfg["Base"] = { "port": "5173", "net": os.environ["NETWORK"], - "base_url": base_url + "base_url": ( + "http://localhost:5173" + if os.environ["MODE"] == "build" + else f"https://dashboard.{os.environ['NETWORK']}.grid.tf/" + ) } - # Format secrets as single-line values + # Process mnemonics with full normalization cfg["Utils"] = { - "seed": os.environ["TFCHAIN_MNEMONICS"].replace('\n', ' '), - "node_seed": os.environ["TFCHAIN_NODE_MNEMONICS"].replace('\n', ' '), + "seed": clean_mnemonic(os.environ["TFCHAIN_MNEMONICS"]), + "node_seed": clean_mnemonic(os.environ["TFCHAIN_NODE_MNEMONICS"]), "address": os.environ["STELLAR_ADDRESS"], "email": os.environ["EMAIL"] } From 2321878cfdd6480c9209869ca0ae04f84e0e29a8 Mon Sep 17 00:00:00 2001 From: khaledyoussef24 Date: Thu, 15 May 2025 23:03:45 +0300 Subject: [PATCH 46/46] fixing seeds field --- .github/workflows/playground_selenium.yaml | 58 ++++++++++++---------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index a56fa9e86c..5b7b5a3936 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -21,6 +21,8 @@ on: jobs: selenium-run: runs-on: ubuntu-latest + + # Pass secrets in for Config.ini env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} @@ -41,9 +43,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Installing all necessary packages - run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - - name: Node install + + - name: Install Python deps (including pytest-html) + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r packages/playground/tests/frontend_selenium/requirements.txt + python3 -m pip install pytest-html + + - name: Set up Node.js 18 uses: actions/setup-node@v4 with: node-version: "18" @@ -51,7 +58,7 @@ jobs: - name: Install Node deps run: yarn install - - name: Build & serve (local build only) + - name: Build & serve (only build mode) if: ${{ steps.vars.outputs.mode == 'build' }} run: | yarn lerna run build @@ -69,42 +76,41 @@ jobs: MODE: ${{ steps.vars.outputs.mode }} run: | python3 - <<'EOF' - import os, configparser, re + import os, configparser - def clean_mnemonic(mnemonic): - """Normalize mnemonic to single-space separated format""" - return ' '.join(mnemonic.split()).strip() + def flatten(var): + return os.getenv(var, "").replace("\n", " ").strip() - cfg = configparser.ConfigParser() + net = os.environ["NETWORK"] + mode = os.environ["MODE"] + base_url = ("http://localhost:5173" if mode=="build" + else f"https://dashboard.{net}.grid.tf/") + cfg = configparser.ConfigParser() cfg["Base"] = { - "port": "5173", - "net": os.environ["NETWORK"], - "base_url": ( - "http://localhost:5173" - if os.environ["MODE"] == "build" - else f"https://dashboard.{os.environ['NETWORK']}.grid.tf/" - ) + "port": "5173", + "net": net, + "base_url": base_url } - - # Process mnemonics with full normalization cfg["Utils"] = { - "seed": clean_mnemonic(os.environ["TFCHAIN_MNEMONICS"]), - "node_seed": clean_mnemonic(os.environ["TFCHAIN_NODE_MNEMONICS"]), - "address": os.environ["STELLAR_ADDRESS"], - "email": os.environ["EMAIL"] + "seed": flatten("TFCHAIN_MNEMONICS"), + "node_seed": flatten("TFCHAIN_NODE_MNEMONICS"), + "address": flatten("STELLAR_ADDRESS"), + "email": flatten("EMAIL") } - with open("Config.ini", "w") as f: cfg.write(f) EOF - - name: Verify Config.ini + - name: Verify Config.ini exists and contents working-directory: packages/playground/tests/frontend_selenium run: | - echo "\n→ Config.ini contents:\n" + echo "→ Files in $(pwd):" + ls -1 + echo "" + echo "→ Config.ini contents:" nl Config.ini - name: Run Selenium tests working-directory: packages/playground/tests/frontend_selenium - run: python -m pytest -v --html=report.html + run: python3 -m pytest -v --html=report.html