diff --git a/e2e/src/QRScanner.spec.js b/e2e/src/QRScanner.spec.js index a63e27858a0..46b4f89b172 100644 --- a/e2e/src/QRScanner.spec.js +++ b/e2e/src/QRScanner.spec.js @@ -1,54 +1,52 @@ import { reloadReactNative } from './utils/retries' import { quickOnboarding, waitForElementById } from './utils/utils' +const verifyCamera = async () => { + // testID 'Camera' is one of the few that works on Android. iOS uses 'CameraScanInfo' because the camera is behind an opacity overlay + device.getPlatform() === 'ios' + ? await waitForElementById('CameraScanInfo') + : await waitForElementById('Camera') +} + describe('Given QR Scanner', () => { beforeAll(async () => { await quickOnboarding() + await reloadReactNative() }) describe('When opening QR scanner', () => { it('Then should display QR code', async () => { - await reloadReactNative() - await waitForElementById('HomeAction-Receive') - await element(by.id('HomeAction-Receive')).tap() + await waitForElementById('HomeAction-Receive', { tap: true }) await waitForElementById('QRCode') - await expect(element(by.id('QRCode'))).toBeVisible() }) it('Then should be able to toggle camera', async () => { - await waitForElementById('Scan') - await element(by.id('Scan')).tap() - await waitForElementById('CameraScanInfo') - await expect(element(by.id('CameraScanInfo'))).toBeVisible() + await waitForElementById('Scan', { tap: true }) + await verifyCamera() }) it('Then should be able to toggle to QR code', async () => { - await waitForElementById('My Code') - await element(by.id('My Code')).tap() + await waitForElementById('My Code', { tap: true }) await waitForElementById('QRCode') - await expect(element(by.id('QRCode'))).toBeVisible() }) it('Then should be able to close QR code scanner', async () => { - await waitForElementById('Times') - await element(by.id('Times')).tap() + await waitForElementById('Times', { tap: true }) await waitForElementById('HomeAction-Send') - await expect(element(by.id('HomeAction-Send'))).toBeVisible() }) }) describe("When 'scanning' QR", () => { beforeEach(async () => { await reloadReactNative() - await waitForElementById('HomeAction-Receive') - await element(by.id('HomeAction-Receive')).tap() - await waitForElementById('Scan') - await element(by.id('Scan')).tap() - await waitForElementById('CameraScanInfo') - await element(by.id('CameraScanInfo')).tap() + await waitForElementById('HomeAction-Receive', { tap: true }) + await waitForElementById('Scan', { tap: true }) + await verifyCamera() }) it('Then should be able to handle Celo pay QR', async () => { + // Use instead of waitForElementById as the element is not visible behind opacity overlay + await element(by.id('CameraScanInfo')).tap() await waitForElementById('ManualInput') await element(by.id('ManualInput')).replaceText( 'celo://wallet/pay?address=0xe5F5363e31351C38ac82DBAdeaD91Fd5a7B08846' @@ -62,6 +60,8 @@ describe('Given QR Scanner', () => { }) it('Then should handle address only QR', async () => { + // Use instead of waitForElementById as the element is not visible behind opacity overlay + await element(by.id('CameraScanInfo')).tap() await waitForElementById('ManualInput') await element(by.id('ManualInput')).replaceText('0xe5F5363e31351C38ac82DBAdeaD91Fd5a7B08846') await waitForElementById('ManualSubmit') diff --git a/package.json b/package.json index ec742de6507..8c15fa63343 100644 --- a/package.json +++ b/package.json @@ -232,7 +232,7 @@ "babel-jest": "^29.2.1", "babel-plugin-module-resolver": "^4.1.0", "chalk": "^4.0.0", - "detox": "^20.18.5", + "detox": "^20.28.0", "dotenv": "^16.3.1", "easy-table": "^1.2.0", "escape-string-regexp": "^1.0.5", diff --git a/yarn.lock b/yarn.lock index 9fc1ba0ae9b..bd33431e195 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6945,10 +6945,15 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== -detox@^20.18.5: - version "20.20.3" - resolved "https://registry.yarnpkg.com/detox/-/detox-20.20.3.tgz#c39470523b1a75c4dc895666c5d749978978e42e" - integrity sha512-sca2z+6SYnA5+9jF1pf/t4RBOcvnBO0vmsTtrmnpej76Q5rhX0acZpFbDgvQQPGKu/TDdH+KFYK0tQ2VrTNY1w== +detox-copilot@^0.0.24: + version "0.0.24" + resolved "https://registry.yarnpkg.com/detox-copilot/-/detox-copilot-0.0.24.tgz#e505073866d1f4ff00641f2e48ef441a4dff6bbc" + integrity sha512-42g0QyJS31URl28YRxc4hGozSXhbbB1sKwzxEjZR9WtLoSx6WYDsQkQD8+yP5t1NExiSCZAfvNmBw8PYQwDKwg== + +detox@^20.28.0: + version "20.28.0" + resolved "https://registry.yarnpkg.com/detox/-/detox-20.28.0.tgz#7ae848e8df028c17d65cd0672040cd1c18338b25" + integrity sha512-JeUkWNnYE7lqby3S9AeYJP3ttCBKH+qZWACjWXwvSbe3tm6JeXvecVUYkzSoNfC4IzTX5p+rWvG0IPsfOsZSFw== dependencies: ajv "^8.6.3" bunyan "^1.8.12" @@ -6956,13 +6961,14 @@ detox@^20.18.5: caf "^15.0.1" chalk "^4.0.0" child-process-promise "^2.2.0" + detox-copilot "^0.0.24" execa "^5.1.1" find-up "^5.0.0" fs-extra "^11.0.0" funpermaproxy "^1.1.0" glob "^8.0.3" ini "^1.3.4" - jest-environment-emit "^1.0.5" + jest-environment-emit "^1.0.8" json-cycle "^1.3.0" lodash "^4.17.11" multi-sort-stream "^1.0.3" @@ -9611,10 +9617,10 @@ jest-each@^29.6.3: jest-util "^29.6.3" pretty-format "^29.6.3" -jest-environment-emit@^1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/jest-environment-emit/-/jest-environment-emit-1.0.7.tgz#14c2197e9fa48affa25b15fc5f4a74690aea7efd" - integrity sha512-/0AYqbL3zrfRTtGyzTZwgRxQZiDXEM8ZUfY7Uscla/XGs9vszx4f0XTSZqAk3CQaiwYAoKvFZkB2vSKm1Q08fQ== +jest-environment-emit@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/jest-environment-emit/-/jest-environment-emit-1.0.8.tgz#ab0dad2c1dd04d3ca092762a99080607b0eef10b" + integrity sha512-WNqvxBLH0yNojHJQ99Y21963aT7UTavxV3PgiBQFi8zwrlnKU6HvkB6LOvQrbk5I8mI8JEKvcoOrQOvBVMLIXQ== dependencies: bunyamin "^1.5.2" bunyan "^2.0.5"