docs: update page-object-model example (#16661)

This commit is contained in:
depa panjie purnama 2022-08-20 07:03:50 +07:00 committed by GitHub
parent abe7cf23a7
commit 1730f33b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,7 @@ exports.PlaywrightDevPage = class PlaywrightDevPage {
constructor(page) { constructor(page) {
this.page = page; this.page = page;
this.getStartedLink = page.locator('a', { hasText: 'Get started' }); this.getStartedLink = page.locator('a', { hasText: 'Get started' });
this.gettingStartedHeader = page.locator('h1', { hasText: 'Getting started' }); this.gettingStartedHeader = page.locator('h1', { hasText: 'Installation' });
this.pomLink = page.locator('li', { hasText: 'Playwright Test' }).locator('a', { hasText: 'Page Object Model' }); this.pomLink = page.locator('li', { hasText: 'Playwright Test' }).locator('a', { hasText: 'Page Object Model' });
this.tocList = page.locator('article div.markdown ul > li > a'); this.tocList = page.locator('article div.markdown ul > li > a');
} }
@ -54,7 +54,7 @@ export class PlaywrightDevPage {
constructor(page: Page) { constructor(page: Page) {
this.page = page; this.page = page;
this.getStartedLink = page.locator('a', { hasText: 'Get started' }); this.getStartedLink = page.locator('a', { hasText: 'Get started' });
this.gettingStartedHeader = page.locator('h1', { hasText: 'Getting started' }); this.gettingStartedHeader = page.locator('h1', { hasText: 'Installation' });
this.pomLink = page.locator('li', { hasText: 'Playwright Test' }).locator('a', { hasText: 'Page Object Model' }); this.pomLink = page.locator('li', { hasText: 'Playwright Test' }).locator('a', { hasText: 'Page Object Model' });
this.tocList = page.locator('article div.markdown ul > li > a'); this.tocList = page.locator('article div.markdown ul > li > a');
} }
@ -87,16 +87,14 @@ test('getting started should contain table of contents', async ({ page }) => {
await playwrightDev.goto(); await playwrightDev.goto();
await playwrightDev.getStarted(); await playwrightDev.getStarted();
await expect(playwrightDev.tocList).toHaveText([ await expect(playwrightDev.tocList).toHaveText([
'Installation', `How to install Playwright`,
'First test', `What's Installed`,
'Configuration file', `How to run the example test`,
'Writing assertions', `How to open the HTML test report`,
'Using test fixtures', `Write tests using web first assertions, page fixtures and locators`,
'Using test hooks', `Run single tests, multiple tests, headed mode`,
'VS Code extension', `Generate tests with Codegen`,
'Command line', `See a trace of your tests`
'Configure NPM scripts',
'Release notes'
]); ]);
}); });
@ -118,16 +116,14 @@ test('getting started should contain table of contents', async ({ page }) => {
await playwrightDev.goto(); await playwrightDev.goto();
await playwrightDev.getStarted(); await playwrightDev.getStarted();
await expect(playwrightDev.tocList).toHaveText([ await expect(playwrightDev.tocList).toHaveText([
'Installation', `How to install Playwright`,
'First test', `What's Installed`,
'Configuration file', `How to run the example test`,
'Writing assertions', `How to open the HTML test report`,
'Using test fixtures', `Write tests using web first assertions, page fixtures and locators`,
'Using test hooks', `Run single tests, multiple tests, headed mode`,
'VS Code extension', `Generate tests with Codegen`,
'Command line', `See a trace of your tests`
'Configure NPM scripts',
'Release notes'
]); ]);
}); });