diff --git a/.github/workflows/playground_selenium.yaml b/.github/workflows/playground_selenium.yaml index 8d801a3577..daca1f4738 100644 --- a/.github/workflows/playground_selenium.yaml +++ b/.github/workflows/playground_selenium.yaml @@ -2,40 +2,109 @@ name: Playground Selenium Tests on: workflow_dispatch: + inputs: + env: + description: "Target environment" + type: choice + required: true + options: + - dev + - qa + - test + - main + branch: + type: choice + description: "Git branch to test" + required: true + default: "development" + options: + - "development" + - "development_seleium_2.8.0_fixes" + local: + description: "Build Local Environment" + type: boolean + default: false schedule: - cron: "0 6 * * *" jobs: - selenium-run: + selenium: runs-on: ubuntu-latest + environment: ${{ inputs.env }} steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - - name: Setting up Python + + - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.10" - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y xclip - - name: Installing all necessary packages - run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt - - name: Node install + + - name: Install Python requirements + run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt + + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 22.15 + - name: Yarn install run: yarn install - - name: Lerna Build + + + # - name: Generate local config + # if: ${{ inputs.local }} + # working-directory: packages/playground/public + # run: MODE=${{ inputs.env }} bash ../scripts/build-env.sh + - name: Generate local config + if: ${{ inputs.local }} + working-directory: packages/playground/public + run: | + if [[ "${{ inputs.env }}" == "dev" || "${{ inputs.env }}" == "qa" ]]; then + export STELLAR_NETWORK="test" + else + export STELLAR_NETWORK="main" + fi + export MODE=${{ inputs.env }} + echo "Using MODE=$MODE and STELLAR_NETWORK=$STELLAR_NETWORK" + + + - name: Build packages when local + if: ${{ inputs.local }} run: yarn lerna run build - - name: Yarn Serve + + - name: Build env config when local + if: ${{ inputs.local }} + working-directory: packages/playground/public + run: bash ../scripts/build-env.sh + + - name: Start playground app + if: ${{ inputs.local }} run: make run project=playground & - - name: Wait for localhost + + - name: Wait for local app + if: ${{ inputs.local }} run: sleep 60 - - name: Run tests - working-directory: ./packages/playground/tests/frontend_selenium + + - name: Update Config.ini + run: | + CONFIG=packages/playground/tests/frontend_selenium/Config.ini + if [ -f "$CONFIG" ]; then + if [ "${{ inputs.local }}" == "true" ]; then + sed -i 's/^net =.*/net = local/' "$CONFIG" + else + sed -i "s/^net =.*/net = ${{ inputs.env }}/" "$CONFIG" + fi + else + echo "::warning::Config.ini not found at $CONFIG. Skipping config update." + fi + + - name: Run selenium tests + working-directory: packages/playground/tests/frontend_selenium env: TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} + # TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS.${{ inputs.env }} }} TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} EMAIL: ${{ secrets.EMAIL }} - run: python -m pytest -v + run: python -m pytest -v tests/Farms/test_node.py::test_node_details \ No newline at end of file diff --git a/packages/playground/tests/frontend_selenium/selenium.md b/packages/playground/tests/frontend_selenium/selenium.md index 0ed954b819..d76ccaedcb 100644 --- a/packages/playground/tests/frontend_selenium/selenium.md +++ b/packages/playground/tests/frontend_selenium/selenium.md @@ -28,7 +28,8 @@ There are two ways to run the Automation selenium tests: yarn lerna run build make run project=playground ``` -If the build fails due to a memory issue, please use the following command + + If the build fails due to a memory issue, please use the following command ```bash export NODE_OPTIONS="--max-old-space-size=8192" @@ -70,17 +71,17 @@ export NODE_OPTIONS="--max-old-space-size=8192" - (Not Recommended) Install the recommended version of the pip package listed above for a stable run, or you can just install Python 3 and use the command: - `pip install -r requirements.txt --break-system-packages` (Use this if you don't use any of the listed packages). -- (Recommended) Or use Virtual Environments: - - create an environment using - `python -m venv myenv` +- (Recommended) Or use Virtual Environments: + - create an environment using + `python -m venv myenv` - activate it using - `source myenv/bin/activate` + `source myenv/bin/activate` - install packages using - `pip install -r requirements.txt`. + `pip install -r requirements.txt`. - You'll also need to install `Xvfb`, Run: - `sudo apt install xvfb`. + `sudo apt install xvfb`. - You can run selenium tests with pytest through the command line using: - `python3 -m pytest -v`. + `python3 -m pytest -v`. ### More options to run tests