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. </p>
<p>I managed to get it working but not really sure what tests it can do. </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. </p>
<p><code>brew update / brew upgrade</code></p>
<p>Then you can install playwrite with </p>
<p><code>npm init playwright </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 }) => {</code><br /><code> await page.goto('https://playwright.dev/');</code><br /><code> const title = page.locator('.navbarinner .navbartitle');</code><br /><code> await expect(title).toHaveText('Playwright');</code><br /><code>});</code></p>
<p>then run it with this</p>
<p><code>npx playwright test </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> npx playwright test</code><br /> Runs the end-to-end tests.</p>
<p><code> npx playwright test --project=chromium</code><br /> Runs the tests only on Desktop Chrome.</p>
<p><code> npx playwright test tests/example.spec.js</code><br /> Runs the tests of a specific file.</p>
<p><code> npx playwright test --debug</code><br /> Runs the tests in debug mode.</p>
<p>We suggest that you begin by typing:</p>
<p><code> npx playwright test</code></p>
<p>And check out the following files:<br /> - ./tests/example.spec.js - Example end-to-end test<br /> - ./playwright.config.js - Playwright Test configuration</p>
<p>Visit https://playwright.dev/docs/intro for more information. ✨</p>
<p>Happy! 🎭</p>
<p> </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> </li>
<li><a href="https://github.com/microsoft/playwright" target="_blank" rel="noopener">https://github.com/microsoft/playwright</a> </li>
</ol>