Skip to content

Commit

Permalink
add tests back in
Browse files Browse the repository at this point in the history
  • Loading branch information
ianoflynnautomation committed Sep 21, 2024
1 parent c5f77b1 commit 34e736e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 13 deletions.
30 changes: 17 additions & 13 deletions .github/actions/run-tests-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ runs:
# shell: bash
# run: dotnet test --no-restore --no-build --verbosity normal ${{ inputs.test-project-pattern }}

- name: Run ${{ inputs.test-artifact-name }} Tests
shell: pwsh
run: powershell Invoke-WebRequest -Uri "https://localworker.blob.core.windows.net/win-x64/tests.zip" -OutFile "./tests.zip"
# - name: Run ${{ inputs.test-artifact-name }} Tests
# shell: pwsh
# run: powershell Invoke-WebRequest -Uri "https://localworker.blob.core.windows.net/win-x64/tests.zip" -OutFile "./tests.zip"

- name: Unzip tests binary
shell: pwsh
run: powershell Expand-Archive -Path tests.zip -DestinationPath ./

- name: Run tests
uses: microsoft/vstest-action@v1.0.0
with:
searchFolder: ${{ inputs.test-project-pattern }}
test-filter-criteria: ${{ inputs.test-filter-criteria }}
runInParallel: true
# - name: Unzip tests binary
# shell: pwsh
# run: powershell Expand-Archive -Path tests.zip -DestinationPath ./

# - name: Run tests
# uses: microsoft/vstest-action@v1.0.0
# with:
# searchFolder: ${{ inputs.test-project-pattern }}
# test-filter-criteria: ${{ inputs.test-filter-criteria }}
# runInParallel: true

- name: Run Tests
shell: bash
run: dotnet test **/bin/**/*${{ inputs.test-filter-criteria }}

- name: Publish Test Results
uses: actions/upload-artifact@v4
Expand Down
7 changes: 7 additions & 0 deletions Everything.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemTests", "tests\SystemTests\SystemTests.csproj", "{2982AA1E-0B81-40B2-983C-763AA332773C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -78,6 +80,10 @@ Global
{EAD6CF0B-2979-462C-BBB9-AF723B1EB570}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAD6CF0B-2979-462C-BBB9-AF723B1EB570}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAD6CF0B-2979-462C-BBB9-AF723B1EB570}.Release|Any CPU.Build.0 = Release|Any CPU
{2982AA1E-0B81-40B2-983C-763AA332773C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2982AA1E-0B81-40B2-983C-763AA332773C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2982AA1E-0B81-40B2-983C-763AA332773C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2982AA1E-0B81-40B2-983C-763AA332773C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -93,5 +99,6 @@ Global
{D6829485-DD9C-42CE-BEDE-4EB0E81021AC} = {BAA5312D-B54C-42D6-A3B9-504DD12F8250}
{698594AE-78D3-429F-B5CC-3A6F6BCE397A} = {BAA5312D-B54C-42D6-A3B9-504DD12F8250}
{EAD6CF0B-2979-462C-BBB9-AF723B1EB570} = {BAA5312D-B54C-42D6-A3B9-504DD12F8250}
{2982AA1E-0B81-40B2-983C-763AA332773C} = {BAA5312D-B54C-42D6-A3B9-504DD12F8250}
EndGlobalSection
EndGlobal
28 changes: 28 additions & 0 deletions tests/SystemTests/SystemTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.27.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.Playwright.NUnit" />
<Using Include="NUnit.Framework" />
<Using Include="System.Text.RegularExpressions" />
<Using Include="System.Threading.Tasks" />
</ItemGroup>

</Project>
27 changes: 27 additions & 0 deletions tests/SystemTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace SystemTests;

[Parallelizable(ParallelScope.Self)]
[TestFixture]
public class Tests : PageTest
{
[Test]
public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage()
{
await Page.GotoAsync("https://playwright.dev");

// Expect a title "to contain" a substring.
await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));

// create a locator
var getStarted = Page.Locator("text=Get Started");

// Expect an attribute "to be strictly equal" to the value.
await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/intro");

// Click the get started link.
await getStarted.ClickAsync();

// Expects the URL to contain intro.
await Expect(Page).ToHaveURLAsync(new Regex(".*intro"));
}
}

0 comments on commit 34e736e

Please sign in to comment.