Skip to content

Commit

Permalink
Enable Cart module tests
Browse files Browse the repository at this point in the history
The whole Cart module test is disabled because of two flaky tests. This
CL renables the test suite by skip those two flaky tests.

This CL also fixes a discount consent v2 bug.

(cherry picked from commit 0175bf3)

Bug: 1287294, 1298116
Change-Id: I4223427f95821d4ac6e4ad860627eb86dd542cf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3501978
Reviewed-by: Yue Zhang <yuezhanggg@chromium.org>
Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: Mei Liang <meiliang@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#977266}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3510907
Cr-Commit-Position: refs/branch-heads/4896@{#396}
Cr-Branched-From: 1f63ff4-refs/heads/main@{#972766}
  • Loading branch information
Mei Liang authored and Chromium LUCI CQ committed Mar 8, 2022
1 parent d3bc043 commit 80cacd3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Expand Up @@ -137,7 +137,7 @@ export class ChromeCartModuleElement extends I18nMixin

this.eventTracker_.add(
this, 'discount-consent-accepted',
() => this.onDiscountConsentAccepted_);
() => this.onDiscountConsentAccepted_());
this.eventTracker_.add(
this, 'discount-consent-rejected',
() => this.onDiscountConsentRejected_());
Expand Down
11 changes: 7 additions & 4 deletions chrome/test/data/webui/new_tab_page/modules/cart/module_test.ts
Expand Up @@ -804,7 +804,8 @@ suite('NewTabPageModulesChromeCartModuleTest', () => {

test('scroll with consent card', async () => testScrollWithConsent());

test('click on cart item', async () => {
// https://crbug.com/1287294: Flaky
test.skip('click on cart item', async () => {
const carts = [
{
merchant: 'Amazon',
Expand Down Expand Up @@ -988,7 +989,8 @@ suite('NewTabPageModulesChromeCartModuleTest', () => {
loadTimeData.overrideValues({ruleBasedDiscountEnabled: true});
});

test('click on cart item with rule-based discount', async () => {
// https://crbug.com/1287294: Flaky
test.skip('click on cart item with rule-based discount', async () => {
const carts = [
{
merchant: 'Amazon',
Expand Down Expand Up @@ -1177,8 +1179,9 @@ suite('NewTabPageModulesChromeCartModuleTest', () => {
await flushTasks();

// Assert.
assertEquals(false, isVisible(consentCard));
assertEquals(true, consentToast.open);
assertEquals(
false, isVisible(consentCard), 'consent cart should not be visible');
assertEquals(true, consentToast.open, 'consentToast should open');
assertEquals(
'Accept confirmation!',
moduleElement.$.confirmDiscountConsentMessage.innerText);
Expand Down
Expand Up @@ -321,8 +321,7 @@ var NewTabPageModulesChromeCartModuleTest =
}
};

// https://crbug.com/1287294: Flaky
TEST_F('NewTabPageModulesChromeCartModuleTest', 'DISABLED_All', function() {
TEST_F('NewTabPageModulesChromeCartModuleTest', 'All', function() {
mocha.run();
});

Expand Down

0 comments on commit 80cacd3

Please sign in to comment.