Conversation
71d83d0 to
54f2bde
Compare
jfgreffier
reviewed
Dec 23, 2024
| 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.
Can be replaced by await expect(banner).toHaveText('📣 Get to know the Cypress, from Zero to the Cloud course!')
Owner
Author
There was a problem hiding this comment.
Thanks for the review, @jfgreffier!
I'll soon make the changes you suggested and test them out.
| 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.
Can be replaced by await expect(link).toHaveAttribute('target', '_blank')
eslint-plugin-playwright auto-fix this one
Comment on lines
+21
to
+22
| const banner = await page.locator('#promotional-banner') | ||
| expect(await banner).toBeVisible() |
There was a problem hiding this comment.
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.