testing-docs.cz/articles/playwright-prvni-test.html

118 lines
4.8 KiB
HTML
Raw Normal View History

2023-12-14 17:26:01 +00:00
<!DOCTYPE html>
<html lang="cz">
<head>
2024-01-08 12:27:58 +00:00
<meta content="Dokumentace pro všechny testery" name="description" />
<meta content="Playwright, Automatizované testovaní" name="keywords" />
<meta content="Lukáš Kaňka" name="author" />
2023-12-14 17:26:01 +00:00
<meta charset="UTF-8">
2024-01-07 21:00:27 +00:00
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="/style.css" rel="stylesheet">
2024-01-08 12:27:58 +00:00
<link href="images/a picture of a text editor on a pc in the style of comics.jpg" rel="shortcut icon" />
2023-12-14 17:26:01 +00:00
<title>Testing Docs - Playwright první test</title>
</head>
<body>
2024-01-08 12:27:58 +00:00
<h1>Testing Docs CZ</h1>
<h2>Dokumentace pro všechny testery</h2>
<hr>
<div class="menu">
<center>
<ul>
<li class="menu-item"><a class="button" href="/index.html">Domů</a></li>
<li class="menu-item"><a class="button" href="/podpora.html">Podpora</a></li>
<li class="menu-item"><a class="button" href="/mapa-webu.html">Mapa webu</a></li>
<li class="menu-item"><a class="button" href="/privaci-polici.html">Zásady o ochraně osobních dat</a>
</li>
</ul>
</center>
2024-01-07 21:00:27 +00:00
</div>
2024-01-08 12:27:58 +00:00
<hr>
2023-12-27 20:07:23 +00:00
2024-01-08 12:27:58 +00:00
<div class="flexbox">
<div class="navigation">
<table>
<caption>
Rubriky:
</caption>
<tr>
<th>
<li>
<a class="button" href="/automatizovane-testovani.html">Automatizované testování</a>
</li>
<li><a class="button" href="/nastroje.html">Nástroje</a></li>
<li>
<a class="button" href="/penetracni-testovani.html">Penetrační testování</a>
</li>
<li>
<a class="button" href="/testing-obecne.html">Testing obečně</a>
</li>
<li>
<a class="button" href="/testovani-mobilnich-aplikaci.html">Testování mobilních aplikací</a>
</li>
<li>
<a class="button" href="/testovani-pristupnosti.html">Testování přístupnosti</a>
</li>
<li>
<a class="button" href="/zatezove-testovani.html">Zátěžové testování</a>
</li>
</th>
</tr>
</table>
2023-12-14 17:26:01 +00:00
</div>
2023-12-14 21:30:37 +00:00
2024-01-08 12:27:58 +00:00
<div class="content">
<p class="big-text">Playwright první test</p>
<p>Základní a jednoduchý test na webu Google</p>
<div class="code-box">
<p>import { test, expect } from '@playwright/test';</p>
<p>import { chromium } from '@playwright/test';</p>
<p>( async () => {</p>
<p>const browser = await chromium.launch();</p>
<p>const context = await browser.newContext();</p>
<p>const page = await context.newPage();</p>
<p>await page.goto('
<https: //google.com>');
</p>
<p>// Odsouhlasí cookies</p>
<p>await page.click('#L2AGLb');</p>
<p>// Klikněte na pole pro vyhledávání.</p>
<p>const searchInput = await page.$('[name="q"]');</p>
<p>await searchInput?.type('test');</p>
<p>// Potvrdíme vyhledávání stisknutím klávesy Enter</p>
<p>await searchInput?.press('Enter');</p>
<p>await page.waitForNavigation();</p>
<p>console.log('Search results page title:', await
page.title());</p>
<p>// Vypíše název stránky do konzole</p>
<p>const title = await page.title();</p>
<p>console.log(title);</p>
<p>// Zavře prohlížeč kde probíhal test</p>
<p>await browser.close();</p>
<p>});</p>
</div>
</div>
2023-12-14 21:30:37 +00:00
2024-01-08 12:27:58 +00:00
<div class="articles">
<table>
<caption>Nejdůležitější články:</caption>
<tr>
<th>
<li><a class="button" href="co-je-automatizovane-testovani.html">Co je
automatizované
testování</a>
</li>
<li><a class="button" href="otazky-a-odpovedi-playwright.html">Otázky a odpovědí k
Playwright</a></li>
</th>
</tr>
</table>
</div>
</div>
2024-01-07 21:00:27 +00:00
2024-01-08 12:27:58 +00:00
<footer>Copyright &copy; Lukáš Kaňka 2023</footer>
2023-12-14 17:26:01 +00:00
</body>
</html>