Files
2026-08-07 09:48:59 +02:00

69 lines
2.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test';
import { HomePage } from '../pages/HomePage';
import { expectedMenuTexts } from '../assets/text/textHelpers';
test.describe('DOXA Notes HomePage - POM', () => {
let homePage: HomePage;
// Před každým testem vytvoříme novou instanci stránky
test.beforeEach(async ({ page }) => {
homePage = new HomePage(page);
await homePage.navigate();
});
test.describe('navigate', () => {
test('check all menu items visibility', async () => {
await homePage.checkMenuTexts(expectedMenuTexts);
});
test('navigation to Ochrana soukromí', async () => {
await homePage.navigate('privacy.html'); // Naviguje správně podle prostředí
await expect(homePage.page).toHaveURL(/\/privacy\.html$/); // Odolné testování URL
});
test('navigation to O projektu', async () => {
await homePage.navigate('about.html');
await expect(homePage.page).toHaveURL(/\/about\.html$/);
});
test('externí odkaz do DOXA app', async ({ page }) => {
await homePage.clickExternalLink('.btnHomePage');
const newPage = await page.waitForEvent('popup');
const newpage = await newPage.waitForLoadState();
expect(await newPage.url()).toBe('https://app.doxa-notes.org/');
})
});
test.describe('SEO - Search Engine Optimization', () => {
test('check title, meta description and canonical link on home page', async () => {
const title = await homePage.getPageTitle();
expect(title).toBe('DOXA Notes — Local-First poznámky a minimalistický Markdown editor');
const desc = await homePage.getMetaDescription();
expect(desc).toBe('DOXA Notes je minimalistická, local‑first poznámková aplikace s podporou Markdownu a otevřeným formátem JSON. Absolutní soukromí pro vaše myšlenky.');
const canonical = await homePage.getCanonical();
expect(canonical).toBe('https://doxa-notes.org/index.html');
});
test('check title and canonical link on O projektu page', async ({ page }) => {
await homePage.navigate('O projektu');
await expect(page).toHaveTitle('O projektu — DOXA Notes');
const canonical = await page.locator('link[rel="canonical"]').getAttribute('href');
expect(canonical).toBe('https://doxa-notes.org/about.html');
});
test('check title and canonical link on Ochrana soukromí page', async ({ page }) => {
await homePage.navigate('privacy.html');
await expect(homePage.page).toHaveTitle('Ochrana soukromí — DOXA Notes');
const canonical = await page.locator('link[rel="canonical"]').getAttribute('href');
expect(canonical).toBe('https://doxa-notes.org/privacy.html');
});
});
});