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

Detox: update RPC Network flow #1173

Merged
merged 2 commits into from
Oct 29, 2019
Merged
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
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);
});
});