Craft Docs, First Test - Tittle test
This commit is contained in:
parent
ef91f1b967
commit
dce5fc0b23
15
Craft_Docs_Playwright/page-objects/HomePage.ts
Normal file
15
Craft_Docs_Playwright/page-objects/HomePage.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { Locator, Page, expect
|
||||||
|
} from "@playwright/test";
|
||||||
|
|
||||||
|
export class HomePage{
|
||||||
|
page: Page;
|
||||||
|
|
||||||
|
constructor(page: Page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
async gotoHome() {
|
||||||
|
await this.page.goto('https://www.craft.me/s/Gx2Rhh07iMKxyh');
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,7 @@ export default defineConfig({
|
|||||||
reporter: 'html',
|
reporter: 'html',
|
||||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
use: {
|
use: {
|
||||||
|
headless: false,
|
||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
// baseURL: 'http://127.0.0.1:3000',
|
// baseURL: 'http://127.0.0.1:3000',
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ export default defineConfig({
|
|||||||
name: 'chromium',
|
name: 'chromium',
|
||||||
use: { ...devices['Desktop Chrome'] },
|
use: { ...devices['Desktop Chrome'] },
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'firefox',
|
||||||
use: { ...devices['Desktop Firefox'] },
|
use: { ...devices['Desktop Firefox'] },
|
||||||
@ -46,7 +47,7 @@ export default defineConfig({
|
|||||||
name: 'webkit',
|
name: 'webkit',
|
||||||
use: { ...devices['Desktop Safari'] },
|
use: { ...devices['Desktop Safari'] },
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
/* Test against mobile viewports. */
|
/* Test against mobile viewports. */
|
||||||
// {
|
// {
|
||||||
// name: 'Mobile Chrome',
|
// name: 'Mobile Chrome',
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
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', 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();
|
|
||||||
});
|
|
8
Craft_Docs_Playwright/tests/tittle.spec.ts
Normal file
8
Craft_Docs_Playwright/tests/tittle.spec.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
import { HomePage } from "../page-objects/HomePage";
|
||||||
|
|
||||||
|
test('Kontrola textu titulku', async ({page}) =>{
|
||||||
|
const homePage:HomePage = new HomePage(page);
|
||||||
|
await homePage.gotoHome();
|
||||||
|
await expect(page).toHaveTitle('🤠 Ahoj právě se nacházíš v mém veřejném Notesu Lukáše Kaňky, který slouží jako má Digitální zahrada. 🤙 Nejdeš tu všechny mé články návody, spousty informací a mé myšlenky.')
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user