Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.DS_Store
node_modules
.tmp
npm-debug.log

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
.auth/
/playwright/.auth/
.auth/
2 changes: 2 additions & 0 deletions FETCH_HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
f2bbe9ea3f079ca2cb9fb27b2c9f8bbbf06a1a99 not-for-merge branch 'main' of github.com:SebastianScherfQA/learning-playwright-5911873
f2bbe9ea3f079ca2cb9fb27b2c9f8bbbf06a1a99 github.com:LinkedInLearning/learning-playwright-5911873
1 change: 1 addition & 0 deletions HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/main
13 changes: 13 additions & 0 deletions config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[core]
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true
[submodule]
active = .
[remote "upstream"]
url = git@github.com:LinkedInLearning/learning-playwright-5911873.git
[remote "origin"]
url = git@github.com:SebastianScherfQA/learning-playwright-5911873.git
fetch = +refs/heads/*:refs/remotes/origin/*
1 change: 1 addition & 0 deletions description
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Binary file not shown.
Binary file not shown.
Binary file not shown.
61 changes: 27 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "learning-playwright-5911873",
"version": "1.0.0",
"description": "This is the repository for the LinkedIn Learning course `learning-playwright`. The full course is available from [LinkedIn Learning][lil-course-url].",
"description": "",
"main": "index.js",
"scripts": {
"test": "npx playwright test",
"test": "playwright test",
"test:chromium": "npx playwright test --project chromium",
"test:first": "npx playwright test --grep @first",
"test:local": "BASE_URL=http://localhost:4200 npx playwright test",
"test:local": "cross-env BASE_URL=http://localhost:4200 npx playwright test",
"test:report": "npx playwright test && npx playwright show-report",
"test:ui": "npx playwright test --ui"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"devDependencies": {
"@playwright/test": "^1.47.2",
"@types/node": "^22.7.4",
"dotenv": "^16.4.5"
"@playwright/test": "^1.59.1",
"@types/node": "^22.7.4"
}
}
40 changes: 40 additions & 0 deletions packed-refs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# pack-refs with: peeled fully-peeled sorted
4080dc101681d46f35b39aafd0c50c50c0f0046d refs/heads/01_01
4080dc101681d46f35b39aafd0c50c50c0f0046d refs/heads/01_01b
04bdfc084d80de156da67c467d98c88e527f500b refs/heads/01_01e
199e11cd9f820da88dc8834ea546cc55c331a237 refs/heads/01_02b
6eb16c1b763d1758b781a65fd977565217b9c01c refs/heads/01_02e
b15277d2910ee3bf9be8683d4bd4a3c01dc64a0c refs/heads/01_03b
302bfe474c4198c26e0ddcac6690c12a96f630a3 refs/heads/01_03e
9b42469f088ccaab5aaf8163019f4b9a493e08b3 refs/heads/01_04b
8b663b00a458419e5811bdf7d204480a47ac7582 refs/heads/01_04e
a65de21c62b3f0253ed406d12af6742df038960a refs/heads/01_05b
f41e76f083dc52978344b1edd1777e1070ebd36d refs/heads/01_05e
234c5634884d1865293e66fcf528fda8a62a0d6d refs/heads/01_06b
e9f31c2775fbce1afa0e7928a9f338a551f7a8fa refs/heads/01_06e
9080ac26443f3ab2698aac029084dd395ad2a9d2 refs/heads/01_07b
58132cbe00a8a68542b64e14c9634e10ecc206d1 refs/heads/01_07e
06baaa49007e2928428431f5aa2419b9e917e7da refs/heads/02_02b
b1767cd467c700aa3e54be850d59aa7b267300aa refs/heads/02_02e
fb721d2bdff6b222d44c250227b6bff562d8e5f1 refs/heads/02_03b
1ae32de3601906cb1d5bc83cbcfb65c72af36c34 refs/heads/02_03e
8db20e2e044fd6997dbbbf22cd913b87959b556f refs/heads/02_04b
ddc41b845cca889f512398b7e03108564629ed38 refs/heads/02_04e
e2b4e8730d2754e084b204f068470cb69d3e6e14 refs/heads/02_05b
a8e9ea243b8c331fbdab25afe2ef8dd77650dddb refs/heads/02_05e
51f09888e9b32e0db87babf7de20c1dda5dbf7c8 refs/heads/02_06b
8619df2b3c93f36a6cc858fcc897b13dd5b2b9d6 refs/heads/02_06e
8619df2b3c93f36a6cc858fcc897b13dd5b2b9d6 refs/heads/02_07b
2245120498ad746cd87402f171419a8a7524f81b refs/heads/02_07e
eb2e1ea59376b127a3e4b4f6f30c690c302200fc refs/heads/02_08b
3d7fad6beb14f6849eb89431b99596cf9a882b1a refs/heads/02_08e
232758625b3689e29f9d20f8b3227706b3c80711 refs/heads/02_11
3faa07768eb49913aca163d9c91b2bcf00a55983 refs/heads/02_11b
fdd0baa5b41f6130c930be29ec585daf76b1be86 refs/heads/02_11e
05f2b31c48c7fa22298a5d589bb49b8b3aa1d2e1 refs/heads/03_02b
a1da2a4197b33cf4de9eff2b70488bad16b0d1e8 refs/heads/03_02e
9cf7b2a7654ffedd5ba4b5698cd9fe0f60502d33 refs/heads/03_03b
3ba34c73cd49207bc86c974bac3d92dd7a3fb916 refs/heads/03_03e
defd8b147285e3d410d040d7c56ce662d7981cf6 refs/heads/03_04b
3ff5008f968fed9c8accf4acc2da25b7c624e1fc refs/heads/03_04e
f2bbe9ea3f079ca2cb9fb27b2c9f8bbbf06a1a99 refs/heads/main
42 changes: 25 additions & 17 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
import { defineConfig, devices } from "@playwright/test";
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
import dotenv from "dotenv";
import path from "path";
dotenv.config({ path: path.resolve(__dirname, ".env") });
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });

/**
* See https://playwright.dev/docs/test-configuration.
*/

export default defineConfig({
timeout: 30_000,
globalTimeout: 10 * 60 * 1000,
testDir: "./tests",
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI 2 times and locally 1 time */
/* Retry on CI 2 times and locally 1 times */
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [["html"], ["list"]],
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "https://practicesoftwaretesting.com",
/* Base URL to use in actions like `await page.goto('')`. */
baseURL: 'https://practicesoftwaretesting.com',
testIdAttribute: "data-test",

// baseURL: 'http://portal.videc.info/',
// locale: 'de-DE',
// launchOptions: {
// args: ['--disable-features=Translate'],
// },
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on",
trace: 'on',
actionTimeout: 0,
ignoreHTTPSErrors: true,
video: "retain-on-failure",
screenshot: "only-on-failure",
headless: true,
video: 'retain-on-failure',
screenshot: 'only-on-failure',
headless: true
},

/* Configure projects for major browsers */
Expand All @@ -46,10 +53,11 @@ export default defineConfig({
testMatch: /.*\.setup\.ts/,
},
{
name: "chromium",
name: 'chromium',
dependencies: ["setup"],
use: { ...devices["Desktop Chrome"], permissions: ["clipboard-read"] },
},
use: { ...devices['Desktop Chrome'], permissions: ["clipboard-read"]},
}

// {
// name: 'firefox',
// dependencies: ["setup"],
Expand Down Expand Up @@ -86,7 +94,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// url: 'http://localhost:3000',
// reuseExistingServer: !process.env.CI,
// },
});
1 change: 1 addition & 0 deletions refs/remotes/origin/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/remotes/origin/main
1 change: 1 addition & 0 deletions refs/remotes/origin/main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f2bbe9ea3f079ca2cb9fb27b2c9f8bbbf06a1a99
20 changes: 20 additions & 0 deletions tests/June5.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {
await page.goto('http://portal.videc.info/index.html#/');
await page.getByRole('textbox', { name: 'Benutzername' }).click();
await page.getByRole('textbox', { name: 'Benutzername' }).fill('admin');
await page.getByRole('textbox', { name: 'Kennwort' }).click();
await page.getByRole('textbox', { name: 'Kennwort' }).fill('admin');
await page.getByRole('button', { name: 'Anmelden' }).click();
await expect(page.locator('gridster')).toContainText('Kesseltemperatur [°C] (INT 1 h)');
await expect(page.getByRole('heading', { name: '90,7 [°C]' })).toBeVisible();

await expect(page.locator('gridster')).toContainText('Berlin');
await expect(page.locator('gridster')).toContainText('Hamburg');
await expect(page.locator('gridster')).toContainText('Dortmund');
await expect(page.locator('gridster')).toContainText('Erlangen');

await expect(page.locator('#navbar-container')).toMatchAriaSnapshot(`- text:  Sichten Dashboard`);

});
25 changes: 25 additions & 0 deletions tests/api.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { test, expect } from "@playwright/test";

test("GET /products", async ({ request }) => {
const apiURL = "https://api.practicesoftwaretesting.com";
const response = await request.get(apiURL + "/products");

expect(response.status()).toBe(200);
const body = await response.json();
console.log(body);
expect(body.data.length).toBe(9);
expect(body.total).toBe(50);
});

test("POST/users/login", async ({ request }) => {
const apiURL = "https://api.practicesoftwaretesting.com";
const response = await request.post(apiURL + "/users/login", {
data: {
email: "customer@practicesoftwaretesting.com",
password: "welcome01",
},
});
expect(response.status()).toBe(200);
const body = await response.json();
expect(body.token).toBeTruthy();
});
3 changes: 1 addition & 2 deletions tests/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ setup("Create customer 01 auth", async ({ page, context }) => {
const customer01AuthFile = ".auth/customer01.json";

await page.goto("https://practicesoftwaretesting.com/auth/login");

await page.getByTestId("email").fill(email);
await page.getByTestId("password").fill(password);
await page.getByTestId("login-submit").click();

await expect(page.getByTestId("nav-menu")).toContainText("Jane Doe");

await context.storageState({ path: customer01AuthFile });
});
18 changes: 18 additions & 0 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});

test('get started link', {tag: "@first"}, async ({ page }) => {
await page.goto('https://playwright.dev/');

// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();

// Expects page to have a heading with the name of Installation.
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
});
Loading