-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ntp: display tweaks + stats show more fix (#1288)
* ntp: display tweaks * added a failing test case * fixed the implementation * More robust tests --------- Co-authored-by: Shane Osbourne <[email protected]>
- Loading branch information
1 parent
f5ad800
commit 7923678
Showing
9 changed files
with
211 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
special-pages/pages/new-tab/app/privacy-stats/integration-tests/privacy-stats.page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { stats } from '../mocks/stats.js'; | ||
import { expect } from '@playwright/test'; | ||
|
||
export class PrivacyStatsPage { | ||
/** | ||
* @param {import("@playwright/test").Page} page | ||
* @param {import("../../../integration-tests/new-tab.page.js").NewtabPage} ntp | ||
*/ | ||
constructor(page, ntp) { | ||
this.page = page; | ||
this.ntp = ntp; | ||
} | ||
|
||
/** | ||
* @param {object} params | ||
* @param {number} params.count | ||
*/ | ||
async receive({ count }) { | ||
/** @type {import("../../../../../types/new-tab.js").PrivacyStatsData} */ | ||
const next = { totalCount: 0, trackerCompanies: stats.many.trackerCompanies.slice(0, count) }; | ||
await this.ntp.mocks.simulateSubscriptionMessage('stats_onDataUpdate', next); | ||
} | ||
|
||
/** | ||
* @param {import("../../../../../types/new-tab.js").PrivacyStatsData} data | ||
*/ | ||
async receiveData(data) { | ||
await this.ntp.mocks.simulateSubscriptionMessage('stats_onDataUpdate', data); | ||
} | ||
|
||
context() { | ||
return this.page.locator('[data-entry-point="privacyStats"]'); | ||
} | ||
|
||
rows() { | ||
return this.context().getByTestId('CompanyList').locator('li'); | ||
} | ||
|
||
/** | ||
* @param {number} count | ||
*/ | ||
async hasRows(count) { | ||
const rows = this.rows(); | ||
expect(await rows.count()).toBe(count); | ||
} | ||
|
||
async showMoreSecondary() { | ||
await this.context().getByLabel('Show More', { exact: true }).click(); | ||
} | ||
|
||
async showLessSecondary() { | ||
await this.context().getByLabel('Show Less', { exact: true }).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.