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

Fix detox failure on jenkins #2064

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 18 additions & 17 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,27 @@ 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('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 &

// open -a Simulator --args -CurrentDeviceUDID 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"' &
/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
// '''
// }
// }
// }
// }
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

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