Skip to content

Commit

Permalink
Merge pull request zingolabs#563 from Oscar-Pepper/add_e2e_test_hallo…
Browse files Browse the repository at this point in the history
…ween_bug

add_e2e_test_halloween_bug
  • Loading branch information
juanky201271 authored Nov 15, 2023
2 parents 67ab3ec + 797b204 commit fac9831
Show file tree
Hide file tree
Showing 33 changed files with 362 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
testRunner: {
args: {
'$0': 'jest',
config: 'e2e/jest.config.js',
config: 'e2e/e2e-utils/jest.config.js',
"testTimeout": 1000000,
},
jest: {
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ You can also emulate android from the command line without using Android Studio.
by specifying the api level and target. However, using other images with the cargo test runner
is still under development.
2. To run the integration tests. From the `rust` directory, run: <br />
`cargo nextest run` <br />
`cargo nextest run -E 'not test(e2e)'` <br />
Specify to run specific ABI: <br />
`cargo nextest run x86_64` <br />
`cargo nextest run x86_32` <br />
Expand All @@ -118,12 +118,20 @@ lightwalletd/zcashd regtest network. Therefore, only tests in the "Offline Tests
details.
2. In a terminal, run: <br />
`yarn start`
3. In a separate terminal, to build:. <br />
`yarn detox build -c android.att.debug`
4. To run all tests: <br />
`yarn detox test -c android.att.debug` <br />
or to run a specific test: <br />
`yarn detox test -c android.att.debug test_name`
3. In a separate terminal, from the `rust` directory, run all tests: <br />
`cargo nextest run e2e`
or run a specific test: <br />
`cargo nextest run e2e::test_name`

### Regchest
Integration tests and end-to-end tests can be run on non-linux hosts with Regchest
(https://github.com/zingolabs/zingo-regchest). Regchest manages the zcash/lightwalletd regtest
network in a docker container. Before running tests, pull the latest Regchest image from docker: <br />
`docker pull zingodevops/regchest:007`

To run tests with Regchest, add the `--features regchest` flag, for example: <br />
`cargo nextest run --features regchest -E 'not test(e2e)'` <br />
`cargo nextest run --features regchest e2e`

# Troubleshooting
For notes on known issues and problems, see the [trouble-shooting notes](./TROUBLESHOOTING.md).
3 changes: 3 additions & 0 deletions __tests__/__snapshots__/ChainTypeToggle.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports[`Component ChainTypeToggle - test ChainTypeToggle - snapshot 1`] = `
"opacity": 1,
}
}
testID="settings.custom-server-chain.mainnet"
>
<View
style={
Expand Down Expand Up @@ -99,6 +100,7 @@ exports[`Component ChainTypeToggle - test ChainTypeToggle - snapshot 1`] = `
"opacity": 1,
}
}
testID="settings.custom-server-chain.testnet"
>
<View
style={
Expand Down Expand Up @@ -154,6 +156,7 @@ exports[`Component ChainTypeToggle - test ChainTypeToggle - snapshot 1`] = `
"opacity": 1,
}
}
testID="settings.custom-server-chain.regtest"
>
<View
style={
Expand Down
2 changes: 2 additions & 0 deletions __tests__/__snapshots__/Components.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ exports[`Component Components - test ZecAmount Normal Privacy - snapshot 1`] = `
"padding": 0,
}
}
testID="undefined.big-part"
>
1.1234
</Text>
Expand All @@ -475,6 +476,7 @@ exports[`Component Components - test ZecAmount Normal Privacy - snapshot 1`] = `
"padding": 0,
}
}
testID="undefined.small-part"
>
5678
</Text>
Expand Down
2 changes: 2 additions & 0 deletions __tests__/__snapshots__/Header.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ exports[`Component Header - test Header Complex - snapshot 1`] = `
"padding": 0,
}
}
testID="undefined.big-part"
>
1.1234
</Text>
Expand All @@ -226,6 +227,7 @@ exports[`Component Header - test Header Complex - snapshot 1`] = `
"padding": 0,
}
}
testID="undefined.small-part"
>
5678
</Text>
Expand Down
7 changes: 7 additions & 0 deletions __tests__/__snapshots__/History.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.big-part"
>
1.1234
</Text>
Expand All @@ -1650,6 +1651,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.small-part"
>
5678
</Text>
Expand Down Expand Up @@ -2054,6 +2056,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.big-part"
>
0.1235
</Text>
Expand All @@ -2067,6 +2070,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.small-part"
>
5678
</Text>
Expand Down Expand Up @@ -2306,6 +2310,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.big-part"
>
0.0001
</Text>
Expand Down Expand Up @@ -2545,6 +2550,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.big-part"
>
0.8765
</Text>
Expand All @@ -2558,6 +2564,7 @@ exports[`Component History - test History no currency, privacy normal & mode bas
"padding": 0,
}
}
testID="undefined.small-part"
>
4321
</Text>
Expand Down
12 changes: 12 additions & 0 deletions __tests__/__snapshots__/Pools.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="orchard-total-balance"
>
<RNSVGSvgView
align="xMidYMid"
Expand Down Expand Up @@ -318,6 +319,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="orchard-total-balance.big-part"
>
0.6000
</Text>
Expand Down Expand Up @@ -389,6 +391,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="orchard-spendable-balance"
>
<RNSVGSvgView
align="xMidYMid"
Expand Down Expand Up @@ -478,6 +481,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="orchard-spendable-balance.big-part"
>
0.3000
</Text>
Expand Down Expand Up @@ -582,6 +586,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="sapling-total-balance"
>
<RNSVGSvgView
align="xMidYMid"
Expand Down Expand Up @@ -665,6 +670,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="sapling-total-balance.big-part"
>
0.4000
</Text>
Expand Down Expand Up @@ -736,6 +742,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="sapling-spendable-balance"
>
<RNSVGSvgView
align="xMidYMid"
Expand Down Expand Up @@ -825,6 +832,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="sapling-spendable-balance.big-part"
>
0.2000
</Text>
Expand Down Expand Up @@ -928,6 +936,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="transparent-balance"
>
<RNSVGSvgView
align="xMidYMid"
Expand Down Expand Up @@ -1017,6 +1026,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="transparent-balance.big-part"
>
0.1234
</Text>
Expand All @@ -1030,6 +1040,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"padding": 0,
}
}
testID="transparent-balance.small-part"
>
5678
</Text>
Expand Down Expand Up @@ -1080,6 +1091,7 @@ exports[`Component Pools - test Pools - snapshot 1`] = `
"paddingRight": 20,
}
}
testID="fund-pools.button.close"
>
<View
style={
Expand Down
5 changes: 3 additions & 2 deletions __tests__/__snapshots__/Send.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`Component Send - test Send currency USD, privacy high & mode advanced -
<RCTScrollView
contentContainerStyle={{}}
keyboardShouldPersistTaps="handled"
testID="send.scrollView"
testID="send.scroll-view"
>
<View>
<View
Expand Down Expand Up @@ -957,7 +957,7 @@ exports[`Component Send - test Send no currency, privacy normal & mode basic - s
<RCTScrollView
contentContainerStyle={{}}
keyboardShouldPersistTaps="handled"
testID="send.scrollView"
testID="send.scroll-view"
>
<View>
<View
Expand Down Expand Up @@ -1398,6 +1398,7 @@ exports[`Component Send - test Send no currency, privacy normal & mode basic - s
"padding": 0,
}
}
testID="undefined.big-part"
>
0.0000
</Text>
Expand Down
2 changes: 1 addition & 1 deletion __tests__/__snapshots__/Settings.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exports[`Component Settings - test Settings - snapshot 1`] = `
"maxHeight": "85%",
}
}
testID="settings.scrollView"
testID="settings.scroll-view"
>
<View>
<View
Expand Down
2 changes: 1 addition & 1 deletion app/LoadedApp/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Menu: React.FunctionComponent<MenuProps> = ({ onItemSelected }) => {
)}

{mode !== 'basic' && (
<RegText onPress={() => onItemSelectedWrapper('Fund Pools')} style={item}>
<RegText testID="menu.fund-pools" onPress={() => onItemSelectedWrapper('Fund Pools')} style={item}>
{translate('loadedapp.fundpools') as string}
</RegText>
)}
Expand Down
15 changes: 12 additions & 3 deletions components/Components/ChainTypeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const ChainTypeToggle: React.FunctionComponent<ChainTypeToggleProps> = ({

return (
<View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<TouchableOpacity style={{ marginHorizontal: 5 }} onPress={() => onPress('main')}>
<TouchableOpacity
testID="settings.custom-server-chain.mainnet"
style={{ marginHorizontal: 5 }}
onPress={() => onPress('main')}>
<View
style={{
flexDirection: 'row',
Expand Down Expand Up @@ -55,7 +58,10 @@ const ChainTypeToggle: React.FunctionComponent<ChainTypeToggleProps> = ({
</View>
</View>
</TouchableOpacity>
<TouchableOpacity style={{ marginHorizontal: 5 }} onPress={() => onPress('test')}>
<TouchableOpacity
testID="settings.custom-server-chain.testnet"
style={{ marginHorizontal: 5 }}
onPress={() => onPress('test')}>
<View
style={{
flexDirection: 'row',
Expand Down Expand Up @@ -87,7 +93,10 @@ const ChainTypeToggle: React.FunctionComponent<ChainTypeToggleProps> = ({
</View>
</View>
</TouchableOpacity>
<TouchableOpacity style={{ marginHorizontal: 5 }} onPress={() => onPress('regtest')}>
<TouchableOpacity
testID="settings.custom-server-chain.regtest"
style={{ marginHorizontal: 5 }}
onPress={() => onPress('regtest')}>
<View
style={{
flexDirection: 'row',
Expand Down
5 changes: 5 additions & 0 deletions components/Components/ZecAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ZecAmountProps = {
currencyName: string;
privacy?: boolean;
smallPrefix?: boolean;
testID?: string;
};

const ZecAmount: React.FunctionComponent<ZecAmountProps> = ({
Expand All @@ -26,6 +27,7 @@ const ZecAmount: React.FunctionComponent<ZecAmountProps> = ({
amtZec,
privacy,
smallPrefix,
testID,
}) => {
const [privacyHigh, setPrivacyHigh] = useState<boolean>(privacy || false);
const splits = Utils.splitZecAmountIntoBigSmall(amtZec);
Expand Down Expand Up @@ -76,6 +78,7 @@ const ZecAmount: React.FunctionComponent<ZecAmountProps> = ({
<View style={{ ...style, flexDirection: 'row', margin: 5 }}>
<TouchableOpacity disabled={!privacyHigh} onPress={onPress}>
<View
testID={testID}
style={{
flexDirection: 'row',
alignItems: 'flex-end',
Expand Down Expand Up @@ -117,6 +120,7 @@ const ZecAmount: React.FunctionComponent<ZecAmountProps> = ({
</Text>
) : (
<Text
testID={`${testID}.big-part`}
style={{
fontSize: size,
fontWeight: '700',
Expand All @@ -129,6 +133,7 @@ const ZecAmount: React.FunctionComponent<ZecAmountProps> = ({
)}
{splits.smallPart !== '0000' && !privacyHigh && (
<Text
testID={`${testID}.small-part`}
style={{
fontSize: size * 0.7,
color,
Expand Down
Loading

0 comments on commit fac9831

Please sign in to comment.