Skip to content

Commit dc73850

Browse files
committed
Added tests
1 parent 515a443 commit dc73850

13 files changed

+77
-20
lines changed

test.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const firstname = page.locator("//input[@name='firstname']");
2+
await expect(firstname).toHaveId("input-firstname1");

tests/to-be-checked.spec.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
const { test } = require("../lambdatest-setup");
22
const { expect } = require("@playwright/test");
33

4-
test('Registration Privacy Policy is checked test', async ({ page }) => {
4+
test('Registration Privacy Policy checkbox is checked test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6-
76
const privacyCheckbox = page.locator("//label[@for='input-agree']");
87
await privacyCheckbox.click();
98
await expect(privacyCheckbox).toBeChecked();
10-
11-
})
9+
});

tests/to-be-disabled.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('First name field on Registration page to not be disabled test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const firstNameLoc = page.locator("//input[@id='input-firstname']");
7+
await expect(firstNameLoc).not.toBeDisabled();
8+
})

tests/to-be-editable.spec.js

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

44
test('First name field on Registration page to be editable test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6-
76
const firstNameLoc = page.locator("//input[@id='input-firstname']");
87
await expect(firstNameLoc).toBeEditable();
9-
})
8+
});

tests/to-be-enabled.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('Continue button on Registration page to be enabled 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).toBeEnabled();
8+
});

tests/to-be-focused.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('Continue button on Registration page to be enabled test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const loc = "//input[@id='input-firstname']";
7+
await page.locator(loc).focus();
8+
await expect(page.locator(loc)).toBeFocused();
9+
});

tests/to-be-visible.spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
const { test } = require("../lambdatest-setup");
22
const { expect } = require("@playwright/test");
33

4-
test('Continue button is visible on Registration page is visible test', async ({ page }) => {
4+
test('Login link is visible on right handside of Registration page', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6-
7-
const continueBtn = page.locator("//input[@value='Continue']");
8-
await expect(continueBtn).toBeVisible();
9-
10-
})
6+
const loginLi = page.locator("aside[id='column-right'] a:nth-child(1)");
7+
await expect(loginLi).toBeVisible();
8+
});

tests/to-contain-text.spec.js

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

44
test('Registration page validation message to contain text test', async ({ page }) => {
55
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6-
76
const continueBtn = page.locator("//input[@value='Continue']");
87
await continueBtn.click();
9-
108
const warningMsg = page.locator("//div[@class='alert alert-danger alert-dismissible']");
11-
await expect(warningMsg).toContainText("Warning:");
12-
13-
// just check another part of text as well
14-
await expect(warningMsg).toContainText("You must agree to the Privacy Policy!");
15-
16-
})
9+
await expect(warningMsg).toContainText("Warning: You must agree to the Privacy Policy!");
10+
await expect(warningMsg).toContainText("agree to the Privacy");
11+
});

tests/to-have-attribute.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 h1 element to have attribute test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const noNewsLetterSubscribe = page.locator("#input-newsletter-no");
7+
await expect(noNewsLetterSubscribe).toHaveAttribute("type", "radio");
8+
});

tests/to-have-class.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 h1 element to have class test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io/index.php?route=account/register');
6+
const h1 = page.locator("//h1");
7+
await expect(h1).toHaveClass("page-title h3");
8+
});

0 commit comments

Comments
 (0)