✨ [Amp story shopping] Open or close defaults for product details section#37790
✨ [Amp story shopping] Open or close defaults for product details section#37790processprocess merged 7 commits intoampproject:mainfrom
Conversation
|
Hey @gmajoulet! These files were changed: |
extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
Outdated
Show resolved
Hide resolved
extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
Outdated
Show resolved
Hide resolved
| await verifySelectorsVisible(page, name, [ | ||
| '.i-amphtml-story-draggable-drawer-open', | ||
| ]); | ||
| await page.waitForSelector('.i-amphtml-amp-story-shopping-pdp'); |
There was a problem hiding this comment.
Does .i-amphtml-amp-story-shopping-pdp always exist somewhere within the shopping attachment? If so, then should we use verifySelectorsVisible() as a more useful test?
There was a problem hiding this comment.
It doesn't build until the attachment is opened. I think waitForSelector is okay because of that.
There was a problem hiding this comment.
Got it, although you can update waitForSelector to verify that the PDP is displayed by default instead of solely verifying that the PDP exists somewhere in the DOM:
page.waitForSelector('.i-amphtml-amp-story-shopping-pdp', {visible: true})
There was a problem hiding this comment.
🔥 https://puppeteer.github.io/puppeteer/docs/puppeteer.page.waitforselector/
TIL about options on waitforselector :) Thank you!
I updated the other tests with this option.
| await verifySelectorsVisible(page, name, [ | ||
| '.i-amphtml-story-draggable-drawer-open', | ||
| ]); | ||
| await page.waitForSelector('.i-amphtml-amp-story-shopping-pdp'); |
There was a problem hiding this comment.
Got it, although you can update waitForSelector to verify that the PDP is displayed by default instead of solely verifying that the PDP exists somewhere in the DOM:
page.waitForSelector('.i-amphtml-amp-story-shopping-pdp', {visible: true})
Demo Page 1 has multiple tags. Page 3 has one tag.
Images:
Details section closed by default when there is more than one product on page.

If opened, will re-open in the closed state.
Details section open by default when the only product on the page (page 3 of demo)

Fixes #37763