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

Testing Playwrite on for Node

I came across this library on y news, and thought id give it a bit of a test. 

I managed to get it working but not really sure what tests it can do. 

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?

Installation

Just update everything if you are using brew on mac. 

brew update / brew upgrade

Then you can install playwrite with 

npm init playwright 

add the test script

import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const title = page.locator('.navbar__inner .navbar__title');
  await expect(title).toHaveText('Playwright');
});

then run it with this

npx playwright test 

After Installation

✔ Success! Created a Playwright Test project at /Users/../code/playwrite
Inside that directory, you can run several commands:

  npx playwright test
    Runs the end-to-end tests.

  npx playwright test --project=chromium
    Runs the tests only on Desktop Chrome.

  npx playwright test tests/example.spec.js
    Runs the tests of a specific file.

  npx playwright test --debug
    Runs the tests in debug mode.

We suggest that you begin by typing:

  npx playwright test

And check out the following files:
  - ./tests/example.spec.js - Example end-to-end test
  - ./playwright.config.js - Playwright Test configuration

Visit https://playwright.dev/docs/intro for more information. ✨

Happy! 🎭

 

Running the main tests result:

Docs

  1. https://playwright.dev/docs/intro#installation 
  2. https://github.com/microsoft/playwright 

View Statistics
This Week
224
This Month
1036
This Year
3171

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...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

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
1. Show your work to the world instead of keeping in your head💆. 2. Do the work consistently👌 3. Respect your work🥰 4. Don't postpone your work 5. Make mistakes 🔥🔥🔥
Unknown
Random CSS Property

scroll-padding-right

The scroll-padding-right property defines offsets for the right of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or to put more breathing room between a targeted element and the edges of the scrollport.
scroll-padding-right css reference