|
| 1 | +name: Test & Report |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + testSuite: |
| 7 | + description: "Which tests to run" |
| 8 | + type: choice |
| 9 | + required: true |
| 10 | + default: smoke |
| 11 | + options: |
| 12 | + - smoke |
| 13 | + - regression |
| 14 | + - LoginPage |
| 15 | + - SecureArea |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + pages: write |
| 20 | + id-token: write |
| 21 | + |
| 22 | +jobs: |
| 23 | + test_chromium: |
| 24 | + name: Run tests (Chromium) |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + env: |
| 28 | + BROWSER: chromium |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Setup .NET |
| 35 | + uses: actions/setup-dotnet@v4 |
| 36 | + with: |
| 37 | + dotnet-version: "10.0.x" |
| 38 | + |
| 39 | + - name: Restore |
| 40 | + run: dotnet restore Tests.csproj |
| 41 | + |
| 42 | + - name: Build |
| 43 | + run: dotnet build Tests.csproj --configuration Release --no-restore |
| 44 | + |
| 45 | + - name: Install Playwright browsers |
| 46 | + run: pwsh bin/Release/net10.0/playwright.ps1 install --with-deps |
| 47 | + |
| 48 | + - name: Run tests (Chromium) |
| 49 | + env: |
| 50 | + TEST_SUITE: ${{ github.event.inputs.testSuite }} |
| 51 | + run: | |
| 52 | + if [ "$TEST_SUITE" = "smoke" ]; then |
| 53 | + FILTER='TestCategory=smoke' |
| 54 | + elif [ "$TEST_SUITE" = "regression" ]; then |
| 55 | + FILTER='' |
| 56 | + elif [ "$TEST_SUITE" = "LoginPage" ]; then |
| 57 | + FILTER='FullyQualifiedName~LoginPageTests' |
| 58 | + elif [ "$TEST_SUITE" = "SecureArea" ]; then |
| 59 | + FILTER='FullyQualifiedName~SecureAreaTests' |
| 60 | + else |
| 61 | + FILTER='' |
| 62 | + fi |
| 63 | +
|
| 64 | + if [ -z "$FILTER" ]; then |
| 65 | + dotnet test Tests.csproj --configuration Release |
| 66 | + else |
| 67 | + dotnet test Tests.csproj --configuration Release --filter "$FILTER" |
| 68 | + fi |
| 69 | +
|
| 70 | + - name: Upload Allure results (Chromium) |
| 71 | + if: always() |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: allure-results-chromium |
| 75 | + path: "**/allure-results" |
| 76 | + if-no-files-found: ignore |
| 77 | + |
| 78 | + test_firefox: |
| 79 | + name: Run tests (Firefox) |
| 80 | + runs-on: ubuntu-latest |
| 81 | + |
| 82 | + env: |
| 83 | + BROWSER: firefox |
| 84 | + |
| 85 | + steps: |
| 86 | + - name: Checkout |
| 87 | + uses: actions/checkout@v4 |
| 88 | + |
| 89 | + - name: Setup .NET |
| 90 | + uses: actions/setup-dotnet@v4 |
| 91 | + with: |
| 92 | + dotnet-version: "10.0.x" |
| 93 | + |
| 94 | + - name: Restore |
| 95 | + run: dotnet restore Tests.csproj |
| 96 | + |
| 97 | + - name: Build |
| 98 | + run: dotnet build Tests.csproj --configuration Release --no-restore |
| 99 | + |
| 100 | + - name: Install Playwright browsers |
| 101 | + run: pwsh bin/Release/net10.0/playwright.ps1 install --with-deps |
| 102 | + |
| 103 | + - name: Run tests (Firefox) |
| 104 | + env: |
| 105 | + TEST_SUITE: ${{ github.event.inputs.testSuite }} |
| 106 | + run: | |
| 107 | + if [ "$TEST_SUITE" = "smoke" ]; then |
| 108 | + FILTER='TestCategory=smoke' |
| 109 | + elif [ "$TEST_SUITE" = "regression" ]; then |
| 110 | + FILTER='' |
| 111 | + elif [ "$TEST_SUITE" = "LoginPage" ]; then |
| 112 | + FILTER='FullyQualifiedName~LoginPageTests' |
| 113 | + elif [ "$TEST_SUITE" = "SecureArea" ]; then |
| 114 | + FILTER='FullyQualifiedName~SecureAreaTests' |
| 115 | + else |
| 116 | + FILTER='' |
| 117 | + fi |
| 118 | +
|
| 119 | + if [ -z "$FILTER" ]; then |
| 120 | + dotnet test Tests.csproj --configuration Release |
| 121 | + else |
| 122 | + dotnet test Tests.csproj --configuration Release --filter "$FILTER" |
| 123 | + fi |
| 124 | +
|
| 125 | + - name: Upload Allure results (Firefox) |
| 126 | + if: always() |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: allure-results-firefox |
| 130 | + path: "**/allure-results" |
| 131 | + if-no-files-found: ignore |
| 132 | + |
| 133 | + test_webkit: |
| 134 | + name: Run tests (WebKit) |
| 135 | + runs-on: ubuntu-latest |
| 136 | + |
| 137 | + env: |
| 138 | + BROWSER: webkit |
| 139 | + |
| 140 | + steps: |
| 141 | + - name: Checkout |
| 142 | + uses: actions/checkout@v4 |
| 143 | + |
| 144 | + - name: Setup .NET |
| 145 | + uses: actions/setup-dotnet@v4 |
| 146 | + with: |
| 147 | + dotnet-version: "10.0.x" |
| 148 | + |
| 149 | + - name: Restore |
| 150 | + run: dotnet restore Tests.csproj |
| 151 | + |
| 152 | + - name: Build |
| 153 | + run: dotnet build Tests.csproj --configuration Release --no-restore |
| 154 | + |
| 155 | + - name: Install Playwright browsers |
| 156 | + run: pwsh bin/Release/net10.0/playwright.ps1 install --with-deps |
| 157 | + |
| 158 | + - name: Run tests (WebKit) |
| 159 | + env: |
| 160 | + TEST_SUITE: ${{ github.event.inputs.testSuite }} |
| 161 | + run: | |
| 162 | + if [ "$TEST_SUITE" = "smoke" ]; then |
| 163 | + FILTER='TestCategory=smoke' |
| 164 | + elif [ "$TEST_SUITE" = "regression" ]; then |
| 165 | + FILTER='' |
| 166 | + elif [ "$TEST_SUITE" = "LoginPage" ]; then |
| 167 | + FILTER='FullyQualifiedName~LoginPageTests' |
| 168 | + elif [ "$TEST_SUITE" = "SecureArea" ]; then |
| 169 | + FILTER='FullyQualifiedName~SecureAreaTests' |
| 170 | + else |
| 171 | + FILTER='' |
| 172 | + fi |
| 173 | +
|
| 174 | + if [ -z "$FILTER" ]; then |
| 175 | + dotnet test Tests.csproj --configuration Release |
| 176 | + else |
| 177 | + dotnet test Tests.csproj --configuration Release --filter "$FILTER" |
| 178 | + fi |
| 179 | +
|
| 180 | + - name: Upload Allure results (WebKit) |
| 181 | + if: always() |
| 182 | + uses: actions/upload-artifact@v4 |
| 183 | + with: |
| 184 | + name: allure-results-webkit |
| 185 | + path: "**/allure-results" |
| 186 | + if-no-files-found: ignore |
| 187 | + |
| 188 | + report: |
| 189 | + name: Generate & Publish Allure report |
| 190 | + runs-on: ubuntu-latest |
| 191 | + needs: |
| 192 | + - test_chromium |
| 193 | + - test_firefox |
| 194 | + - test_webkit |
| 195 | + |
| 196 | + steps: |
| 197 | + - name: Checkout |
| 198 | + uses: actions/checkout@v4 |
| 199 | + |
| 200 | + - name: Download Allure results |
| 201 | + uses: actions/download-artifact@v4 |
| 202 | + with: |
| 203 | + path: ./allure-results |
| 204 | + |
| 205 | + - name: Generate Allure report |
| 206 | + uses: simple-elf/allure-report-action@v1.7 |
| 207 | + with: |
| 208 | + allure_results: ./allure-results |
| 209 | + allure_report: ./allure-report |
| 210 | + keep_reports: 20 |
| 211 | + |
| 212 | + - name: Setup Pages |
| 213 | + uses: actions/configure-pages@v4 |
| 214 | + |
| 215 | + - name: Upload GitHub Pages artifact |
| 216 | + uses: actions/upload-pages-artifact@v3 |
| 217 | + with: |
| 218 | + path: ./allure-report |
| 219 | + |
| 220 | + - name: Deploy to GitHub Pages |
| 221 | + id: deployment |
| 222 | + uses: actions/deploy-pages@v4 |
| 223 | + |
0 commit comments