Skip to content

trigger-api-e2e-tests #36

trigger-api-e2e-tests

trigger-api-e2e-tests #36

name: Workflow Backend API E2E
on:
push:
branch:
- feature/WF-FE-Create-Account-Angular
repository_dispatch:
types: [trigger-api-e2e-tests]
jobs:
Triggered-API-E2E:
runs-on: ubuntu-latest
steps:
- name: Atualizar arquivo no repositório pai
run: |
run_id=$(echo "${{ github.run_id }}")
repo="${{ github.event.client_payload.repo }}"
file_name=$(echo "triggered-workflow-id-${{ github.event.client_payload.father_workflow_id }}")
file_path="${{ github.event.client_payload.path }}"
url_to_call=$(echo "https://api.github.com/repos/$repo/contents/$file_name")
current_date=$(date +"%Y-%m-%d")
echo $current_date
echo -n $run_id | base64 > temp_file
data='{"message": "Workflow Run in '$current_date'", "content": "'$(cat temp_file)'", "branch": "attachments" }'
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.TRIGGER_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-d "$data" \
"$url_to_call"
echo "Arquivo triggerd-workflow-id atualizado com run_id: $run_id"
continue-on-error: false
Run-Tests-E2E:
needs: Triggered-API-E2E
name : Running in ${{ matrix.browser }}
strategy:
matrix:
browser: [firefox, chrome, webkit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install Python Dependencies
run: |
pip install pytest pytest-playwright
playwright install
playwright install-deps
pip install Faker
- name: Runnig Tests e2e With Playwright
run: |
if [ "${{ matrix.browser }}" == "firefox" ]; then
python -m pytest --env=dev __tests__/.backend --browser firefox
elif [ "${{ matrix.browser }}" == "chrome" ]; then
python -m pytest --env=dev __tests__/.backend --browser chromium
else
python -m pytest --env=dev __tests__/.backend
fi
Response-Triggered-Tests-E2E:
needs: Run-Tests-E2E
name : Response Triggered Tests E2E
runs-on: ubuntu-latest
outputs:
workflow_status: ${{ steps.response_tests_e2e.outputs.workflow_status }}
steps:
- uses: actions/checkout@v3
- name: Set Workflow Status
id: response_tests_e2e
run: |
echo "workflow_status=${{ job.status }}" >> $GITHUB_OUTPUT