Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ TestResult.xml
bin
obj
.vs
log
.DS_Store
4 changes: 3 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
* @browserstack/afd-dev
.github/* @browserstack/asi-devs

* @browserstack/automate-public-repos
12 changes: 6 additions & 6 deletions CSharp-Playwright-BrowserStack.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp-Playwright-BrowserStack", "CSharp-Playwright-BrowserStack\CSharp-Playwright-BrowserStack.csproj", "{D309DDB3-1E3B-428B-B00B-1257F2532079}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp-Playwright-BrowserStack", "CSharp-Playwright-BrowserStack\CSharp-Playwright-BrowserStack.csproj", "{5DC1EC78-C0C5-4869-9769-90718B820BB9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D309DDB3-1E3B-428B-B00B-1257F2532079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D309DDB3-1E3B-428B-B00B-1257F2532079}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D309DDB3-1E3B-428B-B00B-1257F2532079}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D309DDB3-1E3B-428B-B00B-1257F2532079}.Release|Any CPU.Build.0 = Release|Any CPU
{5DC1EC78-C0C5-4869-9769-90718B820BB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DC1EC78-C0C5-4869-9769-90718B820BB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DC1EC78-C0C5-4869-9769-90718B820BB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DC1EC78-C0C5-4869-9769-90718B820BB9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4977FC04-06AD-47AF-90C6-66010738CC2D}
SolutionGuid = {0A720641-5ECB-4F2D-8678-EB726CF8DDA7}
EndGlobalSection
EndGlobal
109 changes: 0 additions & 109 deletions CSharp-Playwright-BrowserStack/BrowserStackNUnitTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,16 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="BrowserStackLocal" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.Playwright" Version="1.36.0" />

<Content Include="local.conf.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="parallel.conf.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="single.conf.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Remove="local.conf.json" />
<None Remove="parallel.conf.json" />
<None Remove="single.conf.json" />
<PackageReference Include="Microsoft.Playwright" Version="*" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="*" />
<PackageReference Include="BrowserStack.TestAdapter" Version="0.*" />
</ItemGroup>
</Project>
31 changes: 0 additions & 31 deletions CSharp-Playwright-BrowserStack/LocalTest.cs

This file was deleted.

14 changes: 0 additions & 14 deletions CSharp-Playwright-BrowserStack/ParallelTest.cs

This file was deleted.

59 changes: 0 additions & 59 deletions CSharp-Playwright-BrowserStack/README.md

This file was deleted.

24 changes: 24 additions & 0 deletions CSharp-Playwright-BrowserStack/SampleLocalTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.Playwright.NUnit;
using NUnit.Framework;

namespace CSharpPlaywrightBrowserStack
{
[TestFixture]
[Category("sample-local-test")]
public class SampleLocalTest : PageTest
{
public SampleLocalTest() : base() { }

[Test]
public async Task BStackHealthCheck()
{
// Navigate to the base url
await Page.GotoAsync("http://bs-local.com:45454/");

// Verify if BrowserStackLocal running
var title = await Page.TitleAsync();
StringAssert.Contains("BrowserStack Local", title);
}
}
}

44 changes: 44 additions & 0 deletions CSharp-Playwright-BrowserStack/SampleTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using NUnit.Framework;
using Microsoft.Playwright;
using Microsoft.Playwright.NUnit;

namespace CSharpPlaywrightBrowserStack
{
[TestFixture]
[Category("sample-test")]
public class SampleTest : PageTest
{
public SampleTest() : base() { }

[Test]
public async Task SearchBstackDemo()
{
//Navigate to the bstackdemo url
_ = await Page.GotoAsync("https://bstackdemo.com/");

// Add the first item to cart
await Page.Locator("[id=\"\\31 \"]").GetByText("Add to Cart").ClickAsync();
IReadOnlyList<string> phone = await Page.Locator("[id=\"\\31 \"]").Locator(".shelf-item__title").AllInnerTextsAsync();
Console.WriteLine("Phone =>" + phone[0]);


// Get the items from Cart
IReadOnlyList<string> quantity = await Page.Locator(".bag__quantity").AllInnerTextsAsync();
Console.WriteLine("Bag quantity =>" + quantity[0]);

// Verify if there is a shopping cart
StringAssert.Contains("1", await Page.Locator(".bag__quantity").InnerTextAsync());


//Get the handle for cart item
ILocator cartItem = Page.Locator(".shelf-item__details").Locator(".title");

// Verify if the cart has the right item
StringAssert.Contains(await cartItem.InnerTextAsync(), string.Join(" ", phone));
IReadOnlyList<string> cartItemText = await cartItem.AllInnerTextsAsync();
Console.WriteLine("Cart item => " + cartItemText[0]);

Assert.That(phone[0], Is.EqualTo(cartItemText[0]));
}
}
}
Loading