Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Fix detox failure on jenkins #2078

Open
wants to merge 25 commits into
base: release/3.0.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2f92653
:bug: Uncomment detox tests
Balanced02 Sep 29, 2023
2f6940e
:bug: Attempt using iPhone 15
Balanced02 Sep 29, 2023
b16b24a
:bug: Add script to select device
Balanced02 Sep 29, 2023
3c0a895
:bug: install jq from source
Balanced02 Sep 29, 2023
354f695
:bug: trying curl
Balanced02 Sep 29, 2023
b0e9955
:ninja: testing
Balanced02 Sep 29, 2023
552bca0
:ninja: testing
Balanced02 Sep 29, 2023
6f8af94
:ninja: testing
Balanced02 Sep 29, 2023
8313b4a
:ninja: testing
Balanced02 Sep 29, 2023
2851555
:arrow_back: revert
Balanced02 Sep 29, 2023
3a3e2e4
:arrow_right: install xcode tools
Balanced02 Sep 29, 2023
8f1d256
:arrow_left: revert
Balanced02 Sep 29, 2023
0ca185b
:arrow_right: Trying github action
Balanced02 Sep 29, 2023
4c7fe40
:arrow_right: Update node version
Balanced02 Sep 29, 2023
84368b8
:arrow_right: yarn run link
Balanced02 Sep 29, 2023
48d9704
:ninja: :fire: remove mobile protect
Balanced02 Sep 29, 2023
27e14e8
:ninja: :fire: copy test env file
Balanced02 Sep 29, 2023
60824e0
:arrow_back: Remove github actions
Balanced02 Sep 30, 2023
1b1a1c5
WIP Jenkinsfix
abhishekjalan87 Oct 11, 2023
7f5cc13
added xcrun simctl boot command in jenkinsfile
abhishekjalan87 Oct 11, 2023
a97f078
testing Shutdown/Boot Simulator error
abhishekjalan87 Nov 29, 2023
b79425b
Merge branch 'release/3.0.1' of https://github.com/LiskHQ/lisk-mobile…
Balanced02 Nov 29, 2023
a3d1831
Merge branch 'release/3.0.1' of https://github.com/LiskHQ/lisk-mobile…
Balanced02 Dec 19, 2023
f9a303b
:white_check_mark: Update certificate pinning check to testnet
Balanced02 Dec 19, 2023
ddc8feb
:white_check_mark: Update send token tests
Balanced02 Dec 19, 2023
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
2 changes: 1 addition & 1 deletion .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
simulator: {
type: 'ios.simulator',
device: {
type: 'iPhone 14 Pro',
type: 'iPhone 14',
},
},
attached: {
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ android/app/src/main/assets/fonts/Gilroy-Bold.ttf
.metro-health-check*

# Detox artifacts
artifacts
artifacts
.detoxrc.js.bak
40 changes: 20 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ 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 &

// 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('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 shutdown F084BDF1-55E5-4E4C-B4D6-70AA1DA5D41F
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abhishekjalan87, it seems we still have an error here, we might need to run this command without necessarily throwing the error if the device is already shut down
Screenshot 2023-10-20 at 13 36 00

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have fixed this issue, now it will not throw any more error if simulator is already in shutdown state.

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()) {
Expand Down
11 changes: 7 additions & 4 deletions e2e/packages/IntroScreen.e2e.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { device, element, by } from 'detox';
import { device, element, by, waitFor } from 'detox';

describe('Intro Screen', () => {
beforeAll(async () => {
await device.launchApp();
});

it('should load intro screen', async () => {
await expect(element(by.text('Send and request tokens'))).toBeVisible();
await waitFor(element(by.text('Manage accounts')))
.toBeVisible()
.withTimeout(5000);
await expect(element(by.text('Manage accounts'))).toBeVisible();
});

it('should show token transfer intro screens when swiped on', async () => {
await element(by.id('intro-screen')).swipe('left');
await expect(element(by.text('A unique avatar'))).toBeVisible();
await expect(element(by.text('Send and request tokens'))).toBeVisible();
await element(by.id('intro-screen')).swipe('left');
await expect(element(by.text('Manage blockchain application assets'))).toBeVisible();
});

it('should navigate to add account screen after intro screen', async () => {
await element(by.id('continueToAddAccountButton')).tap();
await expect(element(by.id('add-account-title')).atIndex(1)).toBeVisible();
await expect(element(by.id('add-account-title'))).toBeVisible();
});
});
16 changes: 8 additions & 8 deletions ios/Lisk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
79EFB6BD2A39221F0006FBEF /* MobileProtect.plist in Resources */ = {isa = PBXBuildFile; fileRef = 79EFB6BC2A39221F0006FBEF /* MobileProtect.plist */; };
7E342449C772440C0543475E /* libPods-LiskApp-LiskDev.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADEFA1D98EA6EED99C4BE95A /* libPods-LiskApp-LiskDev.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
A23A1AEDA1EFDCFFD8819768 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
A23A1AEDA1EFDCFFD8819768 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
CB9BAE4C26FF857E00EE1F48 /* Bridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB9BAE4B26FF857E00EE1F48 /* Bridge.swift */; };
CBD727A22A8A52DA00D33815 /* server-cert.cer in Resources */ = {isa = PBXBuildFile; fileRef = CBD727A12A8A52DA00D33815 /* server-cert.cer */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -197,7 +197,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A23A1AEDA1EFDCFFD8819768 /* BuildFile in Frameworks */,
A23A1AEDA1EFDCFFD8819768 /* (null) in Frameworks */,
6113352CBF486318C1753F84 /* libPods-LiskApp-Lisk.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1546,7 +1546,7 @@
EXCLUDED_ARCHS = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = LiskDev/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0.0;
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1575,7 +1575,7 @@
EXCLUDED_ARCHS = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = LiskDev/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0.0;
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1604,7 +1604,7 @@
EXCLUDED_ARCHS = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = LiskQA/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0.0;
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1634,7 +1634,7 @@
EXCLUDED_ARCHS = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = LiskQA/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.0.0;
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1683,7 +1683,7 @@
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -1745,7 +1745,7 @@
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -920,4 +920,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 15948ed2eab00a8ddc2910ffdc1dfbe0adacd00c

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
33 changes: 33 additions & 0 deletions update_device.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might not need this file either, I created this cause I updated my system to latest and has iPhone 15, but @ClementeSerrano and most likely Jenkins might not have this device. So, this script is to ensure it picks the first device from the system to use. Let me know your thoughts pls.

Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree


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."