-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (102 loc) · 4.09 KB
/
Copy pathcrossBrowserTesting.yml
File metadata and controls
119 lines (102 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Cross-browser testing
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "27 20 * * 0"
jobs:
# Summary:
#
# * Installs and configures the environment
# * Builds the solution in Debug configuration
# * Runs just the Selenium tests
# * In Debug configuration (.NET tests)
# * Using the BrowserStack browser configuration
browser_tests:
strategy:
max-parallel: 1
fail-fast: false
matrix:
include:
- browserStackConfig: chromeLatest
# - browserStackConfig: chromeOld
# - browserStackConfig: edgeLatest
# - browserStackConfig: firefoxLatest
# - browserStackConfig: firefoxOld
# - browserStackConfig: safari17
# - browserStackConfig: safari26
name: Run tests
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
RunNumber: ${{ github.run_number }}.${{ github.run_attempt }}
VersionSuffix: crossbrowser.${{ github.run_number }}
Configuration: Release
Tfm: net8.0
DotnetVersion: 8.0.x
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BROWSERSTACK_BUILD_IDENTIFIER: gh-actions-cbt.${{ github.run_number }}.${{ github.run_attempt }}
steps:
- name: Checkout
uses: actions/checkout@v4
# Install build dependencies
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install Node.js for building JSON-to-HTML report converter
uses: actions/setup-node@v6.2.0
# Environment setup pre-build
# Note that the BrowserStack SDK is presently incompatible with .NET 10
- name: Activate BrowserStack
run: |
cp Tests/CSF.Screenplay.Selenium.Tests/Tools/browserstack.${{ matrix.browserStackConfig }}.yml Tests/CSF.Screenplay.Selenium.Tests/browserstack.yml
cp Tests/CSF.Screenplay.Selenium.Tests/Tools/BrowserStack.props Tests/CSF.Screenplay.Selenium.Tests/BrowserStack.props
- name: Force .NET 8 with global.json
run: |
echo '{ "sdk": { "version": "8.0.418", "rollForward": "latestFeature" } }' > global.json
- name: Restore Node modules
run: |
cd CSF.Screenplay.JsonToHtmlReport.Template/src
npm ci
cd ../..
- name: Restore NuGet packages
run: dotnet restore
# Build and test the solution
- name: Build the solution
run: dotnet build -c ${{ env.Configuration }}
- name: Run .NET Selenium tests only
id: dotnet_tests
run: dotnet test -c ${{ env.Configuration }} --no-build --filter TestCategory=WebDriver Tests/CSF.Screenplay.Selenium.Tests
continue-on-error: true
# Post-test tasks (artifacts, overall status)
- name: Upload Screenplay JSON report artifact
uses: actions/upload-artifact@v4
with:
name: Screenplay JSON reports ${{ matrix.browserStackConfig }}
path: Tests/CSF.Screenplay.Selenium.Tests/**/ScreenplayReport_*.json
- name: Convert Screenplay reports to HTML
continue-on-error: true
run: |
for report in $(find Tests/CSF.Screenplay.Selenium.Tests/ -type f -name "ScreenplayReport_*.json")
do
reportDir=$(dirname "$report")
outputFile="$reportDir/ScreenplayReport.html"
dotnet run --no-build --framework $Tfm -c ${{ env.Configuration }} --project CSF.Screenplay.JsonToHtmlReport --ReportPath "$report" --OutputPath "$outputFile"
done
- name: Upload Screenplay HTML report artifact
uses: actions/upload-artifact@v4
with:
name: Screenplay HTML reports ${{ matrix.browserStackConfig }}
path: Tests/**/ScreenplayReport.html
- name: Fail the build if any test failures
if: steps.dotnet_tests.outcome == 'failure'
run: |
echo "Failing the build due to test failures"
exit 1