Bug 1383300 - Test total and domain in the payment request dialog r=marcosc
☠☠ backed out by ab983c341420 ☠ ☠
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 18 Oct 2017 15:08:04 -0700
changeset 443414 908e2e2a759b9579c74d92950598ea09439c3233
parent 443413 71b84c8137051478ac2e60dea8c42c4863c7188f
child 443415 bc8f24ca5bb3abdab417af45017b91a9a44a0745
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarcosc
bugs1383300
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383300 - Test total and domain in the payment request dialog r=marcosc MozReview-Commit-ID: GgADdcR98xd
toolkit/components/payments/test/browser/browser.ini
toolkit/components/payments/test/browser/browser_host_name.js
toolkit/components/payments/test/browser/browser_total.js
--- a/toolkit/components/payments/test/browser/browser.ini
+++ b/toolkit/components/payments/test/browser/browser.ini
@@ -1,10 +1,12 @@
 [DEFAULT]
 head = head.js
 prefs =
   dom.payments.request.enabled=true
 skip-if = !e10s # Bug 1365964 - Payment Request isn't implemented for non-e10s
 support-files =
   blank_page.html
 
+[browser_host_name.js]
 [browser_request_summary.js]
 [browser_show_dialog.js]
+[browser_total.js]
new file mode 100644
--- /dev/null
+++ b/toolkit/components/payments/test/browser/browser_host_name.js
@@ -0,0 +1,35 @@
+"use strict";
+
+async function withBasicRequestDialogForOrigin(origin, dialogTaskFn) {
+  const args = {
+    methodData: [PTU.MethodData.basicCard],
+    details: PTU.Details.total60USD,
+  };
+  await spawnInDialogForMerchantTask(PTU.ContentTasks.createRequest, dialogTaskFn, args, {
+    origin,
+  });
+}
+
+/* eslint-disable mozilla/no-cpows-in-tests */
+add_task(async function test_host() {
+  await withBasicRequestDialogForOrigin("https://example.com", () => {
+    is(content.document.querySelector("#host-name").textContent, "example.com",
+       "Check basic host name");
+  });
+});
+
+add_task(async function test_host_subdomain() {
+  await withBasicRequestDialogForOrigin("https://test1.example.com", () => {
+    is(content.document.querySelector("#host-name").textContent, "test1.example.com",
+       "Check host name with subdomain");
+  });
+});
+
+add_task(async function test_host_IDN() {
+  await withBasicRequestDialogForOrigin("https://xn--hxajbheg2az3al.xn--jxalpdlp", () => {
+    is(content.document.querySelector("#host-name").textContent,
+       "\u03C0\u03B1\u03C1\u03AC\u03B4\u03B5\u03B9\u03B3\u03BC\u03B1." +
+       "\u03B4\u03BF\u03BA\u03B9\u03BC\u03AE",
+       "Check IDN domain");
+  });
+});
new file mode 100644
--- /dev/null
+++ b/toolkit/components/payments/test/browser/browser_total.js
@@ -0,0 +1,18 @@
+"use strict";
+
+/* eslint-disable mozilla/no-cpows-in-tests */
+add_task(async function test_total() {
+  const testTask = ({methodData, details}) => {
+    is(content.document.querySelector("#total > .value").textContent,
+       details.total.amount.value,
+       "Check total value");
+    is(content.document.querySelector("#total > .currency").textContent,
+       details.total.amount.currency,
+       "Check currency");
+  };
+  const args = {
+    methodData: [PTU.MethodData.basicCard],
+    details: PTU.Details.total60USD,
+  };
+  await spawnInDialogForMerchantTask(PTU.ContentTasks.createRequest, testTask, args);
+});