Skip to content

Commit

Permalink
Merge pull request zingolabs#707 from dorianvp/detox-fixes
Browse files Browse the repository at this point in the history
Fix send.test.js timing and config errors
  • Loading branch information
juanky201271 authored Sep 25, 2024
2 parents 7c0d7d0 + 5e424be commit 6f6b265
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
5 changes: 4 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { ModeEnum, RouteEnums } from './app/AppState';

import { LogBox } from 'react-native';

LogBox.ignoreLogs(['Require cycle: app\\uris\\serverUris.mock.ts -> app\\uris\\serverUris.mock.ts']);
LogBox.ignoreLogs([
'Require cycle: app\\uris\\serverUris.mock.ts -> app\\uris\\serverUris.mock.ts',
'[Reanimated] Reduced motion setting is enabled on this device.',
]);

const advancedTheme: ThemeType = {
dark: true,
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__snapshots__/Send.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ exports[`Component Send - test Send currency USD, privacy high & mode advanced -
"paddingRight": 20,
}
}
testID="send.button"
testID="send.button-disabled"
>
<View
style={
Expand Down Expand Up @@ -2220,7 +2220,7 @@ exports[`Component Send - test Send no currency, privacy normal & mode basic - s
"paddingRight": 20,
}
}
testID="send.button"
testID="send.button-disabled"
>
<View
style={
Expand Down
2 changes: 1 addition & 1 deletion components/Send/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ const Send: React.FunctionComponent<SendProps> = ({
marginBottom: 20,
}}>
<Button
testID="send.button"
testID={sendButtonEnabled ? 'send.button' : 'send.button-disabled'}
accessible={true}
accessibilityLabel={'title ' + translate('send.button')}
type={ButtonTypeEnum.Primary}
Expand Down
22 changes: 12 additions & 10 deletions e2e/send.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { log, device, by, element } = require('detox');
const { log, device, by, element, expect } = require('detox');

import { loadTestWallet } from "./e2e-utils/loadTestWallet.js";
import { loadTestWallet } from './e2e-utils/loadTestWallet.js';

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const sleep = ms => new Promise(r => setTimeout(r, ms));

describe('Renders wallet data correctly.', () => {
// i just pulled this seed out of thin air
Expand All @@ -11,32 +11,34 @@ describe('Renders wallet data correctly.', () => {
//await sleep(4000);

await element(by.text('SEND')).tap();

await element(by.id('send.scan-button')).tap();
await expect(element(by.id('scan.cancel'))).toBeVisible();
await element(by.id('scan.cancel')).tap();
});

it('adds return address to the memo if that option is selected, and correctly renders confirm screen', async () => {

await element(by.id('send.addressplaceholder')).replaceText(
'u1lx7nlnqqqs7p4hcqz4hyjgnw7h8zskcgr2f8dfhm96np0gnfdzu7jtms7q2pxd7ufy96wxzdsdy65jvp3td7fj2ltcz0jpak86ddyszl9ykn5s86q3xataya5867z3tj2x8cw0ljyrenymr2gcqmjf50gmexqj233yn3kdaxn2yukwcx87emurufakf82wapgnu5h3fvae6aw9uus2r',
);
await element(by.id('send.amount')).replaceText('0');
await element(by.id('send.checkboxUA')).tap();
await element(by.id('send.checkboxua')).tap();
await element(by.id('send.scroll-view')).scrollTo('bottom');
await element(by.id('send.memo-field')).replaceText("1\n2\n3\n4\n5\n6\n7\n8");
await element(by.id('send.memo-field')).replaceText('1\n2\n3\n4\n5\n6\n7\n8');
await element(by.id('send.scroll-view')).scrollTo('bottom');

await waitFor(element(by.id('send.button'))).toBeVisible();
await element(by.id('send.button')).tap();

await expect(element(by.id('send.confirm.scroll-view'))).toExist();
await expect(element(by.id('send.confirm.scroll-view'))).toBeVisible(20);
await element(by.id('send.confirm.scroll-view')).scrollTo('bottom');

const memo = element(by.id('send.confirm-memo'));

await expect(memo).toBeVisible(100);
await expect(memo).toHaveText(
'1\n2\n3\n4\n5\n6\n7\n8\nReply to: \nu1lx7nlnqqqs7p4hcqz4hyjgnw7h8zskcgr2f8dfhm96np0gnfdzu7jtms7q2pxd7ufy96wxzdsdy65jvp3td7fj2ltcz0jpak86ddyszl9ykn5s86q3xataya5867z3tj2x8cw0ljyrenymr2gcqmjf50gmexqj233yn3kdaxn2yukwcx87emurufakf82wapgnu5h3fvae6aw9uus2r',
);
});

});

0 comments on commit 6f6b265

Please sign in to comment.