From a952a603a602d20b57cca16213de4c3c40d252f8 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Fri, 29 Nov 2024 11:56:59 +0100 Subject: [PATCH] feat: add readme and allure report --- .github/workflows/playwright.yml | 29 +++++++++++++++++ README.md | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 README.md diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 45f385b..f9a1910 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -16,12 +16,15 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.11' + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r tests/requirements.txt + - name: Ensure browsers are installed run: python -m playwright install --with-deps + - name: Checkout geOrchestra/docker uses: actions/checkout@v4 with: @@ -29,18 +32,44 @@ jobs: submodules: 'recursive' ref: 'rbmq-limited' path: 'docker' + - name: Launch docker-compose run: | cd docker docker compose up -d --wait --quiet-pull cd .. + - name: Caddy trust run: | wget "https://caddyserver.com/api/download?os=linux&arch=amd64" -O caddy chmod +x caddy ./caddy trust + - name: Run your tests run: pytest tests --tracing=retain-on-failure --alluredir=allure-results + + - name: Load test report history + uses: actions/checkout@v3 + continue-on-error: true + with: + ref: gh-pages + path: gh-pages + + - name: Build test report + uses: simple-elf/allure-report-action@v1.7 + with: + gh_pages: gh-pages + allure_history: allure-history + allure_results: build/allure-results + + - name: Publish test report + uses: peaceiris/actions-gh-pages@v3 + if: always() + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: allure-history + - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} with: diff --git a/README.md b/README.md new file mode 100644 index 0000000..3bf4de7 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# geOrchestra Playwright Tests + +This project contains automated tests for the geOrchestra web applications using Playwright and pytest. + +## Project Structure + +- `tests/`: Contains the test files. +- `conftest.py`: Configuration file for pytest fixtures. +- `.github/workflows/playwright.yml`: GitHub Actions workflow for running the tests. + +## Prerequisites + +- Python 3.11 +- pip (Python package installer) +- Docker + +## Setup + +1. Install the dependencies: + ```sh + python -m pip install --upgrade pip + pip install -r tests/requirements.txt + ``` + +2. Ensure Playwright browsers are installed: + ```sh + python -m playwright install --with-deps + ``` + +3. (If georchestra/docker isn't already cloned) Start the geOrchestra services using Docker: + ```sh + git clone https://github.com/georchestra/docker.git + cd docker + docker compose up -d --wait + cd .. + wget "https://caddyserver.com/api/download?os=linux&arch=amd64" -O caddy + chmod +x caddy + ./caddy trust + ``` + +## Running Tests + +To run the tests locally, use the following command: +```sh +pytest tests --alluredir=allure-results --headed +``` + +Remove the `--headed` flag to run the tests in headless mode. + +## Generate allure report + +To generate the allure report, use the following command: +```sh +allure serve allure-results +```