Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt magic modals #788

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,22 @@ jobs:
api-level: ${{ matrix.config['api-level'] }}
target: ${{ matrix.config.target }}

android-ubuntu-e2e-test-ci:
strategy:
matrix:
config:
- { abi: x86_64, api-level: 30, target: default }
- { abi: x86, api-level: 28, target: default }
uses: ./.github/workflows/android-ubuntu-e2e-test-ci.yaml
needs: [create-timestamp, android-build]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
abi: ${{ matrix.config.abi }}
api-level: ${{ matrix.config['api-level'] }}
target: ${{ matrix.config.target }}
# deactivating these for now, until we know how to fix
# detox run in android
#android-ubuntu-e2e-test-ci:
# strategy:
# matrix:
# config:
# - { abi: x86_64, api-level: 30, target: default }
# - { abi: x86, api-level: 28, target: default }
# uses: ./.github/workflows/android-ubuntu-e2e-test-ci.yaml
# needs: [create-timestamp, android-build]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
# abi: ${{ matrix.config.abi }}
# api-level: ${{ matrix.config['api-level'] }}
# target: ${{ matrix.config.target }}

ios-build:
uses: ./.github/workflows/ios-build.yaml
Expand Down
16 changes: 16 additions & 0 deletions __mocks__/react-native-magic-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { View } from 'react-native';
import React from 'react';

export const useMagicModal = jest.fn(() => ({
hide: jest.fn(),
}));

export const magicModal = {
show: jest.fn(),
hide: jest.fn(),
hideAll: jest.fn(),
enableFullWindowOverlay: jest.fn(),
disableFullWindowOverlay: jest.fn(),
};

export const MagicModalPortal = () => <View />;
3 changes: 1 addition & 2 deletions __tests__/About.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ describe('Component About - test', () => {
state.translate = mockTranslate;
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
const onClose = jest.fn();
const about = render(
<ContextAppLoadedProvider value={state}>
<About closeModal={onClose} />
<About />
</ContextAppLoadedProvider>,
);
expect(about.toJSON()).toMatchSnapshot();
Expand Down
3 changes: 1 addition & 2 deletions __tests__/AddressBook.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ describe('Component Address Book - test', () => {
const state = defaultAppContextLoaded;
state.addressBook = mockAddressBook;
state.translate = mockTranslate;
const onClose = jest.fn();
const onSet = jest.fn();
const ab: any = render(
<ContextAppLoadedProvider value={state}>
<AddressBook closeModal={onClose} setAddressBook={onSet} />
<AddressBook setAddressBook={onSet} />
</ContextAppLoadedProvider>,
);
expect(ab.toJSON()).toMatchSnapshot();
Expand Down
4 changes: 0 additions & 4 deletions __tests__/Header.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@ describe('Component Header - test', () => {
<Header
title="title"
testID="valuetransfer text"
poolsMoreInfoOnClick={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
toggleMenuDrawer={onFunction}
setComputingModalVisible={onFunction}
setBackgroundError={onFunction}
setPrivacyOption={onFunction}
setUfvkViewModalVisible={onFunction}
addLastSnackbar={onFunction}
setShieldingAmount={onFunction}
/>
Expand Down
46 changes: 13 additions & 33 deletions __tests__/History.ValueTransferDetail.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,17 @@ describe('Component History ValueTransferDetail - test', () => {
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
state.valueTransfers = mockValueTransfers;
const onClose = jest.fn();
const onSetOption = jest.fn();
const onMove = jest.fn();

test('History ValueTransferDetail - sent ValueTransfer with 2 addresses', () => {
render(
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={0}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
vt={mockValueTransfers[0]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
).toJSON();
Expand All @@ -137,13 +132,10 @@ describe('Component History ValueTransferDetail - test', () => {
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={1}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
vt={mockValueTransfers[1]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -158,13 +150,10 @@ describe('Component History ValueTransferDetail - test', () => {
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={2}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
vt={mockValueTransfers[2]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -178,13 +167,10 @@ describe('Component History ValueTransferDetail - test', () => {
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={3}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
vt={mockValueTransfers[3]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -200,13 +186,10 @@ describe('Component History ValueTransferDetail - test', () => {
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={4}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
vt={mockValueTransfers[4]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -219,14 +202,11 @@ describe('Component History ValueTransferDetail - test', () => {
render(
<ContextAppLoadedProvider value={state}>
<ValueTransferDetail
index={4}
length={mockValueTransfers.length}
totalLength={mockValueTransfers.length}
index={5}
vt={mockValueTransfers[5]}
closeModal={onClose}
openModal={onClose}
valueTransfersSliced={mockValueTransfers}
totalLength={mockValueTransfers.length}
setPrivacyOption={onSetOption}
moveValueTransferDetail={onMove}
/>
</ContextAppLoadedProvider>,
);
Expand Down
6 changes: 0 additions & 6 deletions __tests__/History.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ describe('Component History - test', () => {
<ContextAppLoadedProvider value={state}>
<History
toggleMenuDrawer={onFunction}
poolsMoreInfoOnClick={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setComputingModalVisible={onFunction}
setPrivacyOption={onFunction}
setShieldingAmount={onFunction}
setScrollToTop={onFunction}
Expand All @@ -162,9 +159,6 @@ describe('Component History - test', () => {
<ContextAppLoadedProvider value={state}>
<History
toggleMenuDrawer={onFunction}
poolsMoreInfoOnClick={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setComputingModalVisible={onFunction}
setPrivacyOption={onFunction}
setShieldingAmount={onFunction}
setScrollToTop={onFunction}
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Info.es.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ describe('Component Info - test', () => {
state.info = mockInfo;
state.zecPrice = mockZecPrice;
state.currency = CurrencyEnum.USDCurrency;
const onClose = jest.fn();
render(
<ContextAppLoadedProvider value={state}>
<Info closeModal={onClose} />
<Info />
</ContextAppLoadedProvider>,
);
screen.getByText('$ 33,33');
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Info.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ describe('Component Info - test', () => {
state.zecPrice = mockZecPrice;
state.translate = mockTranslate;
state.totalBalance = mockTotalBalance;
const onClose = jest.fn();
const info: any = render(
<ContextAppLoadedProvider value={state}>
<Info closeModal={onClose} />
<Info />
</ContextAppLoadedProvider>,
);
expect(info.toJSON()).toMatchSnapshot();
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Info.us.unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ describe('Component Info - test', () => {
state.info = mockInfo;
state.zecPrice = mockZecPrice;
state.currency = CurrencyEnum.USDCurrency;
const onClose = jest.fn();
render(
<ContextAppLoadedProvider value={state}>
<Info closeModal={onClose} />
<Info />
</ContextAppLoadedProvider>,
);
screen.getByText('$ 33.33');
Expand Down
4 changes: 2 additions & 2 deletions __tests__/Insight.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ describe('Component Insight - test', () => {
state.translate = mockTranslate;
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
const onClose = jest.fn();
const onSet = jest.fn();
const insight = render(
<ContextAppLoadedProvider value={state}>
<Insight closeModal={onClose} setPrivacyOption={onClose} />
<Insight setPrivacyOption={onSet} />
</ContextAppLoadedProvider>,
);
expect(insight.toJSON()).toMatchSnapshot();
Expand Down
1 change: 1 addition & 0 deletions __tests__/LoadedApp.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jest.mock('react-native-gesture-handler', () => {

return {
RNGestureHandlerModule: RN,
GestureHandlerRootView: ({ children }: {children: React.ReactNode}) => children,
};
});
jest.mock('react-native-keychain', () => ({
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Memo.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ describe('Component Memo - test', () => {
test('Memo - snapshot', () => {
const state = defaultAppContextLoaded;
state.translate = mockTranslate;
const onClose = jest.fn();
const onSetMemo = jest.fn();
const memo = render(
<ContextAppLoadedProvider value={state}>
<Memo closeModal={onClose} message={''} includeUAMessage={true} setMessage={onSetMemo} />
<Memo message={''} includeUAMessage={true} setMessage={onSetMemo} />
</ContextAppLoadedProvider>,
);
expect(memo.toJSON()).toMatchSnapshot();
Expand Down
2 changes: 0 additions & 2 deletions __tests__/Messages.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe('Component Messages - test', () => {
<ContextAppLoadedProvider value={state}>
<Messages
toggleMenuDrawer={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setPrivacyOption={onFunction}
setScrollToBottom={onFunction}
scrollToBottom={false}
Expand All @@ -148,7 +147,6 @@ describe('Component Messages - test', () => {
<ContextAppLoadedProvider value={state}>
<Messages
toggleMenuDrawer={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setPrivacyOption={onFunction}
setScrollToBottom={onFunction}
scrollToBottom={false}
Expand Down
2 changes: 0 additions & 2 deletions __tests__/MessagesAddress.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ describe('Component Messages Address - test', () => {
setScrollToBottom={onFunction}
scrollToBottom={false}
address={mockAddresses[0].uOrchardAddress}
closeModal={onFunction}
openModal={onFunction}
sendTransaction={onFunction}
setServerOption={onFunction}
/>
Expand Down
4 changes: 2 additions & 2 deletions __tests__/Pools.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ describe('Component Pools - test', () => {
state.translate = mockTranslate;
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
const onClose = jest.fn();
const onSet = jest.fn();
test('Pools - snapshot', () => {
const pools = render(
<ContextAppLoadedProvider value={state}>
<Pools closeModal={onClose} setPrivacyOption={onClose} />
<Pools setPrivacyOption={onSet} />
</ContextAppLoadedProvider>,
);
expect(pools.toJSON()).toMatchSnapshot();
Expand Down
3 changes: 0 additions & 3 deletions __tests__/PrivKey.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ describe('Component PrivKey - test', () => {
state.translate = mockTranslate;
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
const onClose = jest.fn();
test('PrivKey Private - snapshot', () => {
const privKey = render(
<ContextAppLoadedProvider value={state}>
<PrivKey
address={'UA-12345678901234567890'}
keyType={0}
privKey={'priv-key-12345678901234567890'}
closeModal={onClose}
/>
</ContextAppLoadedProvider>,
);
Expand All @@ -86,7 +84,6 @@ describe('Component PrivKey - test', () => {
address={'UA-12345678901234567890'}
keyType={1}
privKey={'view-key-12345678901234567890'}
closeModal={onClose}
/>
</ContextAppLoadedProvider>,
);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/Receive.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Component Receive - test', () => {
const onFunction = jest.fn();
const receive = render(
<ContextAppLoadedProvider value={state}>
<Receive toggleMenuDrawer={onFunction} syncingStatusMoreInfoOnClick={onFunction} alone={false} />
<Receive toggleMenuDrawer={onFunction} alone={false} />
</ContextAppLoadedProvider>,
);
expect(receive.toJSON()).toMatchSnapshot();
Expand Down
3 changes: 1 addition & 2 deletions __tests__/Rescan.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ describe('Component Rescan - test', () => {
state.info = mockInfo;
state.totalBalance = mockTotalBalance;
state.wallet = mockWallet;
const onClose = jest.fn();
const onRescan = jest.fn();
test('Rescan - snapshot', () => {
const rescan = render(
<ContextAppLoadedProvider value={state}>
<Rescan closeModal={onClose} doRescan={onRescan} />
<Rescan doRescan={onRescan} />
</ContextAppLoadedProvider>,
);
expect(rescan.toJSON()).toMatchSnapshot();
Expand Down
6 changes: 0 additions & 6 deletions __tests__/Send.snapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ describe('Component Send - test', () => {
sendTransaction={onFunction}
clearToAddr={onFunction}
toggleMenuDrawer={onFunction}
setComputingModalVisible={onFunction}
poolsMoreInfoOnClick={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setPrivacyOption={onFunction}
setShieldingAmount={onFunction}
setScrollToTop={onFunction}
Expand All @@ -126,9 +123,6 @@ describe('Component Send - test', () => {
sendTransaction={onFunction}
clearToAddr={onFunction}
toggleMenuDrawer={onFunction}
setComputingModalVisible={onFunction}
poolsMoreInfoOnClick={onFunction}
syncingStatusMoreInfoOnClick={onFunction}
setPrivacyOption={onFunction}
setShieldingAmount={onFunction}
setScrollToTop={onFunction}
Expand Down
Loading