Commit 67a71bb8 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Print Preview: Add test to verify button order

Add automated test to verify that there are 2 buttons in the print
header and they are in the correct order for all platforms. Split off
parent CL, which contains a fix for the bug linked.

Bug: 880562
Change-Id: I3472561dd1af7e75a86bf4821fb4ae42e82a0d5f
Reviewed-on: https://chromium-review.googlesource.com/1205717Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588746}
parent 3bbf02bb
......@@ -10,6 +10,7 @@ cr.define('header_test', function() {
HeaderWithCopies: 'header with copies',
HeaderWithNup: 'header with nup',
HeaderChangesForState: 'header changes for state',
ButtonOrder: 'button order',
};
const suiteName = 'HeaderTest';
......@@ -139,6 +140,27 @@ cr.define('header_test', function() {
assertEquals(testError, summary.textContent);
assertTrue(printButton.disabled);
});
// Tests that the buttons are in the correct order for different platforms.
// See https://crbug.com/880562.
test(assert(TestNames.ButtonOrder), function() {
// Verify that there are only 2 buttons.
assertEquals(2, header.shadowRoot.querySelectorAll('button').length);
const firstButton = header.$$('button:first-child');
const lastButton = header.$$('button:last-child');
const printButton = header.$$('button.print');
const cancelButton = header.$$('button.cancel');
if (cr.isWindows || cr.isChromeOS) {
// On Windows and Chrome OS, the print button is on the left.
assertEquals(firstButton, printButton);
assertEquals(lastButton, cancelButton);
} else {
assertEquals(firstButton, cancelButton);
assertEquals(lastButton, printButton);
}
});
});
return {
......
......@@ -914,6 +914,10 @@ TEST_F('PrintPreviewHeaderTest', 'HeaderChangesForState', function() {
this.runMochaTest(header_test.TestNames.HeaderChangesForState);
});
TEST_F('PrintPreviewHeaderTest', 'ButtonOrder', function() {
this.runMochaTest(header_test.TestNames.ButtonOrder);
});
PrintPreviewDestinationItemTest = class extends NewPrintPreviewTest {
/** @override */
get browsePreload() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment