Skip to content

user-flow-tests

user-flow-tests #57

name: user-flow-tests
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
description: 'Environment to run the tests'
options:
- development
- staging
- production
type: choice
default: production
required: true
TEST_TYPE:
description: 'Which test to run'
options:
- all
- compliance
- vulnerabilities
- attach-path
- security-risk
type: choice
default: all
required: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.set-environment.outputs.environment }}
test_type: ${{ steps.set-test-type.outputs.test_type }}
steps:
- name: Step 1 - Print Trigger info
run: |
echo "ENVIRONMENT=${{ inputs.ENVIRONMENT }}"
echo "TEST_TYPE=${{ inputs.TEST_TYPE }}"
- name: Set environment output
id: set-environment
run: |
echo "environment=${{ inputs.ENVIRONMENT }}" >> $GITHUB_OUTPUT
- name: Set test type output
id: set-test-type
run: |
echo "test_type=${{ inputs.TEST_TYPE }}" >> $GITHUB_OUTPUT
test_vulnerabilities:
needs: setup
if: needs.setup.outputs.test_type == 'all' || needs.setup.outputs.test_type == 'vulnerabilities'
runs-on: ubuntu-latest
env:
TEST_EMAIL: ${{ secrets.EMAIL_VULNERABILITIES }}
TEST_PASSWORD: ${{ secrets.LOGIN_PASSWORD_VULNERABILITIES }}
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate uuid
id: uuid
run: |
echo "RANDOM_UUID=systets-$(uuidgen)" >> $GITHUB_OUTPUT
- name: Create k8s Kind Cluster
id: kind-cluster-instal
uses: helm/[email protected]
with:
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
- name: Set up Python
uses: actions/setup-python@v4
timeout-minutes: 10
with:
python-version: 3.8
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Vulnerabilities Test
run: |
python main.py ${{ env.ENVIRONMENT }} vulnerabilities $TEST_EMAIL $TEST_PASSWORD
- name: upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-vulnerabilities
path: |
./*.png
test_compliance:
needs: setup
if: needs.setup.outputs.test_type == 'all' || needs.setup.outputs.test_type == 'compliance'
runs-on: ubuntu-latest
env:
TEST_EMAIL: ${{ secrets.EMAIL_COMPLIANCE }}
TEST_PASSWORD: ${{ secrets.LOGIN_PASSWORD_COMPLIANCE }}
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate uuid
id: uuid
run: |
echo "RANDOM_UUID=systets-$(uuidgen)" >> $GITHUB_OUTPUT
- name: Create k8s Kind Cluster
id: kind-cluster-instal
uses: helm/[email protected]
with:
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
- name: Set up Python
uses: actions/setup-python@v4
timeout-minutes: 10
with:
python-version: 3.8
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Compliance Test
run: |
python main.py ${{ env.ENVIRONMENT }} compliance $TEST_EMAIL $TEST_PASSWORD
- name: upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-compliance
path: |
./*.png
test_attach_path:
needs: setup
if: needs.setup.outputs.test_type == 'all' || needs.setup.outputs.test_type == 'attach-path'
runs-on: ubuntu-latest
env:
TEST_EMAIL: ${{ secrets.EMAIL_ATTACH_PATH }}
TEST_PASSWORD: ${{ secrets.LOGIN_PASSWORD_ATTACH_PATH }}
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate uuid
id: uuid
run: |
echo "RANDOM_UUID=systets-$(uuidgen)" >> $GITHUB_OUTPUT
- name: Create k8s Kind Cluster
id: kind-cluster-instal
uses: helm/[email protected]
with:
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
- name: Set up Python
uses: actions/setup-python@v4
timeout-minutes: 10
with:
python-version: 3.8
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Attach path Test
run: |
python main.py ${{ env.ENVIRONMENT }} attach-path $TEST_EMAIL $TEST_PASSWORD
- name: upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-attach-path
path: |
./*.png
test_security_risk:
needs: setup
if: needs.setup.outputs.test_type == 'all' || needs.setup.outputs.test_type == 'security-risk'
runs-on: ubuntu-latest
env:
TEST_EMAIL: ${{ secrets.EMAIL_SECURIY_RISK }}
TEST_PASSWORD: ${{ secrets.LOGIN_PASSWORD_SECURIY_RISK }}
ENVIRONMENT: ${{ needs.setup.outputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate uuid
id: uuid
run: |
echo "RANDOM_UUID=systets-$(uuidgen)" >> $GITHUB_OUTPUT
- name: Create k8s Kind Cluster
id: kind-cluster-instal
uses: helm/[email protected]
with:
cluster_name: ${{ steps.uuid.outputs.RANDOM_UUID }}
- name: Set up Python
uses: actions/setup-python@v4
timeout-minutes: 10
with:
python-version: 3.8
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run security risk Test
run: |
python main.py ${{ env.ENVIRONMENT }} security-risk $TEST_EMAIL $TEST_PASSWORD
- name: upload screenshots
uses: actions/upload-artifact@v4
if: always()
with:
name: screenshots-security-risk
path: |
./*.png