Skip to content

Verify if 4 products are under Hot sellers category#97

Open
iclaudiu98 wants to merge 1 commit intomainfrom
task-two
Open

Verify if 4 products are under Hot sellers category#97
iclaudiu98 wants to merge 1 commit intomainfrom
task-two

Conversation

@iclaudiu98
Copy link
Collaborator

Test created for #78
.product-image-photo locator used to identify hotseller products, it is unique for every hotseller product.

page,
}) => {
await page.goto("https://magento.softwaretestingboard.com/gear.html");
const products = await page.locator(".product-image-photo").count();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to utilize Playwright's built-in methods for assertions

const products = await page.locator(".product-image-photo");
await expect(products).toHaveCount(4);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Now how would you write this in just one line?

Comment on lines +7 to +8
const products = await page.locator(".product-image-photo").count();
await expect(products).toBe(4);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const products = await page.locator(".product-image-photo").count();
await expect(products).toBe(4);
await expect(page.locator(".product-image-photo")).toHaveCount(4);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Gear Section > Hot Sellers

3 participants