diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 5e17168e..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,76 +0,0 @@ -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - JAVA_HOME: C:\Program Files\Java\jdk17 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 - JAVA_HOME: /usr/lib/jvm/jdk15 - -skip_branch_with_pr: true - -# A note/reminder for readers: Script items prefixed "cmd:" are executed on Windows-only environments. -# Items with no prefix (or "ps:" prefix) are run on all environments (Windows & Linux) - -init: - - cmd: git config --global core.autocrlf true - -install: - - cmd: dotnet tool install --global dotnet-sonarscanner - - cmd: dotnet tool install --global coverlet.console - - cmd: dotnet tool update -g docfx - - ps: | - cd CSF.Screenplay.JsonToHtmlReport.Template\src - npm ci - cd ..\.. - # This was taken from https://stackoverflow.com/questions/60304251/unable-to-open-x-display-when-trying-to-run-google-chrome-on-centos-rhel-7-5 - # It's the minimum dependencies for running Chrome in a headless environment on Linux - - sh: | - sudo apt-get update - sudo apt install -y xorg xvfb gtk2-engines-pixbuf dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable - -before_build: - - dotnet --version - - dotnet restore --verbosity m - - dotnet clean - - cmd: Tools\appveyor-setup-sonarscanner.bat - - cmd: Tools\appveyor-setup-selenium.bat - - cmd: > - dotnet-sonarscanner begin - /k:"csf-dev_CSF.Screenplay" - /v:AppVeyor_build_%APPVEYOR_BUILD_NUMBER% - /o:craigfowler-github - /d:sonar.host.url=https://sonarcloud.io - /d:sonar.token=%SONARCLOUD_SECRET_KEY% - /d:%BranchParam%=%BranchName% - %PRParam% - /d:sonar.javascript.lcov.reportPaths=%APPVEYOR_BUILD_FOLDER%\CSF.Screenplay.JsonToHtmlReport.Template\src\TestResults\lcov.info - /s:%APPVEYOR_BUILD_FOLDER%\.sonarqube-analysisproperties.xml - # Activate Xvfb and export a display so that Chrome can run in Linux - - sh: | - Xvfb -ac :99 -screen 0 1280x1024x16 & - export DISPLAY=:99 - -build_script: - - dotnet build --no-incremental - -test_script: - - ps: if ($isWindows) { Tools\run-tests-with-coverage.ps1 } - - sh: > - dotnet test - --test-adapter-path:. - --logger:nunit - - ps: | - cd CSF.Screenplay.JsonToHtmlReport.Template\src - npm test - cd ..\.. - -after_test: - - cmd: > - dotnet-sonarscanner end - /d:"sonar.token=%SONARCLOUD_SECRET_KEY%" - - ps: if ($isWindows) { Tools\appveyor-upload-test-results.ps1 } - - cmd: dotnet build -c Docs - - ps: if ($isWindows) { Tools\appveyor_publish_docs.ps1 } - -artifacts: - - path: Tests\**\ScreenplayReport_*.json - name: Screenplay report diff --git a/.github/workflows/dotnetCi.yml b/.github/workflows/dotnetCi.yml new file mode 100644 index 00000000..ea191c6d --- /dev/null +++ b/.github/workflows/dotnetCi.yml @@ -0,0 +1,192 @@ +name: .NET CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + # Summary: + # + # * Installs and configures the environment + # * Builds the solution with SonarScanner analysis + # * In Debug configuration + # * Runs all .NET and JS tests + # * In Debug configuration (.NET tests) + # * Producing code coverage reports, consumed by SonarScanner + # * WebDriver-based tests use a locally-running Chrome browser ONLY + # * Packages test results as build artifacts + # * Builds & packs the solution in Release configuration + # * Uploads the Release config packages as build artifacts + + build_test_and_pack: + name: Build, test & package + runs-on: ubuntu-slim + + env: + RunNumber: ${{ github.run_number }}.${{ github.run_attempt }} + VersionSuffix: ci.${{ github.run_number }} + SonarCloudProject: csf-dev_CSF.Screenplay + SonarCloudUsername: craigfowler-github + SonarCloudUrl: https://sonarcloud.io + Configuration: Debug + Tfm: net8.0 + DotnetVersion: 8.0.x + SonarCloudSecretKey: ${{ secrets.SONARCLOUDKEY }} + BranchName: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} + BranchParam: ${{ github.event_name == 'pull_request' && 'sonar.pullrequest.branch' || 'sonar.branch.name' }} + PullRequestParam: ${{ github.event_name == 'pull_request' && format('/d:sonar.pullrequest.key={0}', github.event.number) || '' }} + DISPLAY: :99 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Install build dependencies + + - name: Add .NET global tools location to PATH + run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH" + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DotnetVersion }} + - name: Install SonarScanner + run: dotnet tool install --global dotnet-sonarscanner + - name: Install Coverlet console + run: dotnet tool install --global coverlet.console + - name: Install DocFX + run: dotnet tool install --global docfx + - name: Install Node.js for building JSON-to-HTML report converter + uses: actions/setup-node@v6.2.0 + - name: Install Java JDK for SonarScanner + uses: actions/setup-java@v5.1.0 + with: + java-version: 21 + distribution: 'zulu' + - name: Install GUI packages so Chrome may run + run: | + sudo apt-get update + sudo apt install -y xorg xvfb gtk2-engines-pixbuf dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable psmisc + + # Environment setup pre-build + + - name: Setup Selenium Manager config + run: | + mkdir ~/.cache/selenium + cp Tools/se-config.toml ~/.cache/selenium + - name: Start an Xvfb display so Chrome may run + run: Xvfb -ac $DISPLAY -screen 0 1280x1024x16 & + - 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: Start SonarScanner + run: > + dotnet sonarscanner begin + /k:${{ env.SonarCloudProject }} + /v:GitHub_build_${{ env.RunNumber }} + /o:${{ env.SonarCloudUsername }} + /d:sonar.host.url=${{ env.SonarCloudUrl }} + /d:sonar.token=${{ env.SonarCloudSecretKey }} + /d:${{ env.BranchParam }}=${{ env.BranchName }} ${{ env.PullRequestParam }} + /d:sonar.javascript.lcov.reportPaths=CSF.Screenplay.JsonToHtmlReport.Template/src/TestResults/lcov.info + /s:$PWD/.sonarqube-analysisproperties.xml + - name: Build the solution + run: dotnet build -c ${{ env.Configuration }} --no-incremental + - name: Run .NET tests with coverage + id: dotnet_tests + continue-on-error: true + run: | + for proj in Tests/*.Tests + do + projNameArray=(${proj//// }) + projName=${projNameArray[1]} + assemblyPath=$proj/bin/$Configuration/$Tfm/$projName.dll + coverlet "$assemblyPath" --target "dotnet" --targetargs "test $proj -c $Configuration --no-build --logger:nunit --test-adapter-path:." -f=opencover -o="TestResults/$projName.opencover.xml" + if [ $? -ne 0 ] + then + echo "failures=true" >> $GITHUB_OUTPUT + fi + done + - name: Run JavaScript tests with coverage + id: js_tests + continue-on-error: true + run: | + cd CSF.Screenplay.JsonToHtmlReport.Template/src + npm test + if [ $? -ne 0 ] + then + echo "failures=true" >> $GITHUB_OUTPUT + fi + cd ../.. + + # Post-test tasks (artifacts, overall status) + + - name: Stop SonarScanner + run: + dotnet sonarscanner end /d:sonar.token=${{ env.SonarCloudSecretKey }} + - name: Gracefully stop Xvfb + run: killall Xvfb + continue-on-error: true + - name: Upload test results artifacts + uses: actions/upload-artifact@v4 + with: + name: NUnit test results + path: Tests/*.Tests/**/TestResults.xml + - name: Upload Screenplay JSON report artifact + uses: actions/upload-artifact@v4 + with: + name: Screenplay JSON reports + path: Tests/**/ScreenplayReport_*.json + - name: Convert Screenplay reports to HTML + continue-on-error: true + run: | + for report in $(find Tests/ -type f -name "ScreenplayReport_*.json") + do + reportDir=$(dirname "$report") + outputFile="$reportDir/ScreenplayReport.html" + dotnet run --no-build --framework $Tfm --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 + path: Tests/**/ScreenplayReport.html + - name: Fail the build if any test failures + if: ${{ steps.dotnet_tests.outputs.failures == 'true' || steps.js_tests.outputs.failures == 'true' }} + run: | + echo "Failing the build due to test failures" + exit 1 + + # Build the apps in release mode and publish artifacts + + - name: Clean the solution ahead of building in release config + run: dotnet clean + - name: Build, in release configuration + run: dotnet pack -p:VersionSuffix=$VersionSuffix -o packages + - name: Upload build result artifacts + uses: actions/upload-artifact@v4 + with: + name: Build results (NuGet) + path: packages/*.nupkg + - name: Build docs website + run: dotnet build -c Docs + - name: Upload docs website artifact + uses: actions/upload-artifact@v4 + with: + name: Docs website + path: docs/**/* + + # publishDocs: + # TODO: Take the docco site artifact and publish it to master + + # runBrowserTests: + # TODO: Use build-results artifacts and run tests on matrix of browsers diff --git a/.github/workflows/publishDocsWebsite.yml b/.github/workflows/publishDocsWebsite.yml new file mode 100644 index 00000000..72fd0edf --- /dev/null +++ b/.github/workflows/publishDocsWebsite.yml @@ -0,0 +1,46 @@ +name: Update docs website + +on: + push: + branches: [ "master" ] + +jobs: + + # This job builds the documentation website + # and the commits that to the master branch, + # which will result in replacing the currently published site + + build_and_commit: + name: Build & commit docs website + runs-on: ubuntu-slim + + env: + DotnetVersion: 8.0.x + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Add .NET global tools location to PATH + run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH" + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DotnetVersion }} + - name: Install DocFX + run: dotnet tool install --global docfx + - name: Remove old docs + run: dotnet clean CSF.Screenplay.Docs + - name: Build new docs + run: dotnet build -c Docs CSF.Screenplay.Docs + - name: Add & Commit + uses: EndBug/add-and-commit@v9.1.4 + with: + add: -A docs/ + default_author: github_actor + committer_name: Github Actions Workflow (bot) + committer_email: github-actions-workflow@bots.noreply.github.com + fetch: true + message: Publish updated documentation website + push: origin master --force + + diff --git a/.gitignore b/.gitignore index d05d0b42..e84dffd3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ node_modules/ **/ScreenplayReport* **/TestResult.xml .obsidian/ +packages/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 14ee4543..de1086b2 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,7 @@ "ms-dotnettools.csdevkit", "bierner.markdown-mermaid", "davidanson.vscode-markdownlint", - "bpruitt-goddard.mermaid-markdown-syntax-highlighting" + "bpruitt-goddard.mermaid-markdown-syntax-highlighting", + "github.vscode-github-actions" ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 50f4c5d1..c32cd581 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,6 +11,33 @@ "problemMatcher": [], "label": "dotnet: build" }, + { + "group": { + "kind": "build" + }, + "command": "dotnet", + "args": ["build", "-p:TargetFrameworks=net8.0"], + "problemMatcher": [], + "label": "dotnet: build (net8.0 only)" + }, + { + "group": { + "kind": "build" + }, + "command": "dotnet", + "args": ["pack", "-o", "packages"], + "problemMatcher": [], + "label": "dotnet: pack" + }, + { + "group": { + "kind": "none" + }, + "command": "dotnet", + "args": ["clean"], + "problemMatcher": [], + "label": "dotnet: clean" + }, { "group": { "kind": "test", @@ -21,6 +48,16 @@ "problemMatcher": [], "label": "dotnet: test" }, + { + "group": { + "kind": "test", + "isDefault": true + }, + "command": "dotnet", + "args": ["test", "-p:TargetFramework=net8.0"], + "problemMatcher": [], + "label": "dotnet: test (net8.0 only)" + }, { "group": { "kind": "test" diff --git a/CSF.Screenplay.Abstractions/CSF.Screenplay.Abstractions.csproj b/CSF.Screenplay.Abstractions/CSF.Screenplay.Abstractions.csproj index 951262d2..c4a227b4 100644 --- a/CSF.Screenplay.Abstractions/CSF.Screenplay.Abstractions.csproj +++ b/CSF.Screenplay.Abstractions/CSF.Screenplay.Abstractions.csproj @@ -1,14 +1,16 @@  + + + - netstandard2.0;netstandard2.1;net462 CSF.Screenplay $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + Abstractions for CSF.Screenplay; useful for authoring Extensions or Performable/Ability logic without dependency on the full CSF.Screenplay package - - + diff --git a/CSF.Screenplay.Docs/CSF.Screenplay.Docs.proj b/CSF.Screenplay.Docs/CSF.Screenplay.Docs.proj index d6f56c28..722f3af8 100644 --- a/CSF.Screenplay.Docs/CSF.Screenplay.Docs.proj +++ b/CSF.Screenplay.Docs/CSF.Screenplay.Docs.proj @@ -3,7 +3,7 @@ $(MSBuildProjectDirectory)\..\docs\ $(MSBuildProjectDirectory)\api docfx.json - docfx.exe + docfx @@ -17,4 +17,5 @@ + \ No newline at end of file diff --git a/CSF.Screenplay.JsonToHtmlReport.Template/CSF.Screenplay.JsonToHtmlReport.Template.proj b/CSF.Screenplay.JsonToHtmlReport.Template/CSF.Screenplay.JsonToHtmlReport.Template.proj index 26db3a3f..af4c781f 100644 --- a/CSF.Screenplay.JsonToHtmlReport.Template/CSF.Screenplay.JsonToHtmlReport.Template.proj +++ b/CSF.Screenplay.JsonToHtmlReport.Template/CSF.Screenplay.JsonToHtmlReport.Template.proj @@ -4,6 +4,7 @@ $(MSBuildProjectDirectory)\src $(MSBuildProjectDirectory)\..\CSF.Screenplay.JsonToHtmlReport\template $(OutputPath)\template.html + false @@ -44,4 +45,6 @@ + + diff --git a/CSF.Screenplay.JsonToHtmlReport/CSF.Screenplay.JsonToHtmlReport.csproj b/CSF.Screenplay.JsonToHtmlReport/CSF.Screenplay.JsonToHtmlReport.csproj index b5b533fb..e2bc4026 100644 --- a/CSF.Screenplay.JsonToHtmlReport/CSF.Screenplay.JsonToHtmlReport.csproj +++ b/CSF.Screenplay.JsonToHtmlReport/CSF.Screenplay.JsonToHtmlReport.csproj @@ -1,7 +1,9 @@  + + - netcoreapp3.1;net462;netstandard2.0;net6.0;net8.0 + netcoreapp3.1;net462;netstandard2.0;net6.0;net8.0 Exe Library NU1903,NU1902 @@ -10,11 +12,13 @@ false + A tool which produces human-readable HTML-format reports from the JSON-format reports created by CSF.Screenplay + diff --git a/CSF.Screenplay.JsonToHtmlReport/ReportConverterApplication.cs b/CSF.Screenplay.JsonToHtmlReport/ReportConverterApplication.cs index 538d1d47..9bc3ce67 100644 --- a/CSF.Screenplay.JsonToHtmlReport/ReportConverterApplication.cs +++ b/CSF.Screenplay.JsonToHtmlReport/ReportConverterApplication.cs @@ -11,34 +11,45 @@ namespace CSF.Screenplay.JsonToHtmlReport /// /// An application/background service that begins the JSON to HTML report conversion process. /// - public class ReportConverterApplication : BackgroundService + public class ReportConverterApplication : IHostedService { readonly IOptions options; readonly IConvertsReportJsonToHtml reportConverter; + readonly IHostApplicationLifetime lifetime; /// /// Initializes a new instance of the class. /// /// The options for performing the conversion. /// The report converter instance to use for conversion. + /// The application lifetime public ReportConverterApplication(IOptions options, - IConvertsReportJsonToHtml reportConverter) + IConvertsReportJsonToHtml reportConverter, + IHostApplicationLifetime lifetime) { - this.options = options ?? throw new System.ArgumentNullException(nameof(options)); - this.reportConverter = reportConverter ?? throw new System.ArgumentNullException(nameof(reportConverter)); + this.options = options ?? throw new ArgumentNullException(nameof(options)); + this.reportConverter = reportConverter ?? throw new ArgumentNullException(nameof(reportConverter)); + this.lifetime = lifetime ?? throw new ArgumentNullException(nameof(lifetime)); } /// - /// Executes the background service operation. + /// Executes the application, to perform its work. /// - /// A token that can be used to stop the operation. - /// A task that represents the asynchronous operation. - protected override async Task ExecuteAsync(CancellationToken stoppingToken) + /// A cancellation token + /// A task + public async Task StartAsync(CancellationToken cancellationToken) { await reportConverter.ConvertAsync(options.Value); Console.WriteLine("Conversion complete; HTML report available at {0}", options.Value.OutputPath); - Environment.Exit(0); + lifetime.StopApplication(); } + + /// + /// Unused, always returns a completed task. + /// + /// A cancellation token + /// A task + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; } } diff --git a/CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.csproj b/CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.csproj index a16b3d38..85753053 100644 --- a/CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.csproj +++ b/CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.csproj @@ -1,16 +1,18 @@  + + + - netstandard2.0;net462 CSF.Screenplay $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml false false + A Test Framework Integration for CSF.Screenplay for NUnit 3.6+ - diff --git a/CSF.Screenplay.Selenium/CSF.Screenplay.Selenium.csproj b/CSF.Screenplay.Selenium/CSF.Screenplay.Selenium.csproj index 55df1e89..c387fd6d 100644 --- a/CSF.Screenplay.Selenium/CSF.Screenplay.Selenium.csproj +++ b/CSF.Screenplay.Selenium/CSF.Screenplay.Selenium.csproj @@ -1,15 +1,17 @@  + + + - netstandard2.0;netstandard2.1;net462 CSF.Screenplay.Selenium $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + An Extension for CSF.Screenplay providing Abilities & Performables for Selenium WebDriver 4.0+ - - - + + @@ -20,4 +22,8 @@ + + + + diff --git a/CSF.Screenplay.Selenium/Elements/TargetNotFoundException.cs b/CSF.Screenplay.Selenium/Elements/TargetNotFoundException.cs index 4c6e0764..0b1fc747 100644 --- a/CSF.Screenplay.Selenium/Elements/TargetNotFoundException.cs +++ b/CSF.Screenplay.Selenium/Elements/TargetNotFoundException.cs @@ -1,5 +1,4 @@ using System; -using System.Runtime.Serialization; using CSF.Screenplay.Reporting; using OpenQA.Selenium; @@ -8,7 +7,9 @@ namespace CSF.Screenplay.Selenium.Elements /// /// Thrown when is used, but no element can be found. /// +#if NET462 || NETSTANDARD [Serializable] +#endif public class TargetNotFoundException : Exception, IFormattableValue { /// @@ -62,12 +63,21 @@ public TargetNotFoundException(string message, Exception inner, ITarget target) { Target = target ?? throw new ArgumentNullException(nameof(target)); } - +#if NET462 || NETSTANDARD /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class from binary serialization. /// + /// + /// Don't use this API, it's for the deprecated binary serialization API, which is known to pose + /// security vulnerabilities. It is removed and unsupported in modern TFMs. + /// See The + /// BinaryFormatter migration guide for more information. + /// /// Serialization info /// Streaming context - protected TargetNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) {} + [Obsolete("Do not use this constructor overload, see the remarks for more info")] + protected TargetNotFoundException(System.Runtime.Serialization.SerializationInfo info, + System.Runtime.Serialization.StreamingContext context) : base(info, context) {} +#endif } } \ No newline at end of file diff --git a/CSF.Screenplay.Selenium/Resources/ScriptResources.cs b/CSF.Screenplay.Selenium/Resources/ScriptResources.cs index 5fe8c817..dcafe916 100644 --- a/CSF.Screenplay.Selenium/Resources/ScriptResources.cs +++ b/CSF.Screenplay.Selenium/Resources/ScriptResources.cs @@ -7,11 +7,9 @@ namespace CSF.Screenplay.Selenium.Resources /// static class ScriptResources { - static readonly ResourceManager resourceManager = new ResourceManager(typeof(ScriptResources)); + static readonly ResourceManager resourceManager = new ResourceManager(typeof(ScriptResources).FullName, typeof(ScriptResources).Assembly); - /// - /// Gets a short JavaScript which clears the browser's local storage. - /// - public static string ClearLocalStorage => resourceManager.GetString("ClearLocalStorage"); + /// Gets a short JavaScript for . + internal static string ClearLocalStorage => resourceManager.GetString("ClearLocalStorage"); } } \ No newline at end of file diff --git a/CSF.Screenplay.Selenium/Resources/ScriptResources.restext b/CSF.Screenplay.Selenium/Resources/ScriptResources.restext new file mode 100644 index 00000000..181b93b5 --- /dev/null +++ b/CSF.Screenplay.Selenium/Resources/ScriptResources.restext @@ -0,0 +1 @@ +ClearLocalStorage = localStorage.clear() \ No newline at end of file diff --git a/CSF.Screenplay.Selenium/Resources/ScriptResources.resx b/CSF.Screenplay.Selenium/Resources/ScriptResources.resx deleted file mode 100644 index 62a307b4..00000000 --- a/CSF.Screenplay.Selenium/Resources/ScriptResources.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - localStorage.clear() - - - \ No newline at end of file diff --git a/CSF.Screenplay.SpecFlow/CSF.Screenplay.SpecFlow.csproj b/CSF.Screenplay.SpecFlow/CSF.Screenplay.SpecFlow.csproj index 596a4151..2e431ff1 100644 --- a/CSF.Screenplay.SpecFlow/CSF.Screenplay.SpecFlow.csproj +++ b/CSF.Screenplay.SpecFlow/CSF.Screenplay.SpecFlow.csproj @@ -1,17 +1,19 @@  + + + - netstandard2.0;net462 CSF.Screenplay $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml false false CSF.Screenplay.SpecFlowPlugin + A Test Framework Integration for CSF.Screenplay for the legacy SpecFlow 3.4.3+ (recommendation: Switch to Reqnroll) - diff --git a/CSF.Screenplay.WebApis/CSF.Screenplay.WebApis.csproj b/CSF.Screenplay.WebApis/CSF.Screenplay.WebApis.csproj index 96d4e956..7117f640 100644 --- a/CSF.Screenplay.WebApis/CSF.Screenplay.WebApis.csproj +++ b/CSF.Screenplay.WebApis/CSF.Screenplay.WebApis.csproj @@ -1,12 +1,15 @@  + + - net5.0;netstandard2.0;net462;net8.0 + net5.0;netstandard2.0;net462;net8.0 CSF.Screenplay.WebApis $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml false + An Extension for CSF.Screenplay providing Abilities & Performables for interacting with HTTP web API endpoints diff --git a/CSF.Screenplay/CSF.Screenplay.csproj b/CSF.Screenplay/CSF.Screenplay.csproj index fabfef11..0ee09161 100644 --- a/CSF.Screenplay/CSF.Screenplay.csproj +++ b/CSF.Screenplay/CSF.Screenplay.csproj @@ -1,16 +1,18 @@  + + + - netstandard2.0;net462 CSF.Screenplay $(MSBuildProjectDirectory)\bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + The core CSF.Screenplay framework package - diff --git a/README.md b/README.md index 871de093..5bd9af04 100755 --- a/README.md +++ b/README.md @@ -16,5 +16,5 @@ Detailed information about Screenplay & how it is used is [available on the docu CI builds are configured via **AppVeyor**, with static code analysis & reporting in **SonarCloud**. -[![AppVeyor status](https://ci.appveyor.com/api/projects/status/y9ejfko3kflosava?svg=true)](https://ci.appveyor.com/project/craigfowler/csf-screenplay) +[![.NET CI](https://github.com/csf-dev/CSF.Screenplay/actions/workflows/dotnetCi.yml/badge.svg)](https://github.com/csf-dev/CSF.Screenplay/actions/workflows/dotnetCi.yml) [![Test coverage](https://sonarcloud.io/api/project_badges/measure?project=csf-dev_CSF.Screenplay&metric=coverage)](https://sonarcloud.io/summary/new_code?id=csf-dev_CSF.Screenplay) diff --git a/Tests/CSF.Screenplay.Selenium.TestWebapp/CSF.Screenplay.Selenium.TestWebapp.csproj b/Tests/CSF.Screenplay.Selenium.TestWebapp/CSF.Screenplay.Selenium.TestWebapp.csproj index 1b28a01c..a946f927 100644 --- a/Tests/CSF.Screenplay.Selenium.TestWebapp/CSF.Screenplay.Selenium.TestWebapp.csproj +++ b/Tests/CSF.Screenplay.Selenium.TestWebapp/CSF.Screenplay.Selenium.TestWebapp.csproj @@ -3,7 +3,9 @@ net8.0 enable - enable + disable + false + false diff --git a/Tests/CSF.Screenplay.Selenium.TestWebapp/Program.cs b/Tests/CSF.Screenplay.Selenium.TestWebapp/Program.cs index a5ec39e5..07230081 100644 --- a/Tests/CSF.Screenplay.Selenium.TestWebapp/Program.cs +++ b/Tests/CSF.Screenplay.Selenium.TestWebapp/Program.cs @@ -1,3 +1,5 @@ +using Microsoft.AspNetCore.Builder; + var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); diff --git a/Tests/CSF.Screenplay.Selenium.Tests/TestWebappSetupAndTeardown.cs b/Tests/CSF.Screenplay.Selenium.Tests/TestWebappSetupAndTeardown.cs index 95772e57..7598be40 100644 --- a/Tests/CSF.Screenplay.Selenium.Tests/TestWebappSetupAndTeardown.cs +++ b/Tests/CSF.Screenplay.Selenium.Tests/TestWebappSetupAndTeardown.cs @@ -23,7 +23,7 @@ public async Task StartWebAppAsync() [OneTimeTearDown] public void StopWebApp() { - webAppProcess?.Kill(); + webAppProcess?.Kill(true); webAppProcess?.Dispose(); } diff --git a/Tools/Appveyor.after_deploy.bat b/Tools/Appveyor.after_deploy.bat deleted file mode 100755 index 1bf4c01c..00000000 --- a/Tools/Appveyor.after_deploy.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo on - -@SET /A exitcode=0 -@SET /A TESTFAILURE_ERROR=1 -@SET /A PUSHARTIFACT_ERROR=2 -@SET /A READREPORT_ERROR=4 - -nunit3-console.exe CSF.Screenplay.Selenium.Tests\bin\Debug\CSF.Screenplay.Selenium.Tests.dll -@IF %ERRORLEVEL% NEQ 0 SET /A exitcode^|=%TESTFAILURE_ERROR% - -appveyor PushArtifact NUnit.report.json -@IF %ERRORLEVEL% NEQ 0 SET /A exitcode^|=%PUSHARTIFACT_ERROR% - -@EXIT /B %exitcode% diff --git a/Tools/Appveyor.before_build.bat b/Tools/Appveyor.before_build.bat deleted file mode 100755 index dc6b1d17..00000000 --- a/Tools/Appveyor.before_build.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo on - -git submodule update --init --recursive - -nuget restore CSF.Screenplay.Selenium.sln - -copy /y CSF.Screenplay.Selenium.Tests\App.AppVeyor.config CSF.Screenplay.Selenium.Tests\app.config - -@echo off \ No newline at end of file diff --git a/Tools/MultiTargeting.props b/Tools/MultiTargeting.props new file mode 100644 index 00000000..71572409 --- /dev/null +++ b/Tools/MultiTargeting.props @@ -0,0 +1,12 @@ + + + net462 + net8.0 + netstandard2.0;netstandard2.1;$(DotNetFrameworkLegacy);$(DotNetLatestLts) + + + + + + + \ No newline at end of file diff --git a/Tools/Version.props b/Tools/Version.props new file mode 100644 index 00000000..60332ca1 --- /dev/null +++ b/Tools/Version.props @@ -0,0 +1,17 @@ + + + craigfowler + MIT + https://csf-dev.github.io/CSF.Screenplay/ + https://github.com/csf-dev/CSF.Screenplay/ + 0 + 2.0.0 + dev.$(BuildNumber) + $(VersionPrefix)-$(VersionSuffix) + $(VersionPrefix) + $(VersionPrefix).$(BuildNumber) + $(AssemblyVersion) + $(Version)+commit$(SourceRevisionId) + + + \ No newline at end of file diff --git a/Tools/appveyor-setup-selenium.bat b/Tools/appveyor-setup-selenium.bat deleted file mode 100644 index c7e15335..00000000 --- a/Tools/appveyor-setup-selenium.bat +++ /dev/null @@ -1,20 +0,0 @@ -REM Set up a Selenium Manager config file, so that a fresh browser and driver are -REM downloaded explicitly, ignoring the pre-installed driver on the CI image. - -mkdir %USERPROFILE%\.cache\selenium -cp Tools\se-config.toml %USERPROFILE%\.cache\selenium - -REM Redefines the PATH environment variable, removing the preinstalled Selenium Webdriver. -REM Modern Selenium downloads/fetches the appropriate driver version for the browser, so -REM having this pre-installed driver in the path actually hurts more than helps. - -setlocal enabledelayedexpansion - -SET UNWANTED_PATH=C:\Tools\WebDriver - -REM Remove the unwanted path (handles all of ";path;", ";path" and "path;" cases) -SET "NEW_PATH=%PATH:;%UNWANTED_PATH%;=;%" -SET "NEW_PATH=!NEW_PATH:;%UNWANTED_PATH%=!" -SET "NEW_PATH=!NEW_PATH:%UNWANTED_PATH%;=!" - -endlocal & SET PATH=%NEW_PATH% diff --git a/Tools/appveyor-setup-sonarscanner.bat b/Tools/appveyor-setup-sonarscanner.bat deleted file mode 100644 index 02f08d99..00000000 --- a/Tools/appveyor-setup-sonarscanner.bat +++ /dev/null @@ -1,13 +0,0 @@ -REM Set up some env variables which will help SonarScanner identify the current branch - -IF NOT DEFINED APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH ( - SET BranchName=%APPVEYOR_REPO_BRANCH% - SET BranchParam=sonar.branch.name - SET PRParam= - echo Not building a PR -) ELSE ( - SET BranchName=%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% - SET BranchParam=sonar.pullrequest.branch - SET PRParam=/d:sonar.pullrequest.key=%APPVEYOR_PULL_REQUEST_NUMBER% - echo Building a PR -) diff --git a/Tools/appveyor-upload-test-results.ps1 b/Tools/appveyor-upload-test-results.ps1 deleted file mode 100644 index e08b6942..00000000 --- a/Tools/appveyor-upload-test-results.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -# Adapted from https://www.appveyor.com/docs/running-tests/#uploading-xml-test-results - -$SolutionRoot = "$PSScriptRoot\.." -$TestProjects = Get-ChildItem -Path $SolutionRoot\Tests\ -Exclude CSF.Screenplay.Selenium.TestWebapp - -$wc = New-Object 'System.Net.WebClient' -$TestEndpoint = "https://ci.appveyor.com/api/testresults/nunit/$env:APPVEYOR_JOB_ID" - -foreach($project in $TestProjects) -{ - $projectName = Split-Path $project -Leaf - $testResultFile = "$project\TestResults\TestResults.xml" - Move-Item $testResultFile "$SolutionRoot\TestResults\$projectName.TestResults.xml" - $wc.UploadFile($TestEndpoint, (Resolve-Path $SolutionRoot\TestResults\$projectName.TestResults.xml)) -} - -exit $env:TESTS_FAILED diff --git a/Tools/run-tests-with-coverage.ps1 b/Tools/run-tests-with-coverage.ps1 deleted file mode 100644 index b7f20822..00000000 --- a/Tools/run-tests-with-coverage.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -$SolutionRoot = "$PSScriptRoot\.." -$TestProjects = Get-ChildItem -Path $SolutionRoot\Tests\ -Exclude CSF.Screenplay.Selenium.TestWebapp -$Tfm = "net8.0" -$Configuration = "Debug" -Remove-Item $SolutionRoot\TestResults\* -ErrorAction Ignore -$TetsFailed = 0 - -foreach($project in $TestProjects) -{ - $projectName = Split-Path $project -Leaf - $projectAssembly = "$project\bin\$Configuration\$Tfm\$projectName.dll" - coverlet ` - "$projectAssembly" ` - --target "dotnet" ` - --targetargs "test $project --no-build --logger:nunit --test-adapter-path:." ` - -f=opencover ` - -o="$SolutionRoot\TestResults\$projectName.opencover.xml" - - if ($LastExitCode -eq 1) { - $TetsFailed = 1 - } - elseif ($LastExitCode -eq 3) { - $TetsFailed = 1 - } -} - -$env:TESTS_FAILED = $TetsFailed