-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
57 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { RewardsUserReferralsResponse } from 'types/api/rewards'; | ||
|
||
export const base: RewardsUserReferralsResponse = { | ||
code: 'QWERTY', | ||
link: 'https://example.com?ref=QWERTY', | ||
referrals: '15', | ||
}; |
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,10 @@ | ||
import type { RewardsConfigResponse } from 'types/api/rewards'; | ||
|
||
export const base: RewardsConfigResponse = { | ||
rewards: { | ||
registration: '100', | ||
registration_with_referral: '200', | ||
daily_claim: '10', | ||
referral_share: '0.1', | ||
}, | ||
}; |
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,40 @@ | ||
import type { BrowserContext } from '@playwright/test'; | ||
import React from 'react'; | ||
|
||
import * as rewardsBalanceMock from 'mocks/rewards/balance'; | ||
import * as dailyRewardMock from 'mocks/rewards/dailyReward'; | ||
import * as referralsMock from 'mocks/rewards/referrals'; | ||
import * as rewardsConfigMock from 'mocks/rewards/rewardsConfig'; | ||
import * as profileMock from 'mocks/user/profile'; | ||
import { contextWithAuth } from 'playwright/fixtures/auth'; | ||
import { ENVS_MAP } from 'playwright/fixtures/mockEnvs'; | ||
import { contextWithRewards } from 'playwright/fixtures/rewards'; | ||
import { test, expect } from 'playwright/lib'; | ||
|
||
import RewardsDashboard from './RewardsDashboard'; | ||
|
||
const testWithAuth = test.extend<{ context: BrowserContext }>({ | ||
context: contextWithAuth, | ||
}).extend<{ context: BrowserContext }>({ | ||
context: contextWithRewards, | ||
}); | ||
|
||
testWithAuth.beforeEach(async({ mockEnvs, mockApiResponse }) => { | ||
await mockEnvs([ ...ENVS_MAP.rewardsService ]); | ||
await mockApiResponse('user_info', profileMock.withEmailAndWallet); | ||
}); | ||
|
||
testWithAuth('base view +@dark-mode +@mobile', async({ render, mockApiResponse }) => { | ||
await mockApiResponse('rewards_user_balances', rewardsBalanceMock.base); | ||
await mockApiResponse('rewards_user_daily_check', dailyRewardMock.base); | ||
await mockApiResponse('rewards_user_referrals', referralsMock.base); | ||
await mockApiResponse('rewards_config', rewardsConfigMock.base); | ||
|
||
const component = await render(<RewardsDashboard/>); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
|
||
testWithAuth('with error', async({ render }) => { | ||
const component = await render(<RewardsDashboard/>); | ||
await expect(component).toHaveScreenshot(); | ||
}); |
Binary file added
BIN
+139 KB
...hots__/RewardsDashboard.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+138 KB
..._screenshots__/RewardsDashboard.pw.tsx_default_base-view-dark-mode-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+136 KB
ui/pages/__screenshots__/RewardsDashboard.pw.tsx_default_with-error-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+128 KB
...__screenshots__/RewardsDashboard.pw.tsx_mobile_base-view-dark-mode-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.