-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (122 loc) · 4.48 KB
/
crossBrowserTesting.yml
File metadata and controls
138 lines (122 loc) · 4.48 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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:
- browserName: Chrome
browserVersion: latest-50
os: Windows
osVersion: 11
- browserName: Chrome
browserVersion: latest
os: Windows
osVersion: 11
- browserName: Edge
browserVersion: latest
os: Windows
osVersion: 11
- browserName: Firefox
browserVersion: latest
os: Windows
osVersion: 11
- browserName: Firefox
browserVersion: latest-40
os: Windows
osVersion: 11
- browserName: Safari
browserVersion: 17.3
os: OS X
osVersion: Sonoma
- browserName: Safari
browserVersion: 26.2
os: OS X
osVersion: Tahoe
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
WebDriverFactory__SelectedConfiguration: BrowserStack
BSbrowserName: ${{ matrix.browserName }}
BSbrowserVersion: ${{ matrix.browserVersion }}
BSos: ${{ matrix.os }}
BSosVersion: ${{ matrix.osVersion }}
BSuserName: ${{ secrets.BROWSERSTACK_USERNAME }}
BSaccessKey: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BSprojectName: CSF.Screenplay
BSbuildName: ghActionsRun.${{ github.run_number }}.${{ github.run_attempt }}_${{ matrix.browserName }}:${{ matrix.browserVersion }}_${{ matrix.os }}:${{ matrix.osVersion }}
BSparallelism: 5
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
- name: Restore .NET packages
run: dotnet restore
- name: Restore Node modules
run: |
cd CSF.Screenplay.JsonToHtmlReport.Template/src
npm ci
cd ../..
# 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 Tests/CSF.Screenplay.Selenium.Tests -- NumberOfTestWorkers=$BSparallelism
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.browserName }}_${{ matrix.browserVersion }}_${{ matrix.os }}_${{ matrix.osVersion }}
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.browserName }}_${{ matrix.browserVersion }}_${{ matrix.os }}_${{ matrix.osVersion }}
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