Yep
This commit is contained in:
23
Tests/E2ETests/E2ETests.csproj
Normal file
23
Tests/E2ETests/E2ETests.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.30.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.5.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
30
Tests/E2ETests/MicrosoftLoginTests.cs
Normal file
30
Tests/E2ETests/MicrosoftLoginTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Playwright;
|
||||
using Microsoft.Playwright.NUnit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace E2ETests;
|
||||
|
||||
[Parallelizable(ParallelScope.Self)]
|
||||
[TestFixture]
|
||||
public class MicrosoftLoginTests : PageTest
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public async void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test1()
|
||||
{
|
||||
await Page.GotoAsync("https://lucaserver.space/shogi", new PageGotoOptions { WaitUntil = WaitUntilState.NetworkIdle });
|
||||
var loginButton = Page.GetByRole(AriaRole.Button, new PageGetByRoleOptions { Name = "Log in" });
|
||||
await loginButton.ClickAsync();
|
||||
//await Page.WaitForURLAsync()
|
||||
}
|
||||
}
|
||||
33
Tests/E2ETests/PlaywriteExample.cs
Normal file
33
Tests/E2ETests/PlaywriteExample.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Playwright;
|
||||
using Microsoft.Playwright.NUnit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace E2ETests;
|
||||
|
||||
[Parallelizable(ParallelScope.Self)]
|
||||
[TestFixture]
|
||||
public class PlaywriteExample : 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.GetByRole(AriaRole.Link, new() { Name = "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"));
|
||||
}
|
||||
}
|
||||
1
Tests/E2ETests/Usings.cs
Normal file
1
Tests/E2ETests/Usings.cs
Normal file
@@ -0,0 +1 @@
|
||||
global using NUnit.Framework;
|
||||
3
Tests/E2ETests/appsettings.json
Normal file
3
Tests/E2ETests/appsettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user