mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1856064 - test for reactivate product glean event r=shopping-reviewers,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D189683
This commit is contained in:
parent
4518988951
commit
7f01b062f5
@ -72,6 +72,30 @@ add_task(async function test_shopping_UI_chevron_clicks() {
|
||||
Assert.equal(events[0].name, "surface_settings_expand_clicked");
|
||||
});
|
||||
|
||||
add_task(async function test_reactivated_product_button_click() {
|
||||
await Services.fog.testFlushAllChildren();
|
||||
Services.fog.testResetFOG();
|
||||
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{
|
||||
url: "about:shoppingsidebar",
|
||||
gBrowser,
|
||||
},
|
||||
async browser => {
|
||||
await clickProductAvailableLink(browser, MOCK_STALE_PRODUCT_RESPONSE);
|
||||
}
|
||||
);
|
||||
|
||||
await Services.fog.testFlushAllChildren();
|
||||
|
||||
var reanalysisEvents =
|
||||
Glean.shopping.surfaceReactivatedButtonClicked.testGetValue();
|
||||
assertEventMatches(reanalysisEvents[0], {
|
||||
category: "shopping",
|
||||
name: "surface_reactivated_button_clicked",
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_shopping_sidebar_displayed() {
|
||||
Services.fog.testResetFOG();
|
||||
|
||||
@ -275,6 +299,23 @@ function clickCloseButton(browser, data) {
|
||||
});
|
||||
}
|
||||
|
||||
function clickProductAvailableLink(browser, data) {
|
||||
return SpecialPowers.spawn(browser, [data], async mockData => {
|
||||
let shoppingContainer =
|
||||
content.document.querySelector("shopping-container").wrappedJSObject;
|
||||
shoppingContainer.data = Cu.cloneInto(mockData, content);
|
||||
await shoppingContainer.updateComplete;
|
||||
|
||||
let shoppingMessageBar = shoppingContainer.shoppingMessageBarEl;
|
||||
await shoppingMessageBar.updateComplete;
|
||||
|
||||
// calling onClickProductAvailable will fail quietly in cases where this is
|
||||
// not possible to call, so assure it exists first.
|
||||
Assert.notEqual(shoppingMessageBar, null);
|
||||
await shoppingMessageBar.onClickProductAvailable();
|
||||
});
|
||||
}
|
||||
|
||||
function clickShowMoreButton(browser, data) {
|
||||
return SpecialPowers.spawn(browser, [data], async mockData => {
|
||||
let shoppingContainer =
|
||||
|
Loading…
Reference in New Issue
Block a user