diff --git a/.detoxrc.js b/.detoxrc.js index 0d5abc361..172628e69 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -29,7 +29,7 @@ module.exports = { simulator: { type: 'ios.simulator', device: { - type: 'iPhone 15 Pro', + type: 'iPhone 14', }, }, attached: { diff --git a/.gitignore b/.gitignore index 99e9d2836..8be44d6bd 100644 --- a/.gitignore +++ b/.gitignore @@ -83,4 +83,5 @@ android/app/src/main/assets/fonts/Gilroy-Bold.ttf .metro-health-check* # Detox artifacts -artifacts \ No newline at end of file +artifacts +.detoxrc.js.bak diff --git a/Jenkinsfile b/Jenkinsfile index c24910499..ccfa43d94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,26 +19,42 @@ pipeline { } } } - // stage('Create Detox build and run end to end tests') { - // steps { - // script { - // nvm(getNodejsVersion()) { - // sh ''' - // cp env.test.json env.json - // npx react-native start & + stage('Shutdown Simulator') { + steps { + script { + def deviceUdid = "F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F" + // Check if the simulator is already shut down + def isShutdown = sh(script: "xcrun simctl list devices | grep $deviceUdid | grep -q 'Shutdown'", returnStatus: true) - // open -a Simulator --args -CurrentDeviceUDID F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F & - - // /usr/bin/xcrun simctl spawn F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F log stream --level debug --style compact --predicate 'process == "LiskQA"' & - - // yarn detox build --configuration ios.debug - // yarn detox test --configuration ios.debug --cleanup --headless --record-logs all - // kill -9 %1 - // ''' - // } - // } - // } - // } + if (isShutdown == 0) { + echo "Simulator $deviceUdid is already shut down." + } else { + // Shut down the simulator + sh "xcrun simctl shutdown $deviceUdid" + echo "Simulator $deviceUdid has been shut down." + } + } + } + } + stage('Create Detox build and run end to end tests') { + steps { + script { + nvm(getNodejsVersion()) { + sh ''' + # Install Command Line Tools + cp env.test.json env.json + npx react-native start & + xcrun simctl boot F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F + open -a Simulator --args -CurrentDeviceUDID F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F & + /usr/bin/xcrun simctl spawn F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F log stream --level debug --style compact --predicate 'process == "LiskQA"' & + yarn detox build --configuration ios.debug + yarn detox test --configuration ios.debug --cleanup --headless --record-logs all + kill -9 %1 + ''' + } + } + } + } stage('Run ESLint') { steps { nvm(getNodejsVersion()) { diff --git a/e2e/packages/SendToken.e2e.js b/e2e/packages/SendToken.e2e.js index 136c87698..a6299a311 100644 --- a/e2e/packages/SendToken.e2e.js +++ b/e2e/packages/SendToken.e2e.js @@ -39,7 +39,6 @@ describe('Send Token Screen', () => { await element(by.id('fees-breakdown-toggle')).tap(); await element(by.id('send-token-screen')).atIndex(0).swipe('up'); await expect(element(by.id('initialization-fee'))).not.toBeVisible(); - await element(by.id('next-step-button')).tap(); }); it('should show transaction summary screen', async () => { @@ -54,6 +53,9 @@ describe('Send Token Screen', () => { await element(by.id('send-token-screen')).atIndex(0).swipe('up'); await expect(element(by.id('initialization-fee'))).not.toBeVisible(); await element(by.id('next-step-button')).tap(); + await waitFor(element(by.id('transaction-summary-screen'))) + .toBeVisible() + .withTimeout(1000); await expect(element(by.id('transaction-summary-screen'))).toBeVisible(); }); @@ -100,7 +102,7 @@ describe('Send Token Screen', () => { }); // TODO: Fix cross-chain test - it.skip('should successfully send a cross-chain transaction', async () => { + it('should successfully send a cross-chain transaction', async () => { device.reloadReactNative(); await element(by.id('account-list-item')).tap(); await element(by.id('send-tokens-button')).tap(); diff --git a/src/utilities/api/APIClient.js b/src/utilities/api/APIClient.js index 6abbdc315..5193cbb55 100644 --- a/src/utilities/api/APIClient.js +++ b/src/utilities/api/APIClient.js @@ -55,7 +55,7 @@ export class APIClient { headers: finalHeaders, }; - if (this.enableCertPinning && process.env.NETWORK !== 'devnet') { + if (this.enableCertPinning && process.env.NETWORK !== 'testnet') { fetchOptions.sslPinning = { certs: ['server-cert'], }; diff --git a/update_device.sh b/update_device.sh new file mode 100755 index 000000000..4cdf8c30e --- /dev/null +++ b/update_device.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "Starting the update_device.sh script..." + +# Get the list of devices +echo "Fetching the list of devices..." +devices=$(applesimutils --list) +echo "Fetched the list of devices." + +# Extract the name and type of the first available iPhone device +echo "Extracting the name and type of the first available iPhone device..." +device_info=$(echo $devices | jq -r '.[] | select(.name | test("iPhone")) | {name: .name, type: .deviceTypeIdentifier} | @base64' | head -n 1) + +if [ -z "$device_info" ]; then + echo "Error: No iPhone device found!" + exit 1 +fi + +device_name=$(echo $device_info | base64 --decode | jq -r '.name') +device_type=$(echo $device_info | base64 --decode | jq -r '.type') +echo "Selected Device Name: $device_name" +echo "Selected Device Type: $device_type" + +# Create a backup of the .detoxrc.js file +echo "Creating a backup of the .detoxrc.js file..." +echo "Backup created as .detoxrc.js.bak." + +# Update .detoxrc.js with the new device name and type +echo "Updating .detoxrc.js with the new device name and type..." +sed -i.bak -e "s/type: 'iPhone 15 Pro'/type: '$device_name'/" -e "s/type: 'com.apple.CoreSimulator.SimDeviceType.iPhone-15-Pro'/type: '$device_type'/" .detoxrc.js +echo ".detoxrc.js has been updated." + +echo "Script execution completed."