-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/wzarek/Reasn
- Loading branch information
Showing
2 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: unit tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Determine ReasnAPI solution | ||
run: echo SOLUTION_FILE=$(realpath ./Server/ReasnAPI/ReasnAPI.sln) >> $GITHUB_ENV | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Install coverlet | ||
run: dotnet tool install -g coverlet.console | ||
|
||
- name: Install dependencies | ||
run: dotnet restore ${{ env.SOLUTION_FILE }} | ||
|
||
- name: Build solution | ||
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore | ||
|
||
- name: Test with dotnet | ||
run: | | ||
RESULTS_FILENAME=results-$(date +"%Y-%m-%d_%H_%M_%S") | ||
dotnet test ${{ env.SOLUTION_FILE }} --logger "trx;logfilename=$RESULTS_FILENAME.trx" --logger "html;logfilename=$RESULTS_FILENAME.html" --no-build --results-directory "TestResults-${{ github.sha }}" | ||
- name: Run coverlet | ||
run: | | ||
TEST_ASSEMBLY=$(find ./Server/ReasnAPI/ReasnAPI.Tests/bin/ -name "ReasnAPI.Tests.dll") | ||
coverlet "$TEST_ASSEMBLY" --target "dotnet" --targetargs "test ${{ env.SOLUTION_FILE }} --no-build" | ||
- name: Upload dotnet test results | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ failure() }} | ||
with: | ||
name: dotnet-results-${{ github.sha }} | ||
path: TestResults-${{ github.sha }} | ||
retention-days: 14 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
namespace ReasnAPI.Tests | ||
{ | ||
[TestClass] | ||
public class UnitTest1 : PageTest | ||
public class UnitTest1 | ||
{ | ||
[TestMethod] | ||
public async Task HomepageHasPlaywrightInTitleAndGetStartedLinkLinkingtoTheIntroPage() | ||
public void TestAdd() | ||
{ | ||
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")); | ||
Assert.AreEqual(17, 17); | ||
} | ||
} | ||
} |