From dce5fc0b2326cebde54c2c97629f2b6d47fe5746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Ka=C5=88ka?= <124378142+LukasKanka@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:07:49 +0200 Subject: [PATCH] Craft Docs, First Test - Tittle test --- Craft_Docs_Playwright/page-objects/HomePage.ts | 15 +++++++++++++++ Craft_Docs_Playwright/playwright.config.ts | 5 +++-- Craft_Docs_Playwright/tests/example.spec.ts | 18 ------------------ Craft_Docs_Playwright/tests/tittle.spec.ts | 8 ++++++++ 4 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 Craft_Docs_Playwright/page-objects/HomePage.ts delete mode 100644 Craft_Docs_Playwright/tests/example.spec.ts create mode 100644 Craft_Docs_Playwright/tests/tittle.spec.ts diff --git a/Craft_Docs_Playwright/page-objects/HomePage.ts b/Craft_Docs_Playwright/page-objects/HomePage.ts new file mode 100644 index 0000000..35b3f9a --- /dev/null +++ b/Craft_Docs_Playwright/page-objects/HomePage.ts @@ -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; + } +} diff --git a/Craft_Docs_Playwright/playwright.config.ts b/Craft_Docs_Playwright/playwright.config.ts index 301801e..86d41b6 100644 --- a/Craft_Docs_Playwright/playwright.config.ts +++ b/Craft_Docs_Playwright/playwright.config.ts @@ -23,6 +23,7 @@ export default defineConfig({ reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { + headless: false, /* Base URL to use in actions like `await page.goto('/')`. */ // baseURL: 'http://127.0.0.1:3000', @@ -36,7 +37,7 @@ export default defineConfig({ name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, - +/* { name: 'firefox', use: { ...devices['Desktop Firefox'] }, @@ -46,7 +47,7 @@ export default defineConfig({ name: 'webkit', use: { ...devices['Desktop Safari'] }, }, - +*/ /* Test against mobile viewports. */ // { // name: 'Mobile Chrome', diff --git a/Craft_Docs_Playwright/tests/example.spec.ts b/Craft_Docs_Playwright/tests/example.spec.ts deleted file mode 100644 index 54a906a..0000000 --- a/Craft_Docs_Playwright/tests/example.spec.ts +++ /dev/null @@ -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(); -}); diff --git a/Craft_Docs_Playwright/tests/tittle.spec.ts b/Craft_Docs_Playwright/tests/tittle.spec.ts new file mode 100644 index 0000000..942644e --- /dev/null +++ b/Craft_Docs_Playwright/tests/tittle.spec.ts @@ -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.') +}) \ No newline at end of file