Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mojganii committed Oct 28, 2024
1 parent a4a1c04 commit 979e6f3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 87 deletions.
89 changes: 37 additions & 52 deletions .github/actions/build-ios-e2e-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,62 @@
---
name: Build iOS end-to-end tests action
description: Prepares and builds end-to-end tests on an iOS device
name: 'Build iOS end to end tests action'
description: 'Prepares and builds end to end tests on iOS device'
inputs:
ios_device_pin_code:
description: iOS Device Pin Code
description: 'iOS Device Pin Code'
required: true
test_device_identifier_uuid:
description: Test Device Identifier UUID
description: 'Test Device Identifier UUID'
required: true
has_time_account_number:
description: Has Time Account Number
description: 'Has Time Account Number'
required: true
no_time_account_number:
description: No Time Account Number
description: 'No Time Account Number'
required: true
test_device_udid:
description: Test Device UDID
description: 'Test Device UDID'
required: true
partner_api_token:
description: Partner API Token
description: 'Partner API Token'
required: true
test_name:
description: Test case/suite name. Will run all tests in the test plan if not provided.
description: 'Test case/suite name. Will run all tests in the test plan if not provided.'
required: false
outputs_path:
description: Path to store outputs. This should be unique for each job run in order to avoid concurrency issues.
description: 'Path to store outputs. This should be unique for each job run in order to avoid concurrency issues.'
required: true
base_directory:
description: Base directory for the working paths. Defaults to the current directory (".").
required: false
default: ''

runs:
using: composite
using: 'composite'
steps:
- name: Set working-directory or default
id: set-working-directory
run: |
if [ -z "${{ inputs.base_directory }}" ]; then
echo "base_directory=" >> $GITHUB_ENV
else
echo "base_directory=${{ inputs.base_directory }}" >> $GITHUB_ENV
fi
shell: bash

- name: Configure Xcode project
run: |
for file in *.xcconfig.template; do cp $file ${file//.template/}; done
sed -i "" "/^HAS_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
sed -i "" "/^NO_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
sed -i "" \
"/IOS_DEVICE_PIN_CODE =/ s/= .*/= $IOS_DEVICE_PIN_CODE/" \
UITests.xcconfig
sed -i "" \
"/TEST_DEVICE_IDENTIFIER_UUID =/ s/= .*/= $TEST_DEVICE_IDENTIFIER_UUID/" \
UITests.xcconfig
sed -i "" \
"s#^// PARTNER_API_TOKEN =#PARTNER_API_TOKEN =#" \
UITests.xcconfig
sed -i "" \
"/PARTNER_API_TOKEN =/ s#= .*#= $PARTNER_API_TOKEN#" \
UITests.xcconfig
sed -i "" \
"/ATTACH_APP_LOGS_ON_FAILURE =/ s#= .*#= 1#" \
UITests.xcconfig
sed -i "" \
"/TEST_DEVICE_IS_IPAD =/ s#= .*#= 0#" \
UITests.xcconfig
sed -i "" \
"/UNINSTALL_APP_IN_TEST_SUITE_TEAR_DOWN =/ s#= .*#= 0#" \
UITests.xcconfig
for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done
sed -i "" "/^HAS_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
sed -i "" "/^NO_TIME_ACCOUNT_NUMBER/d" UITests.xcconfig
sed -i "" \
"/IOS_DEVICE_PIN_CODE =/ s/= .*/= $IOS_DEVICE_PIN_CODE/" \
UITests.xcconfig
sed -i "" \
"/TEST_DEVICE_IDENTIFIER_UUID =/ s/= .*/= $TEST_DEVICE_IDENTIFIER_UUID/" \
UITests.xcconfig
sed -i "" \
"s#^// PARTNER_API_TOKEN =#PARTNER_API_TOKEN =#" \
UITests.xcconfig
sed -i "" \
"/PARTNER_API_TOKEN =/ s#= .*#= $PARTNER_API_TOKEN#" \
UITests.xcconfig
sed -i "" \
"/ATTACH_APP_LOGS_ON_FAILURE =/ s#= .*#= 1#" \
UITests.xcconfig
sed -i "" \
"/TEST_DEVICE_IS_IPAD =/ s#= .*#= 0#" \
UITests.xcconfig
sed -i "" \
"/UNINSTALL_APP_IN_TEST_SUITE_TEAR_DOWN =/ s#= .*#= 0#" \
UITests.xcconfig
shell: bash
working-directory: ${{ env.base_directory }}/ios/Configurations
working-directory: ios/Configurations
env:
IOS_DEVICE_PIN_CODE: ${{ inputs.ios_device_pin_code }}
TEST_DEVICE_IDENTIFIER_UUID: ${{ inputs.test_device_identifier_uuid }}
Expand All @@ -94,7 +79,7 @@ runs:
-derivedDataPath derived-data \
clean build-for-testing 2>&1
shell: bash
working-directory: ${{ env.base_directory }}/ios/
working-directory: ios/
env:
TEST_DEVICE_UDID: ${{ inputs.test_device_udid }}
TEST_NAME: ${{ inputs.test_name }}
50 changes: 15 additions & 35 deletions .github/actions/run-ios-e2e-tests/action.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,36 @@
---
name: Run iOS end-to-end tests action
description: Runs end-to-end tests on iOS device
name: 'Run iOS end to end tests action'
description: 'Runs end to end tests on iOS device'
inputs:
test_name:
description: Test case/suite name. Will run all tests in the test plan if not provided.
description: 'Test case/suite name. Will run all tests in the test plan if not provided.'
required: false
test_device_udid:
description: Test Device UDID
description: 'Test Device UDID'
required: true
outputs_path:
description: >
Path to where outputs are stored - both build outputs and outputs
from running tests. This should be unique for each job run in order to
avoid concurrency issues.
Path to where outputs are stored - both build outputs and outputs from running tests.
This should be unique for each job run in order to avoid concurrency issues.
required: true
base_directory:
description: Base directory for the working paths.
required: false
default: ''

runs:
using: composite
using: 'composite'
steps:
- name: Set base directory or default
id: set-base-directory
run: |
if [ -z "${{ inputs.base_directory }}" ]; then
echo "base_directory=" >> $GITHUB_ENV
else
echo "base_directory=${{ inputs.base_directory }}" >> $GITHUB_ENV
fi
shell: bash

# Set up a unique output directory
- name: Set up outputs directory
run: |
# Forcing the filesystem buffers to be flushed to ensure the
# directory tree is updated
sync
if [ -n "$TEST_NAME" ]; then
# Strip slashes to avoid creating subdirectories
test_name_sanitized=$(printf "$TEST_NAME" | sed 's/\//_/g')
echo "Setting output directory: tests-output-$test_name_sanitized"
test_output_directory="${{ inputs.outputs_path }}/tests-output-$test_name_sanitized"
echo "Setting output directory tests-output-test-name-sanitized"
echo "$test_name_sanitized"
test_output_directory="${{ env.OUTPUTS_PATH }}/tests-output-$test_name_sanitized"
else
echo "Setting output directory: tests-output"
test_output_directory="${{ inputs.outputs_path }}/tests-output"
echo "Setting output directory output"
test_output_directory="${{ env.OUTPUTS_PATH }}/tests-output"
fi
echo "TEST_OUTPUT_DIRECTORY=$test_output_directory" >> $GITHUB_ENV
Expand All @@ -56,26 +41,21 @@ runs:
OUTPUTS_PATH: ${{ inputs.outputs_path }}

- name: Uninstall app
run: |
echo "Uninstalling app from device with UDID: $TEST_DEVICE_UDID"
ios-deploy --id $TEST_DEVICE_UDID --uninstall_only --bundle_id net.mullvad.MullvadVPN
run: ios-deploy --id $TEST_DEVICE_UDID --uninstall_only --bundle_id net.mullvad.MullvadVPN
shell: bash
env:
TEST_DEVICE_UDID: ${{ inputs.test_device_udid }}

- name: Run end-to-end tests
- name: Run end-to-end-tests
run: |
# Forcing the filesystem buffers to be flushed to ensure the
# directory tree is updated
sync
if [ -n "$TEST_NAME" ]; then
TEST_NAME_ARGUMENT=" -only-testing $TEST_NAME"
else
TEST_NAME_ARGUMENT=""
fi
echo "Running end-to-end tests in directory: ${{ env.base_directory }}/mullvadvpn-app/ios"
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
-project MullvadVPN.xcodeproj \
-scheme MullvadVPNUITests \
Expand Down

0 comments on commit 979e6f3

Please sign in to comment.