123456789101112131415161718192021222324252627 |
- namespace TestProject1
- {
- [TestClass]
- public class UnitTest1 : PageTest
- {
- [TestMethod]
- 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"));
- }
- }
- }
|