Posted in node
678
4:00 am, January 28, 2022
 

Testing Playwrite on for Node

<p>I came across this library on <a href="https://news.ycombinator.com/item?id=30083042" target="blank" rel="noopener">y news</a>, and thought id give it a bit of a test.&nbsp;</p>
<p>I managed to get it working but not really sure what tests it can do.&nbsp;</p>
<p>I set it to take a screen shot of a webpage, I guess its automated testing of websites for what exactly? do you tell it to click on the links and that kind of thing?</p>
<h3>Installation</h3>
<p>Just update everything if you are using brew on mac.&nbsp;</p>
<p><code>brew update / brew upgrade</code></p>
<p>Then you can install playwrite with&nbsp;</p>
<p><code>npm init playwright&nbsp;</code></p>
<p>add the test script</p>
<p><code>import { test, expect } from '@playwright/test';</code></p>
<p><code>test('basic test', async ({ page }) =&gt; {</code><br /><code>&nbsp; await page.goto('https://playwright.dev/');</code><br /><code>&nbsp; const title = page.locator('.navbarinner .navbartitle');</code><br /><code>&nbsp; await expect(title).toHaveText('Playwright');</code><br /><code>});</code></p>
<p>then run it with this</p>
<p><code>npx playwright test&nbsp;</code></p>
<h3>After Installation</h3>
<p>✔ Success! Created a Playwright Test project at /Users/../code/playwrite<br />Inside that directory, you can run several commands:</p>
<p><code>&nbsp; npx playwright test</code><br />&nbsp; &nbsp; Runs the end-to-end tests.</p>
<p><code>&nbsp; npx playwright test --project=chromium</code><br />&nbsp; &nbsp; Runs the tests only on Desktop Chrome.</p>
<p><code>&nbsp; npx playwright test tests/example.spec.js</code><br />&nbsp; &nbsp; Runs the tests of a specific file.</p>
<p><code>&nbsp; npx playwright test --debug</code><br />&nbsp; &nbsp; Runs the tests in debug mode.</p>
<p>We suggest that you begin by typing:</p>
<p><code>&nbsp; npx playwright test</code></p>
<p>And check out the following files:<br />&nbsp; - ./tests/example.spec.js - Example end-to-end test<br />&nbsp; - ./playwright.config.js - Playwright Test configuration</p>
<p>Visit https://playwright.dev/docs/intro for more information. ✨</p>
<p>Happy! 🎭</p>
<p>&nbsp;</p>
<h3>Running the main tests result:</h3>
<p><img src="https://i.imgur.com/cODOrHG.png" /></p>
<h3>Docs</h3>
<ol>
<li><a href="https://playwright.dev/docs/intro#installation" target="
blank" rel="noopener">https://playwright.dev/docs/intro#installation</a>&nbsp;</li>
<li><a href="https://github.com/microsoft/playwright" target="_blank" rel="noopener">https://github.com/microsoft/playwright</a>&nbsp;</li>
</ol>

View Statistics
This Week
321
This Month
1709
This Year
940

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in node
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
⠄⠄⣿⣿⣿⣿⠘⡿⢛⣿⣿⣿⣿⣿⣧⢻⣿⣿⠃⠸⣿⣿⣿⠄⠄⠄⠄⠄
⠄⠄⣿⣿⣿⣿⢀⠼⣛⣛⣭⢭⣟⣛⣛⣛⠿⠿⢆⡠⢿⣿⣿⠄⠄⠄⠄⠄
⠄⠄⠸⣿⣿⢣⢶⣟⣿⣖⣿⣷⣻⣮⡿⣽⣿⣻⣖⣶⣤⣭⡉⠄⠄⠄⠄⠄
⠄⠄⠄⢹⠣⣛⣣⣭⣭⣭⣁⡛⠻⢽⣿⣿⣿⣿⢻⣿⣿⣿⣽⡧⡄⠄⠄⠄
⠄⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣶⣌⡛⢿⣽⢘⣿⣷⣿⡻⠏⣛⣀⠄⠄
⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠙⡅⣿⠚⣡⣴⣿⣿⣿⡆⠄
⠄⠄⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠄⣱⣾⣿⣿⣿⣿⣿⣿⠄
⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⠄
⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠣⣿⣿⣿⣿⣿⣿⣿⣿⣿⠄
⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠑⣿⣮⣝⣛⠿⠿⣿⣿⣿⣿⠄
⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⠄⠄⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄

Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.