-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add Playwright tests #7
base: main
Are you sure you want to change the base?
Conversation
71d83d0
to
54f2bde
Compare
test('shows a promotional banner', async ({ page }) => { | ||
const banner = await page.locator('#promotional-banner') | ||
expect(await banner).toBeVisible() | ||
expect(await banner.innerText()).toContain('📣 Get to know the Cypress, from Zero to the Cloud course!') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be replaced by await expect(banner).toHaveText('📣 Get to know the Cypress, from Zero to the Cloud course!')
expect(await banner.innerText()).toContain('📣 Get to know the Cypress, from Zero to the Cloud course!') | ||
|
||
const link = await banner.locator('a') | ||
expect(await link.getAttribute('target')).toEqual('_blank') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be replaced by await expect(link).toHaveAttribute('target', '_blank')
eslint-plugin-playwright auto-fix this one
const banner = await page.locator('#promotional-banner') | ||
expect(await banner).toBeVisible() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, you'll need to await the expect() but not the Locator.
You can think of Locator as a pointer to an element that will be used when needed. When you create the Locator, the element may or may not be here. We don't care (yet)
No description provided.