How to use ShouldOpenPlaywright method of Playwright.TestingHarnessTest.NUnit.SimpleSmokeTests class

Best Playwright-dotnet code snippet using Playwright.TestingHarnessTest.NUnit.SimpleSmokeTests.ShouldOpenPlaywright

Run Playwright-dotnet automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.


Source: SimpleSmokeTests.NUnit.cs Github

1using System.IO;
2using System.Threading.Tasks;
3using Microsoft.Playwright.NUnit;
4using NUnit.Framework;
6namespace Playwright.TestingHarnessTest.NUnit
9    public class SimpleSmokeTests : PageTest
10    {
11        [Test]
12        public async Task ShouldOpenPlaywright()
13        {
14            var path = Path.GetFullPath("index.html");
15            Assert.IsNotNull(Page);
16            await Page.GotoAsync("file://" + path);
17            var h1 = await Page.TextContentAsync("h1");
18            Assert.AreEqual("Getting started.", h1);
20            var title = await Page.EvaluateAsync<string>("() => document.title");
21            Assert.AreEqual("This is a website.", title);
23            await Expect(Page.Locator("h1")).ToBeVisibleAsync();
24        }
25    }
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in SimpleSmokeTests

Trigger ShouldOpenPlaywright code on LambdaTest Cloud Grid

Execute automation tests with ShouldOpenPlaywright on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)