-
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.
consolidated typescript tests in to describe block, added rest of cur…
…rent tests to dotnet implementation
- Loading branch information
1 parent
7754e57
commit 3a25cdb
Showing
6 changed files
with
67 additions
and
38 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
global using NUnit.Framework; | ||
global using NUnit.Framework; | ||
global using Microsoft.Playwright; | ||
global using Microsoft.Playwright.NUnit; |
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,15 +1,45 @@ | ||
using NUnit.Framework.Constraints; | ||
|
||
namespace Playwright.Tests; | ||
|
||
public class TheInternetTests | ||
[Parallelizable(ParallelScope.Self)] | ||
[TestFixture] | ||
public class TheInternetTests : PageTest | ||
{ | ||
[SetUp] | ||
public void Setup() | ||
public async Task Setup() | ||
{ | ||
await Page.GotoAsync("http://the-internet.herokuapp.com/"); | ||
} | ||
|
||
[Test] | ||
public async Task ABTesting() | ||
{ | ||
await Page.GetByRole(AriaRole.Link, new() { Name = "A/B Testing" }).ClickAsync(); | ||
|
||
await Expect(Page.GetByRole(AriaRole.Heading)).ToContainTextAsync("A/B Test"); | ||
await Expect(Page.GetByRole(AriaRole.Paragraph)).ToContainTextAsync("Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through)."); | ||
} | ||
|
||
[Test] | ||
public async Task AddAndRemoveElements() | ||
{ | ||
await Page.GetByRole(AriaRole.Link, new() {Name = "Add/Remove Elements"}).ClickAsync(); | ||
|
||
await Page.GetByRole(AriaRole.Button, new() {Name = "Add Element"}).ClickAsync(); | ||
await Page.GetByRole(AriaRole.Button, new() {Name = "Add Element"}).ClickAsync(); | ||
await Page.GetByRole(AriaRole.Button, new() {Name = "Add Element"}).ClickAsync(); | ||
|
||
await Expect(Page.GetByRole(AriaRole.Button, new() {Name = "Delete"})).ToHaveCountAsync(3); | ||
|
||
await Page.GetByRole(AriaRole.Button, new() {Name = "delete"}).Nth(1).ClickAsync(); | ||
|
||
await Expect(Page.GetByRole(AriaRole.Button, new() {Name = "Delete"})).ToHaveCountAsync(2); | ||
} | ||
|
||
[Test] | ||
public void Test1() | ||
public async Task BasicAuthentication() | ||
{ | ||
Assert.Pass(); | ||
await Page.GetByRole(AriaRole.Link, new() {Name = "Basic Auth"}).ClickAsync(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
typescript/tests/the-internet/addremoveelements-codegen.spec.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.describe("The Internet", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://the-internet.herokuapp.com/'); | ||
}) | ||
test('A/B Testing - with `codegen`', async ({ page }) => { | ||
await page.getByRole('link', { name: 'A/B Testing' }).click(); | ||
|
||
await expect(page.getByRole('heading')).toContainText("A/B Test"); | ||
await expect(page.getByRole('paragraph')).toContainText('Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).'); | ||
}); | ||
|
||
test('Add/Remove Elements', async ({ page }) => { | ||
await page.getByRole('link', { name: 'Add/Remove Elements' }).click(); | ||
await page.getByRole('button', { name: 'Add Element' }).click(); | ||
await page.getByRole('button', { name: 'Add Element' }).click(); | ||
await page.getByRole('button', { name: 'Add Element' }).click(); | ||
|
||
expect(page.getByRole('button', { name: 'Delete' })).toHaveCount(3); | ||
|
||
await page.getByRole('button', { name: 'Delete' }).nth(1).click(); | ||
|
||
expect(page.getByRole('button', { name: 'Delete' })).toHaveCount(2); | ||
}); | ||
|
||
test('Basic Authentication', async ({ page }) => { | ||
|
||
}); | ||
}) |