Skip to content

Commit

Permalink
Merge pull request #4469 from clegirar/chore/upgrade-appium
Browse files Browse the repository at this point in the history
  • Loading branch information
clegirar committed Nov 16, 2022
2 parents b792746 + 0ab58cb commit b1385d0
Show file tree
Hide file tree
Showing 9 changed files with 29,440 additions and 3,893 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/ios.yml
Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ${{ matrix.runner }}
env:
E2E_TESTING_IOS_DEVICE: iPhone 11
E2E_TESTING_IOS_VERSION: 15.2
E2E_TESTING_IOS_VERSION: 15.5
CACHE_DIRS: js/android/.gomobile-cache; js/ios/.gomobile-cache; js/ios/.xcodegen-cache
strategy:
fail-fast: false
Expand Down Expand Up @@ -228,17 +228,7 @@ jobs:
-scheme "Berty AppStore" \
-destination "name=$E2E_TESTING_IOS_DEVICE"
- name: Run basic e2e test
- name: Run e2e-tests
working-directory: js
run: |
# run appium in background
npx appium &
# wait for appium to be up
sleep 5
# run test
IOS_DEVICE="$E2E_TESTING_IOS_DEVICE" \
IOS_APP=`ls -ladt1 "$HOME/Library/Developer/Xcode/DerivedData/"*"/Build/Products/AppStore Release-iphonesimulator/Berty.app" | head -n 1` \
IOS_VERSION=$E2E_TESTING_IOS_VERSION \
node e2e-tests/basic.js
# kill appium
jobs -p | grep -o -E '\s\d+\s' | xargs kill
make e2e-tests.ci-flow
26 changes: 26 additions & 0 deletions js/Makefile
Expand Up @@ -19,6 +19,10 @@ IOS_SHORT_BUNDLE_VERSION ?= $(shell echo "$(VERSION)" | cut -c2- | cut -f1 -d '-
IOS_COMMIT ?= $(shell git rev-parse HEAD)
YOLO_SUFFIX ?= Yolo

E2E_TESTING_IOS_DEVICE ?= iPhone 11
E2E_TESTING_IOS_VERSION ?= 15.5
E2E_GET_IOS_APP ?= $(shell ls -ladt1 "$(HOME)/Library/Developer/Xcode/DerivedData/"*"/Build/Products/AppStore Release-iphonesimulator/Berty.app" | head -n 1)

## Internal variables

rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
Expand Down Expand Up @@ -70,9 +74,31 @@ help:
@echo " web.build Build a production build for web"
@echo " regenerate Clean and generate Protobuf files"
@echo " test Run tests"
@echo " e2e-tests.server Run appium server"
@echo " e2e-tests.tests Run appium e2e tests"

#### Test

e2e-tests/node_modules: e2e-tests/package.json
cd e2e-tests && npm $(if $(filter $(CI), true), ci, install)
touch $@

.PHONY: e2e-tests.server
e2e-tests.server: e2e-tests/node_modules
cd e2e-tests && npx appium

.PHONY: e2e-tests.tests
e2e-tests.tests:
IOS_DEVICE="$(E2E_TESTING_IOS_DEVICE)" \
IOS_APP="$(if $(IOS_APP),$(IOS_APP),$(E2E_GET_IOS_APP))" \
IOS_VERSION="$(E2E_TESTING_IOS_VERSION)" \
node e2e-tests/basic.js

.PHONY: e2e-tests.ci-flow
e2e-tests.ci-flow: e2e-tests/node_modules
$(call check-program, npx)
npx concurrently --kill-others -n server,tests -s 'command-tests' 'make e2e-tests.server' 'sleep 30; make e2e-tests.tests'

.PHONY: test
test: node_modules
$(call check-program, yarn)
Expand Down
1 change: 0 additions & 1 deletion js/e2e-tests/basic.js
Expand Up @@ -16,7 +16,6 @@ const groupLink = `https://berty.tech/id#group/8ejngpAxnMQKGMuM2AUsuWi5BJg7m9bDN

const startAppAndCreateAccount = async caps => {
const driver = await wdio.remote({
path: '/wd/hub',
port: 4723,
capabilities: caps,
})
Expand Down
25 changes: 13 additions & 12 deletions js/e2e-tests/lib.js
Expand Up @@ -33,23 +33,24 @@ const getCapabilitiesFromEnv = () => {
case 'iOS':
return {
platformName: 'iOS',
// platformVersion: process.env.IOS_VERSION || '15.5',
deviceName: process.env.IOS_DEVICE || 'iPhone 11',
app,
automationName: 'XCUITest', // UiAutomator2, Espresso, or UiAutomator1 for Android,
simulatorStartupTimeout: 20 * 60 * 1000,
wdaLaunchTimeout: 20 * 60 * 1000,
wdaConnectionTimeout: 20 * 60 * 1000,
'appium:platformVersion': process.env.IOS_VERSION || '15.5',
'appium:deviceName': process.env.IOS_DEVICE || 'iPhone 11',
'appium:app': app,
'appium:automationName': 'XCUITest', // UiAutomator2, Espresso, or UiAutomator1 for Android,
'appium:simulatorStartupTimeout': 10 * 60 * 1000,
'appium:wdaLaunchTimeout': 10 * 60 * 1000,
'appium:wdaConnectionTimeout': 10 * 60 * 1000,
'appium:wdaStartupRetries': 4,
}
case 'Android':
return {
platformName: 'Android',
// platformVersion: '8',
deviceName: 'Android Emulator',
app,
appPackage: 'tech.berty.android.debug',
appActivity: 'tech.berty.android.MainActivity',
automationName: 'UiAutomator2',
'appium:deviceName': 'Android Emulator',
'appium:app': app,
'appium:appPackage': 'tech.berty.android.debug',
'appium:appActivity': 'tech.berty.android.MainActivity',
'appium:automationName': 'UiAutomator2',
}
default:
throw new Error(`usupported platform: ${platform}`)
Expand Down

0 comments on commit b1385d0

Please sign in to comment.