Skip to content

Commit

Permalink
Detox: update RPC Network flow (#1173)
Browse files Browse the repository at this point in the history
* added the removal of RPC network

* go back instead of relaunching app
  • Loading branch information
ibrahimtaveras00 authored Oct 29, 2019
1 parent 5e94a81 commit 749fee6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ exports[`NetworksSettings should render correctly 1`] = `
key="network-0"
onLongPress={[Function]}
onPress={[Function]}
testID="select-network"
>
<View
style={
Expand Down Expand Up @@ -133,6 +134,7 @@ exports[`NetworksSettings should render correctly 1`] = `
key="network-1"
onLongPress={[Function]}
onPress={[Function]}
testID="select-network"
>
<View
style={
Expand Down Expand Up @@ -180,6 +182,7 @@ exports[`NetworksSettings should render correctly 1`] = `
key="network-2"
onLongPress={[Function]}
onPress={[Function]}
testID="select-network"
>
<View
style={
Expand Down Expand Up @@ -227,6 +230,7 @@ exports[`NetworksSettings should render correctly 1`] = `
key="network-3"
onLongPress={[Function]}
onPress={[Function]}
testID="select-network"
>
<View
style={
Expand Down Expand Up @@ -288,6 +292,7 @@ exports[`NetworksSettings should render correctly 1`] = `
key="network-0"
onLongPress={[Function]}
onPress={[Function]}
testID="select-network"
>
<View
style={
Expand Down
1 change: 1 addition & 0 deletions app/components/Views/Settings/NetworksSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class NetworksSettings extends PureComponent {
key={`network-${i}`}
onPress={() => this.onPress(network)} // eslint-disable-line
onLongPress={() => isCustomRPC && this.showRemoveMenu(network)} // eslint-disable-line
testID={'select-network'}
>
<View style={styles.network}>
<View style={[styles.networkIcon, color ? { backgroundColor: color } : styles.otherNetworkIcon]} />
Expand Down
38 changes: 38 additions & 0 deletions e2e/add-custom-rpc.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TestHelpers from './helpers';

const RINKEBY = 'Rinkeby Test Network';
const XDAI_URL = 'https://dai.poa.network/';
const MAINNET = 'Ethereum Main Network';

describe('Custom RPC Tests', () => {
beforeEach(() => {
Expand Down Expand Up @@ -87,5 +88,42 @@ describe('Custom RPC Tests', () => {
await TestHelpers.tapByText(RINKEBY);
// Check that we are on correct network
await TestHelpers.checkIfElementHasString('network-name', RINKEBY);
// Tap to prompt network list
await TestHelpers.tapAtPoint('wallet-screen', { x: 200, y: -5 });
// Check that networks list is visible
await TestHelpers.checkIfVisible('networks-list');
// Swipe down on networks list
await TestHelpers.swipe('networks-list', 'up');
// Change to back to xDai Network
await TestHelpers.tapByText('xDai');
// Check that we are on the wallet screen
await TestHelpers.checkIfVisible('wallet-screen');
// Check that we are on correct network
await TestHelpers.checkIfElementHasString('network-name', 'xDai');
});

it('should go to settings networks and remove xDai network', async () => {
// Open Drawer
await TestHelpers.tapAtPoint('wallet-screen', { x: 30, y: -5 });
// Check that the drawer is visbile
await TestHelpers.checkIfVisible('drawer-screen');
// Tap on settings
await TestHelpers.tap('settings-button');
// Tap on the "Networks" option
await TestHelpers.tapByText('Networks');
// Check that we are on the networks screen
await TestHelpers.checkIfVisible('networks-screen');
// Tap on xDai to remove network
await element(by.text('xDai')).longPress();
// Tap remove
await TestHelpers.tapByText('Remove');
// Tap on back arrow
await TestHelpers.tapAtPoint('networks-screen', { x: 25, y: -22 });
// Tap close
await TestHelpers.tapByText('Close');
// Check that we are on the wallet screen
await TestHelpers.checkIfExists('wallet-screen');
// Check that we are on Mainnet
await TestHelpers.checkIfElementHasString('network-name', MAINNET);
});
});

0 comments on commit 749fee6

Please sign in to comment.