-
Notifications
You must be signed in to change notification settings - Fork 53
/
RunE2ETests.ps1
49 lines (40 loc) · 1.87 KB
/
RunE2ETests.ps1
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
Push-Location $PSScriptRoot
try
{
$testProjectDir = Join-Path $PSScriptRoot "Tests\Test.App.EndToEnd.Tests"
Push-Location $testProjectDir
$settings = @("chrome.runsettings", "edge.runsettings", "webkit.runsettings")
$snapshots = @()
$outputDir = Join-Path $testProjectDir "Output"
Write-Host "Output directory: $outputDir"
$projectFile = "Test.App.EndToEnd.Tests.csproj"
# The path for the merged coverage snapshot
$mergedSnapshotPath = Join-Path $outputDir "mergedCoverage.snapshot"
$detailedXmlReportPath = Join-Path $outputDir "coverage.xml"
$htmlReportPath = Join-Path $outputDir "coverageReport.html"
foreach ($setting in $settings)
{
$snapshotName = "coverage{0}.snapshot" -f $setting.Replace(".runsettings", "")
$snapshotPath = Join-Path $outputDir $snapshotName
$targetArguments = "test --no-build --settings:PlaywrightSettings\$setting ./$projectFile"
dotnet dotCover cover-dotnet .\dotcover.config.xml --output=$snapshotPath --targetArguments=$targetArguments
$snapshots += $snapshotPath
}
# Merge snapshots
$sourceParameter = ($snapshots -join ";")
Write-Host "Source parameter for dotCover merge: $sourceParameter"
dotnet dotcover merge --output=$mergedSnapshotPath --Source=$sourceParameter
# Generate DetailedXML report
dotnet dotcover report --source=$mergedSnapshotPath --output=$detailedXmlReportPath --reportType="DetailedXml"
# Generate HTML report
dotnet dotcover report --source=$mergedSnapshotPath --output=$htmlReportPath --reportType="HTML"
# Run ReportGenerator to convert the DetailedXml report to Cobertura format using local tool
dotnet reportgenerator "-reports:$detailedXmlReportPath" "-targetdir:$outputDir" "-reporttypes:Cobertura"
# Open the HTML report - this is typically only useful when running locally
if (-not $env:CI) {
Start-Process $htmlReportPath
}
}
finally {
Pop-Location
}