Fix: Env variabled to pick up right simulator device for tests (#8367)

This commit is contained in:
yasserfaraazkhan 2024-11-29 11:48:35 +05:30 committed by GitHub
parent 7cb2ee75b3
commit acfccb170f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 10 deletions

View file

@ -42,12 +42,12 @@ on:
description: "iPhone simulator name"
required: false
type: string
default: "iPhone 14"
default: "iPhone 15 Pro"
ios_device_os_name:
description: "iPhone simulator OS version"
required: false
type: string
default: "iOS 17.0"
default: "iOS 17.4"
low_bandwidth_mode:
description: "Enable low bandwidth mode"
required: false
@ -66,8 +66,8 @@ env:
ADMIN_EMAIL: ${{ secrets.MM_MOBILE_E2E_ADMIN_EMAIL }}
ADMIN_USERNAME: ${{ secrets.MM_MOBILE_E2E_ADMIN_USERNAME }}
ADMIN_PASSWORD: ${{ secrets.MM_MOBILE_E2E_ADMIN_PASSWORD }}
# BRANCH: ${{ github.head_ref || github.ref_name }}
# COMMIT_HASH: ${{ github.sha }}
BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
COMMIT_HASH: ${{ github.sha }}
DEVICE_NAME: ${{ inputs.ios_device_name }}
DEVICE_OS_VERSION: ${{ inputs.ios_device_os_name }}
DETOX_AWS_S3_BUCKET: "mattermost-detox-report"
@ -195,7 +195,6 @@ jobs:
DETOX_OS_VERSION: ${{ env.DEVICE_OS_VERSION }}
LOW_BANDWIDTH_MODE: ${{ inputs.low_bandwidth_mode }}
- name: reset network settings
if: ${{ inputs.low_bandwidth_mode || failure() }}
run: |

View file

@ -30,8 +30,8 @@
"ios.simulator": {
"type": "ios.simulator",
"device": {
"type": "__DEVICE_TYPE__",
"os": "__DEVICE_OS__"
"type": "__DEVICE_NAME__",
"os": "__DEVICE_OS_VERSION__"
}
},
"android.emulator": {

View file

@ -4,10 +4,10 @@
/* eslint-disable no-process-env */
/* eslint-disable no-console */
const fs = require('fs');
const deviceType = process.env.DETOX_DEVICE_TYPE || 'iPhone 15 Pro';
const deviceOS = process.env.DETOX_DEVICE_OS || 'iOS 17.4';
const deviceName = process.env.DEVICE_NAME || 'iPhone 15 Pro';
const deviceOSVersion = process.env.DEVICE_OS_VERSION || 'iOS 17.4';
const detoxConfigTemplate = fs.readFileSync('../.detoxrc.json', 'utf8');
const detoxConfig = detoxConfigTemplate.replace('__DEVICE_TYPE__', deviceType).replace('__DEVICE_OS__', deviceOS);
const detoxConfig = detoxConfigTemplate.replace('__DEVICE_NAME__', deviceName).replace('__DEVICE_OS_VERSION__', deviceOSVersion);
fs.writeFileSync('../.detoxrc.json', detoxConfig);