Skip to content

Commit 515a443

Browse files
committed
Added new tests
1 parent b094550 commit 515a443

8 files changed

+72
-1
lines changed

playwright.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ const config = {
3232
/* Opt out of parallel tests on CI. */
3333
workers: process.env.CI ? 1 : undefined,
3434
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
35-
reporter: 'html',
35+
reporter: [
36+
['list'],
37+
['html'],
38+
],
3639
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
3740
use: {
3841
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Custom expect message test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io');
6+
await expect(page.getByText('Top Category'), 'top category should be visible').toBeVisible();
7+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Custom Polling test', async ({ page }) => {
5+
await expect.poll(async () => {
6+
const response = await page.request.get('https://api.lambdatest.com/automation/api/v1/platforms');
7+
return response.status();
8+
}, {
9+
message: 'Response was either not 200 or timeout',
10+
intervals: [2_000, 4_000, 10_000],
11+
timeout: 60000,
12+
}).toBe(200);
13+
});

tests/expect-custom-retry.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Expect Custom Retry test', async ({ page }) => {
5+
await expect(async () => {
6+
const response = await page.request.get('https://api.lambdatest.com/automation/api/v1/platforms');
7+
expect(response.status()).toBe(200);
8+
}).toPass({
9+
intervals: [1_000, 2_000, 10_000],
10+
timeout: 60_000
11+
});
12+
});

tests/expect-poll.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Fetch platform along with browsers and version supported using Playwright Expect Poll test', async ({ page }) => {
5+
await expect.poll(async () => {
6+
const response = await page.request.get('https://api.lambdatest.com/automation/api/v1/platforms');
7+
return response.status();
8+
}, {
9+
message: 'Response was either not 200 or timeout',
10+
timeout: 10000,
11+
}).toBe(200);
12+
});

tests/expect-retry.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('Expect Retry test', async ({ page }) => {
5+
await expect(async () => {
6+
const response = await page.request.get('https://api.lambdatest.com/automation/api/v1/platforms');
7+
expect(response.status()).toBe(201);
8+
}).toPass();
9+
});

tests/negative-matchers.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const { test } = require("../lambdatest-setup");
2+
const { expect } = require("@playwright/test");
3+
4+
test('Negative matchers test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io');
6+
await expect(page.getByText('Top Category'), 'top category text should not be visible').not.toBeVisible();
7+
});

tests/soft-assertions.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('Soft assertion test', async ({ page }) => {
5+
await page.goto('https://ecommerce-playground.lambdatest.io');
6+
await expect.soft(page.getByText('Top Category'), 'top category should be visible').toBeVisible();
7+
await expect(page).toHaveTitle("Your Store");
8+
});

0 commit comments

Comments
 (0)