Skip to content

Commit d270d0d

Browse files
Ishan VeerIshan Veer
authored andcommitted
added tests for discord and verified tabs
1 parent d9d24dd commit d270d0d

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

__tests__/users/App.test.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,46 @@ describe('App Component', () => {
7272
afterAll(async () => {
7373
await browser.close();
7474
});
75-
it('should fetch and append new users on subsequent pages for both tabs', async () => {
75+
it('should fetch and append new users on subsequent pages for discord users tab when feature flag is on', async () => {
7676
await page.goto(`${BASE_URL}/users/discord/?tab=in_discord&dev=true`);
7777
await page.waitForNetworkIdle();
7878

7979
const userCardTestIds = await page.$$eval(
8080
'[data-testid^="user-card-"]',
8181
(cards) => cards.map((card) => card.getAttribute('data-testid')),
8282
);
83-
console.log(userCardTestIds.length, 'user length');
8483
expect(userCardTestIds.length).toBe(2);
8584
});
85+
it('should fetch and append new users on subsequent pages for discord users tab', async () => {
86+
await page.goto(`${BASE_URL}/users/discord/?tab=in_discord`);
87+
await page.waitForNetworkIdle();
88+
89+
const userCardTestIds = await page.$$eval(
90+
'[data-testid^="user-card-"]',
91+
(cards) => cards.map((card) => card.getAttribute('data-testid')),
92+
);
93+
expect(userCardTestIds.length).toBe(10);
94+
});
95+
it('should fetch and append new users on subsequent pages for verified users tab when feature flag is on', async () => {
96+
await page.goto(`${BASE_URL}/users/discord/?tab=verified&dev=true`);
97+
await page.waitForNetworkIdle();
98+
99+
const userCardTestIds = await page.$$eval(
100+
'[data-testid^="user-card-"]',
101+
(cards) => cards.map((card) => card.getAttribute('data-testid')),
102+
);
103+
expect(userCardTestIds.length).toBe(2);
104+
});
105+
it('should fetch and append new users on subsequent pages for verified users tab', async () => {
106+
await page.goto(`${BASE_URL}/users/discord/?tab=verified`);
107+
await page.waitForNetworkIdle();
108+
109+
const userCardTestIds = await page.$$eval(
110+
'[data-testid^="user-card-"]',
111+
(cards) => cards.map((card) => card.getAttribute('data-testid')),
112+
);
113+
expect(userCardTestIds.length).toBe(10);
114+
});
86115

87116
it('should render all sections', async () => {
88117
await page.waitForSelector('.tabs_section');

0 commit comments

Comments
 (0)