Skip to content

Commit 7a66fca

Browse files
committed
Added tests
1 parent dc73850 commit 7a66fca

9 files changed

+41
-16
lines changed

test.spec.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/page-title.spec.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const { expect } = require("@playwright/test");
33

44
test('homepage has title', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io');
6-
7-
// Expect a title "to contain" a substring.
8-
await expect(page).toHaveTitle(/Your Store/);
9-
10-
})
6+
await expect(page).toHaveTitle("Your Store");
7+
await expect(page).toHaveTitle(/Store/);
8+
});

tests/page-url-not-have.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const { expect } = require("@playwright/test");
33

44
test('LambdaTest Playground URL Not To Have test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io');
6-
7-
// Expect a url " not to contain" a substring.
6+
await expect(page).not.toHaveURL("https://abc.lambdatest.io");
87
await expect(page).not.toHaveURL(/404/);
9-
10-
})
8+
});

tests/page-url.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const { expect } = require("@playwright/test");
33

44
test('LambdaTest Playground URL test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io');
6-
7-
// Expect a url "to contain" a substring.
6+
await expect(page).toHaveURL("https://ecommerce-playground.lambdatest.io");
87
await expect(page).toHaveURL(/ecommerce/);
9-
10-
})
8+
});

tests/to-have-id.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ const { expect } = require("@playwright/test");
44
test('First name on Registration page to have Id test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
66
const firstname = page.locator("//input[@name='firstname']");
7-
await expect(firstname).toHaveId("input-firstname1");
7+
await expect(firstname).toHaveId("input-firstname");
88
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('First name on Registration page to have screenshot name test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const continueBtn = page.locator("input[value='Continue']");
7+
await expect(continueBtn).toHaveScreenshot('continue-btn.PNG');
8+
});

tests/to-have-text.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Registration page is having text First name', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const firstname = page.locator("label[for='input-firstname']");
7+
await expect(firstname).toHaveText("First Name");
8+
});

tests/to-have-value.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Newsletter Yes radio is having value 1', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const newsletterYesRadio = page.locator("#input-newsletter-yes");
7+
await expect(newsletterYesRadio).toHaveValue("1");
8+
});

tests/to-have-values.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Multi Select List of Country', async ({ page }) => {
5+
await page.goto('https://www.lambdatest.com/selenium-playground/select-dropdown-demo');
6+
const countrySelectorLoc = page.locator("#multi-select");
7+
await countrySelectorLoc.selectOption(["California", "Florida", "New Jersey"]);
8+
await expect(countrySelectorLoc).toHaveValues([/California/, /Florida/, /New Jersey/]);
9+
});

0 commit comments

Comments
 (0)