Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 72: Line 72:


=== Tests Structure ===
=== Tests Structure ===
==== First Test ====
# In VS Code
# Open PW-PRACTICE-APP
# run <code>npm init playwright@latest --force</code>
:* force is needed to avoid errors
:* package.json updated with new dev dependencies
:* playwright.config.ts is created as well as other files
# delete test-examples folder - it's not needed
# delete test/example.spec.ts file - it's not needed
# create file firsTest.spec.ts
<nowiki>import {test} from '@playwright/test'
test('the first test', async ({page}) => {
    await page.goto('http://localhost:4200/')
    await page.getByText('Forms').click()
    await page.getByText('Form Layouts').click()
})</nowiki>
* Notice the <code>page</code> fixture, it has a lot of useful methods, eg. <code>page.goto('url')</code> and <code>page.getByText('label')</code>
==== next ====

Navigation menu