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

test: send to contract address #9710

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1a5420e
fix send and amount page objects
cortisiko May 20, 2024
78d5962
create send folder. Fix import paths
cortisiko May 20, 2024
ebee107
fix send erc import path for send flow page objects
cortisiko May 20, 2024
d25cf14
move transaction confirmation view to send folder
cortisiko May 20, 2024
73c3ac1
fix unit test & transaction overview page object
cortisiko May 20, 2024
3fe2cbe
selectors,linting, :saxophone:
cortisiko May 20, 2024
1c35c72
update selector
cortisiko May 21, 2024
00e3634
fix unit test
cortisiko May 21, 2024
ea847ed
transaction confirmation view page object completed
cortisiko May 21, 2024
23aaa82
send to contract address
cortisiko May 21, 2024
222d812
fix selector for removing account
cortisiko May 21, 2024
ad0bd68
remove duplicate action
cortisiko May 21, 2024
a6ceddb
Revert "remove duplicate action"
cortisiko May 21, 2024
fea5eff
remove duplicate action
cortisiko May 21, 2024
b0235b1
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 21, 2024
fba61e1
Merge branch 'main' into send-flow-create-send-flow-folder-with-the-r…
cortisiko May 21, 2024
ea5bd92
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 21, 2024
cc8780a
disabling assertion for now
cortisiko May 21, 2024
5b99d94
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 21, 2024
917ec2a
change assertion type
cortisiko May 21, 2024
e424545
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 21, 2024
f6637f6
swaps is becoming unstable. Fixing that
cortisiko May 21, 2024
4a7180e
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 21, 2024
eb6739e
fix linting
cortisiko May 22, 2024
5581b73
Merge branch 'send-flow-create-send-flow-folder-with-the-respective-p…
cortisiko May 22, 2024
c4f3b10
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko May 22, 2024
5c4c53e
fix linting
cortisiko May 22, 2024
4326661
readd tap on contract warning screen
cortisiko May 22, 2024
17569d5
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko May 23, 2024
7dc4283
prevent flakiness
cortisiko May 23, 2024
1d8ffa2
change typing action to prevent flakiness
cortisiko May 23, 2024
f5df046
fix unit test
cortisiko May 23, 2024
5df3594
updating test names
cortisiko May 24, 2024
0c1ad8e
address flakiness
cortisiko May 24, 2024
9c84701
Revert "address flakiness"
cortisiko May 24, 2024
e30c6b3
fix typing
cortisiko May 24, 2024
822a01c
update send amount
cortisiko May 24, 2024
9352b6a
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko May 29, 2024
dd80313
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko May 29, 2024
c90acd5
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko Jun 3, 2024
fdf1f03
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko Jun 3, 2024
f16d15d
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko Jun 4, 2024
cb9331e
Merge branch 'main' into detox/add-send-to-contRACT-e2e
cortisiko Dec 18, 2024
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 @@ -316,14 +316,14 @@ exports[`Amount should convert ERC-20 token value to USD 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -1034,14 +1034,14 @@ exports[`Amount should convert ETH to USD 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -1752,14 +1752,14 @@ exports[`Amount should convert USD to ERC-20 token value 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -2487,14 +2487,14 @@ exports[`Amount should convert USD to ETH 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -3222,14 +3222,14 @@ exports[`Amount should display correct balance 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -3939,14 +3939,14 @@ exports[`Amount should not show a warning when conversion rate is available 1`]
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -4656,14 +4656,14 @@ exports[`Amount should not show a warning when transfering collectibles 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -5358,14 +5358,14 @@ exports[`Amount should proceed if balance is sufficient while on Native primary
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -6071,14 +6071,14 @@ exports[`Amount should render correctly 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -6783,14 +6783,14 @@ exports[`Amount should show a warning when conversion rate is not available 1`]
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down Expand Up @@ -7495,14 +7495,14 @@ exports[`Amount should show an error message if balance is insufficient 1`] = `
"flex": 1,
}
}
testID="amount-screen"
>
<RCTScrollView
style={
{
"marginBottom": 60,
}
}
testID="amount-screen"
>
<View>
<View
Expand Down
11 changes: 5 additions & 6 deletions app/components/Views/confirmations/SendFlow/Amount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1403,12 +1403,11 @@ class Amount extends PureComponent {
const styles = createStyles(colors);

return (
<SafeAreaView
edges={['bottom']}
style={styles.wrapper}
testID={AmountViewSelectorsIDs.CONTAINER}
>
<ScrollView style={styles.scrollWrapper}>
<SafeAreaView edges={['bottom']} style={styles.wrapper}>
<ScrollView
style={styles.scrollWrapper}
testID={AmountViewSelectorsIDs.CONTAINER}
>
{!hasExchangeRate && !selectedAsset.tokenId ? (
<Alert
small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { strings } from '../../../../../../locales/i18n';
import Alert, { AlertType } from '../../../../Base/Alert';
import Text from '../../../../Base/Text';
import { CommonSelectorsIDs } from '../../../../../../e2e/selectors/Common.selectors';
import { SendViewSelectorsIDs } from '../../../../../../e2e/selectors/SendView.selectors';

const styles = StyleSheet.create({
button: {
Expand All @@ -30,7 +31,11 @@ export default function ErrorMessage(props) {
{errorMessage}
</Text>
{errorContinue && (
<TouchableOpacity onPress={onContinue} style={styles.button}>
<TouchableOpacity
onPress={onContinue}
style={styles.button}
testID={SendViewSelectorsIDs.I_UNDERSTAND_RISK_ID}
>
<Text small link centered>
{strings('transaction.continueError')}
</Text>
Expand Down
7 changes: 4 additions & 3 deletions e2e/pages/Send/AmountView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class AmountView {
get currencySwitch() {
return Matchers.getElementByID(AmountViewSelectorsIDs.CURRENCY_SWITCH);
}
get container() {
return Matchers.getElementByID(AmountViewSelectorsIDs.CONTAINER);
}

get nextButton() {
return device.getPlatform() === 'ios'
Expand All @@ -22,9 +25,7 @@ class AmountView {
}

async typeInTransactionAmount(amount) {
device.getPlatform() === 'android'
? await Gestures.typeTextAndHideKeyboard(this.amountInputField, amount)
: await Gestures.replaceTextInField(this.amountInputField, amount);
await Gestures.typeTextAndHideKeyboard(this.amountInputField, amount);
}

async tapCurrencySwitch() {
Expand Down
8 changes: 8 additions & 0 deletions e2e/pages/Send/SendView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ class SendView {
return Matchers.getElementByID(SendViewSelectorsIDs.NO_ETH_MESSAGE);
}

get iUnderstandWarningButton() {
// Warning appears when sending to a contract address
return Matchers.getElementByID(SendViewSelectorsIDs.I_UNDERSTAND_RISK_ID);
}
async tapIUnderstandButton() {
await Gestures.waitAndTap(this.iUnderstandWarningButton);
}

async tapCancelButton() {
await Gestures.waitAndTap(this.cancelButton);
}
Expand Down
1 change: 1 addition & 0 deletions e2e/selectors/SendView.selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const SendViewSelectorsIDs = {
SEND_CANCEL_BUTTON: 'send-cancel-button',
ADD_ADDRESS_BUTTON: 'add-address-button-a',
CONTAINER_ID: 'send-screen',
I_UNDERSTAND_RISK_ID: 'understand-risk-id',
};
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/approve-custom-erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ActivitiesViewSelectorsText } from '../../selectors/ActivitiesView.sele

const HST_CONTRACT = SMART_CONTRACTS.HST;

describe(SmokeConfirmations('ERC20 tokens'), () => {
describe(SmokeConfirmations('Approve Custom ERC20 tokens'), () => {
beforeAll(async () => {
jest.setTimeout(170000);
if (device.getPlatform() === 'android') {
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/approve-default-erc20.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TestDApp from '../../pages/Browser/TestDApp';
const HST_CONTRACT = SMART_CONTRACTS.HST;
const EXPECTED_TOKEN_AMOUNT = '7';

describe(SmokeConfirmations('ERC20 tokens'), () => {
describe(SmokeConfirmations('Approve ERC20 tokens'), () => {
beforeAll(async () => {
jest.setTimeout(170000);
if (device.getPlatform() === 'android') {
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/confirmations/send-erc20-with-dapp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Assertions from '../../utils/Assertions';

const HST_CONTRACT = SMART_CONTRACTS.HST;

describe(SmokeConfirmations('ERC20 tokens'), () => {
describe(SmokeConfirmations('Send ERC20 tokens'), () => {
beforeAll(async () => {
jest.setTimeout(170000);
await TestHelpers.reverseServerPort();
Expand Down
3 changes: 2 additions & 1 deletion e2e/specs/confirmations/send-to-contact.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Assertions from '../../utils/Assertions';

const fixtureServer = new FixtureServer();

describe(SmokeConfirmations('Send ETH'), () => {
describe(SmokeConfirmations('Send ETH to Contact'), () => {
const TOKEN_NAME = enContent.unit.eth;
const AMOUNT = '0.12345';

Expand Down Expand Up @@ -67,6 +67,7 @@ describe(SmokeConfirmations('Send ETH'), () => {

await SendView.tapNextButton();

await Assertions.checkIfVisible(await AmountView.container);
await AmountView.typeInTransactionAmount(AMOUNT);
await AmountView.tapNextButton();
await Assertions.checkIfTextIsDisplayed('Test Name 1');
Expand Down
62 changes: 62 additions & 0 deletions e2e/specs/confirmations/send-to-contract-address.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';

import { SmokeConfirmations } from '../../tags';
import AmountView from '../../pages/Send/AmountView';
import SendView from '../../pages/Send/SendView';
import TransactionConfirmationView from '../../pages/Send/TransactionConfirmView';
import { loginToApp } from '../../viewHelper';
import TabBarComponent from '../../pages/TabBarComponent';
import WalletActionsModal from '../../pages/modals/WalletActionsModal';
import FixtureBuilder from '../../fixtures/fixture-builder';
import {
loadFixture,
startFixtureServer,
stopFixtureServer,
} from '../../fixtures/fixture-helper';
import { CustomNetworks } from '../../resources/networks.e2e';
import TestHelpers from '../../helpers';
import FixtureServer from '../../fixtures/fixture-server';
import { getFixturesServerPort } from '../../fixtures/utils';
import Assertions from '../../utils/Assertions';

const fixtureServer = new FixtureServer();

describe(SmokeConfirmations('Send ETH to Contract'), () => {
const AMOUNT = '1';

beforeEach(async () => {
await TestHelpers.reverseServerPort();
const fixture = new FixtureBuilder()
.withNetworkController(CustomNetworks.Tenderly)
.build();
await startFixtureServer(fixtureServer);
await loadFixture(fixtureServer, { fixture });
await device.launchApp({
permissions: { notifications: 'YES' },
launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` },
});
await loginToApp();
});

afterAll(async () => {
await stopFixtureServer(fixtureServer);
});

it('should send ETH to a contract from inside the wallet', async () => {
const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F';

await TabBarComponent.tapActions();
await WalletActionsModal.tapSendButton();

await SendView.inputAddress(DAI);
await Assertions.checkIfVisible(await SendView.iUnderstandWarningButton);
await SendView.tapIUnderstandButton();
await Assertions.checkIfVisible(await AmountView.container);

await AmountView.typeInTransactionAmount(AMOUNT);
await AmountView.tapNextButton();

await TransactionConfirmationView.tapConfirmButton();
await TabBarComponent.tapActivity();
});
});
Loading