diff --git a/app/components/Views/ApproveView/Approve/index.js b/app/components/Views/ApproveView/Approve/index.js index dba24e871e9..e52fc5e854b 100644 --- a/app/components/Views/ApproveView/Approve/index.js +++ b/app/components/Views/ApproveView/Approve/index.js @@ -717,11 +717,11 @@ class Approve extends PureComponent { confirmButtonMode={'confirm'} > - + - + {strings('spend_limit_edition.allow_to_access', { host, tokenSymbol })} diff --git a/app/components/Views/ApproveView/Success/__snapshots__/index.test.js.snap b/app/components/Views/ApproveView/Success/__snapshots__/index.test.js.snap index 8c72a838e09..fb65f31741e 100644 --- a/app/components/Views/ApproveView/Success/__snapshots__/index.test.js.snap +++ b/app/components/Views/ApproveView/Success/__snapshots__/index.test.js.snap @@ -11,6 +11,7 @@ exports[`Success should render correctly 1`] = ` "flexDirection": "column", } } + testID="approve-success-screen" > Close diff --git a/app/components/Views/ApproveView/Success/index.js b/app/components/Views/ApproveView/Success/index.js index 5c01b79b250..b1fc47fc752 100644 --- a/app/components/Views/ApproveView/Success/index.js +++ b/app/components/Views/ApproveView/Success/index.js @@ -59,7 +59,7 @@ export default class Success extends PureComponent { }; render = () => ( - + @@ -67,7 +67,12 @@ export default class Success extends PureComponent { {strings('spend_limit_edition.all_set_desc')} - + {strings('spend_limit_edition.close')} diff --git a/e2e/dapp-initiated-txn.spec.js b/e2e/dapp-initiated-txn.spec.js index 502b43e2a51..e733afc2c91 100644 --- a/e2e/dapp-initiated-txn.spec.js +++ b/e2e/dapp-initiated-txn.spec.js @@ -8,6 +8,7 @@ const ROPSTEN_FAUCET = 'https://faucet.metamask.io'; const TEST_DAPP_URL = 'https://metamask.github.io/test-dapp/'; const TEST_DAPP_TITLE = 'E2E Test Dapp'; const ETH_FAUCET = 'Test Ether Faucet'; +const DAPP_ACCESS = 'Allow metamask.github.io to access your TST?'; describe('Test Dapp Initiated Transactions', () => { beforeEach(() => { @@ -75,7 +76,7 @@ describe('Test Dapp Initiated Transactions', () => { // Tap on Browser await TestHelpers.tapByText('Browser'); // Wait for page to load - await TestHelpers.delay(1000); + await TestHelpers.delay(2000); // Check that we are on the browser screen await TestHelpers.checkIfVisible('browser-screen'); // Tap on search in bottom navbar @@ -83,10 +84,11 @@ describe('Test Dapp Initiated Transactions', () => { // Navigate to URL if (device.getPlatform() === 'ios') { await TestHelpers.typeTextAndHideKeyboard('url-input', ROPSTEN_FAUCET); + await TestHelpers.delay(8500); } else { await TestHelpers.replaceTextInField('url-input', ROPSTEN_FAUCET); await element(by.id('url-input')).tapReturnKey(); - await TestHelpers.delay(1500); + await TestHelpers.delay(8500); } // Check that we are still on the browser screen await TestHelpers.checkIfVisible('browser-screen'); @@ -111,9 +113,9 @@ describe('Test Dapp Initiated Transactions', () => { // Input Amount await TestHelpers.replaceTextInField('amount-input', '0.000001'); // Tap on NEXT button - await TestHelpers.tapByText('NEXT'); + await TestHelpers.tapByText('Next'); // Tap on CONFIRM button - await TestHelpers.tapByText('CONFIRM'); + await TestHelpers.tapByText('Confirm'); // Wait for enable notifications alert to show up if (device.getPlatform() === 'ios') { // Check that we are on the browser screen @@ -153,7 +155,7 @@ describe('Test Dapp Initiated Transactions', () => { } }); - it('should navigate to test dapp repo to create and approve a token', async () => { + it('should navigate to test dapp repo to perform transactions', async () => { // Open Drawer await TestHelpers.tap('hamburger-menu-button-wallet'); // Check that the drawer is visbile @@ -173,10 +175,18 @@ describe('Test Dapp Initiated Transactions', () => { // Navigate to URL if (device.getPlatform() === 'ios') { await TestHelpers.typeTextAndHideKeyboard('url-input', TEST_DAPP_URL); + await TestHelpers.delay(3500); } else { await TestHelpers.replaceTextInField('url-input', TEST_DAPP_URL); await element(by.id('url-input')).tapReturnKey(); - await TestHelpers.delay(1500); + await TestHelpers.delay(3500); + } + // Tap on connect button to bring up connection request + if (device.getPlatform() === 'android') { + await TestHelpers.tapAtPoint('browser-screen', { x: 65, y: 114 }); + await TestHelpers.delay(1000); + } else { + await TestHelpers.tapAtPoint('browser-screen', { x: 65, y: 120 }); } // Give some time for connect request await TestHelpers.delay(1000); @@ -184,19 +194,31 @@ describe('Test Dapp Initiated Transactions', () => { await TestHelpers.checkIfHasText('dapp-name-title', TEST_DAPP_TITLE); // Tap on CONNECT button await TestHelpers.tapByText('CONNECT'); - // Tap on Create Token - if (device.getPlatform() === 'android') { - await TestHelpers.tapAtPoint('browser-screen', { x: 20, y: 56 }); - await TestHelpers.delay(1000); + // Give some time for account to be displayed + await TestHelpers.delay(2000); + // Tap on Create Token button + if (device.getPlatform() === 'ios') { + await TestHelpers.tapAtPoint('browser-screen', { x: 70, y: 297 }); } else { - await TestHelpers.tapAtPoint('browser-screen', { x: 23, y: 63 }); + await TestHelpers.tapAtPoint('browser-screen', { x: 65, y: 289 }); + await TestHelpers.delay(1000); + await TestHelpers.tapAtPoint('browser-screen', { x: 114, y: 290 }); + await TestHelpers.delay(1000); + await TestHelpers.tapAtPoint('browser-screen', { x: 70, y: 315 }); + await TestHelpers.delay(1000); } - // Check that we are on the confirm transaction screen - await TestHelpers.checkIfVisible('confirm-transaction-screen'); + // Tap Edit + await TestHelpers.tap('confirm-txn-edit-button'); + // Tap on SLOW for transaction fee + await TestHelpers.tapByText('SLOW'); + // Tap on NEXT button + await TestHelpers.tapByText('Next'); // Tap on CONFIRM button - await TestHelpers.tapByText('CONFIRM'); - // Wait for enable notifications alert to show up - if (device.getPlatform() === 'ios') { + await TestHelpers.tapByText('Confirm'); + // on iOS dismiss notification and on Android, wait some time for token to be created + if (device.getPlatform() === 'android') { + await TestHelpers.delay(5000); + } else { // Check that we are on the browser screen await TestHelpers.checkIfVisible('browser-screen'); // Wait for enable notifications alert to show up @@ -204,23 +226,33 @@ describe('Test Dapp Initiated Transactions', () => { // Dismiss alert await TestHelpers.tapAlertWithButton('No, thanks'); } - // Delay so that webpage shifts down after address gets added - if (device.getPlatform() === 'android') { - await TestHelpers.delay(10000); - } // Tap on Approve Tokens button if (device.getPlatform() === 'android') { - await TestHelpers.tapAtPoint('browser-screen', { x: 97, y: 67 }); + await TestHelpers.tapAtPoint('browser-screen', { x: 300, y: 289 }); + await TestHelpers.delay(1000); + await TestHelpers.tapAtPoint('browser-screen', { x: 341, y: 290 }); + await TestHelpers.delay(1000); + await TestHelpers.tapAtPoint('browser-screen', { x: 350, y: 307 }); await TestHelpers.delay(1000); } else { - await TestHelpers.tapAtPoint('browser-screen', { x: 100, y: 74 }); + await TestHelpers.tapAtPoint('browser-screen', { x: 301, y: 298 }); + } + // Check that we are on the approve screen + await TestHelpers.checkIfVisible('approve-screen'); + // Check that title is correct + await TestHelpers.checkIfElementHasString('allow-access', DAPP_ACCESS); + // Tap on Approve button + if (device.getPlatform() === 'android') { + await TestHelpers.tapByText('Approve'); + } else { + await TestHelpers.tapAtPoint('approve-screen', { x: 275, y: 620 }); } - // Check that we are on the confirm transaction screen - await TestHelpers.checkIfVisible('confirm-transaction-screen'); - // Tap on CONFIRM button - await TestHelpers.tapByText('CONFIRM'); // Delay await TestHelpers.delay(1000); + // Check that we are on the success screen + await TestHelpers.checkIfVisible('approve-success-screen'); + // Close Success screen + await TestHelpers.tap('approve-success-close-button'); }); it('should log out', async () => { @@ -232,7 +264,7 @@ describe('Test Dapp Initiated Transactions', () => { await TestHelpers.tapByText('Log Out'); // Tap YES await TestHelpers.tapAlertWithButton('YES'); - // Check that we are on the wallet screen + // Check that we are on the login screen await TestHelpers.checkIfVisible('login'); }); });