Skip to content

Commit 115a739

Browse files
fadi-georgeclaude
andcommitted
appium: optional FID-off push run in appium-e2e, enabled input for setup-google-services
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 823c76c commit 115a739

4 files changed

Lines changed: 52 additions & 8 deletions

File tree

‎.github/actions/setup-google-services/action.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ inputs:
1212
description: 'Android package name that must have a client in the file'
1313
required: false
1414
default: 'com.onesignal.sdkdemo'
15+
enabled:
16+
description: "Set to 'false' to skip writing the file (e.g. for a build with Firebase Installation IDs off)"
17+
required: false
18+
default: 'true'
1519

1620
runs:
1721
using: composite
1822
steps:
1923
- name: Write google-services.json
24+
if: inputs.enabled == 'true'
2025
shell: bash
2126
env:
2227
GOOGLE_SERVICES_JSON: ${{ inputs.google-services-json }}

‎.github/workflows/appium-e2e.yml‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,24 @@ on:
3535
description: 'App bundle/package ID (default: com.onesignal.example)'
3636
required: false
3737
type: string
38+
fid-off-app-artifact:
39+
description: 'Optional artifact with an Android build that has Firebase Installation IDs off and no google-services.json. Runs 02_push against it in a separate session.'
40+
required: false
41+
type: string
3842

3943
jobs:
4044
e2e:
45+
name: ${{ matrix.variant == 'fid-off' && 'e2e (fid off)' || 'e2e' }}
4146
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
variant: ${{ fromJSON(inputs.fid-off-app-artifact != '' && '["default","fid-off"]' || '["default"]') }}
4251
steps:
4352
- name: Download app artifact
4453
uses: actions/download-artifact@v8
4554
with:
46-
name: ${{ inputs.app-artifact }}
55+
name: ${{ matrix.variant == 'fid-off' && inputs.fid-off-app-artifact || inputs.app-artifact }}
4756

4857
- name: Checkout sdk-shared (for test files)
4958
uses: actions/checkout@v6
@@ -86,8 +95,10 @@ jobs:
8695
PLATFORM: ${{ inputs.platform }}
8796
DEVICE: ${{ inputs.device }}
8897
OS_VERSION: ${{ inputs.os-version }}
89-
BUILD_NAME: ${{ inputs.build-name }}
98+
BUILD_NAME: ${{ inputs.build-name }}${{ matrix.variant == 'fid-off' && '-fid-off' || '' }}
9099
BUNDLE_ID: ${{ inputs.bundle-id }}
100+
E2E_VARIANT: ${{ matrix.variant == 'fid-off' && 'fid-off' || '' }}
101+
SPECS: ${{ matrix.variant == 'fid-off' && '02_push' || '' }}
91102
ONESIGNAL_APP_ID: ${{ vars.APPIUM_ONESIGNAL_APP_ID }}
92103
ONESIGNAL_API_KEY: ${{ secrets.APPIUM_ONESIGNAL_API_KEY }}
93104
# Retry only on BrowserStack session-creation failures (queue
@@ -132,6 +143,6 @@ jobs:
132143
if: always()
133144
uses: actions/upload-artifact@v7
134145
with:
135-
name: appium-results-${{ inputs.platform }}-${{ inputs.sdk-type }}
146+
name: appium-results-${{ inputs.platform }}-${{ inputs.sdk-type }}${{ matrix.variant == 'fid-off' && '-fid-off' || '' }}
136147
path: _sdk-shared/appium/results/
137148
if-no-files-found: ignore

‎appium/tests/helpers/selectors.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@ export function getPlatform(): Platform {
2222
throw new Error(`Unexpected platformName: ${name}`);
2323
}
2424

25-
export function getTestExternalId(): string {
25+
function getTestDataKey(): string {
2626
const sdk = getSdkType();
2727
const platform = getPlatform();
2828
if (sdk === platform) return sdk;
2929
return `${sdk}-${platform}`;
3030
}
3131

32+
/** Variant runs (e.g. fid-off) get their own user so parallel runs don't share or delete it. */
33+
export function getTestExternalId(): string {
34+
const key = getTestDataKey();
35+
const variant = process.env.E2E_VARIANT;
36+
return variant ? `${key}-${variant}` : key;
37+
}
38+
3239
export const TEST_DATA: Record<
3340
string,
3441
{ sms: string; email: string; customEvent: string; alias: string }
@@ -127,7 +134,7 @@ export const TEST_DATA: Record<
127134
};
128135

129136
export function getTestData() {
130-
const id = getTestExternalId();
137+
const id = getTestDataKey();
131138
const data = TEST_DATA[id];
132139
if (!data) throw new Error(`No test data for ${id}`);
133140
return data;

‎appium/wdio.shared.conf.ts‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import path from 'node:path';
2+
13
import { SuiteStats, TestStats } from '@wdio/reporter';
24
import SpecReporter from '@wdio/spec-reporter';
35
import { globSync } from 'glob';
@@ -100,6 +102,20 @@ const bstackOptions = {
100102
idleTimeout: 300,
101103
};
102104

105+
// SPECS: comma-separated spec names (e.g. "02_push") to run instead of the full suite.
106+
function selectSpecs(all: string[]): string[] {
107+
const names = (process.env.SPECS ?? '')
108+
.split(',')
109+
.map((name) => name.trim())
110+
.filter(Boolean);
111+
if (names.length === 0) return all;
112+
const selected = all.filter((file) => names.includes(path.basename(file, '.spec.ts')));
113+
if (selected.length !== names.length) {
114+
throw new Error(`SPECS has unknown entries: ${process.env.SPECS}`);
115+
}
116+
return selected;
117+
}
118+
103119
export const sharedConfig: WebdriverIO.Config = {
104120
...(isLocal ? localConnection : browserstackConnection),
105121
maxInstances: 1,
@@ -110,7 +126,11 @@ export const sharedConfig: WebdriverIO.Config = {
110126
autoXvfb: false,
111127

112128
// Pre-expand the glob so WDIO groups all specs into one runner and reuses a single Appium session (a raw glob or `--spec` flag spawns one runner per file, costing ~10-30s of iOS session setup each).
113-
specs: [globSync('tests/specs/**/*.spec.ts', { cwd: SHARED_CONF_DIR, absolute: true }).sort()],
129+
specs: [
130+
selectSpecs(
131+
globSync('tests/specs/**/*.spec.ts', { cwd: SHARED_CONF_DIR, absolute: true }).sort(),
132+
),
133+
],
114134

115135
capabilities: [],
116136

@@ -139,8 +159,9 @@ export const sharedConfig: WebdriverIO.Config = {
139159
const sdkType = process.env.SDK_TYPE;
140160
const platform = process.env.PLATFORM;
141161
if (!sdkType || !platform) return;
142-
const externalId = sdkType === platform ? sdkType : `${sdkType}-${platform}`;
143-
await deleteUser(externalId);
162+
const key = sdkType === platform ? sdkType : `${sdkType}-${platform}`;
163+
const variant = process.env.E2E_VARIANT;
164+
await deleteUser(variant ? `${key}-${variant}` : key);
144165
},
145166
};
146167

0 commit comments

Comments
 (0)