1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests that the popup is automatically offered.
*/
add_task(async function test_translations_panel_auto_offer() {
const { cleanup } = await loadTestPage({
page: SPANISH_PAGE_URL,
languagePairs: LANGUAGE_PAIRS,
autoOffer: true,
});
await FullPageTranslationsTestUtils.clickCancelButton();
await TestTranslationsTelemetry.assertEvent(Glean.translationsPanel.open, {
expectedEventCount: 1,
expectNewFlowId: true,
allValuePredicates: [
value => value.extra.auto_show === "true",
value => value.extra.view_name === "defaultView",
value => value.extra.opened_from === "translationsButton",
value => value.extra.document_language === "es",
],
});
await TestTranslationsTelemetry.assertEvent(
Glean.translationsPanel.cancelButton,
{
expectedEventCount: 1,
expectNewFlowId: false,
}
);
await TestTranslationsTelemetry.assertEvent(Glean.translationsPanel.close, {
expectedEventCount: 1,
expectNewFlowId: false,
});
await navigate("Navigate to another page on the same domain.", {
url: SPANISH_PAGE_URL_2,
});
await FullPageTranslationsTestUtils.assertTranslationsButton(
{ button: true },
"The button is still shown."
);
await navigate("Navigate to a page on a different domain.", {
url: SPANISH_PAGE_URL_DOT_ORG,
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
});
await FullPageTranslationsTestUtils.clickCancelButton();
await TestTranslationsTelemetry.assertEvent(Glean.translationsPanel.open, {
expectedEventCount: 2,
expectNewFlowId: true,
allValuePredicates: [
value => value.extra.auto_show === "true",
value => value.extra.view_name === "defaultView",
value => value.extra.opened_from === "translationsButton",
value => value.extra.document_language === "es",
],
});
await TestTranslationsTelemetry.assertEvent(
Glean.translationsPanel.cancelButton,
{
expectedEventCount: 2,
expectNewFlowId: false,
}
);
await TestTranslationsTelemetry.assertEvent(Glean.translationsPanel.close, {
expectedEventCount: 2,
expectNewFlowId: false,
});
await cleanup();
});
|