mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
add tests for rewards dashboard
This commit is contained in:
@@ -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',
|
||||
};
|
||||
@@ -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',
|
||||
},
|
||||
};
|
||||
@@ -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();
|
||||
});
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 138 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
Reference in New Issue
Block a user