@sungen/driver-mobile 3.2.24 → 3.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sungen/driver-mobile",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.25",
|
|
4
4
|
"description": "Sungen mobile platform driver (Appium / WebdriverIO) — gesture vocabulary, mobile selector strategies, viewpoint gate, and the WDIO runner. Plugs into @sun-asterisk/sungen via the capability SPI.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "eqe team (engineer & quality) — Sun Asterisk",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@sun-asterisk/sungen": "3.2.
|
|
16
|
+
"@sun-asterisk/sungen": "3.2.25",
|
|
17
17
|
"@wdio/appium-service": "^9.0.0",
|
|
18
18
|
"@wdio/cli": "^9.0.0",
|
|
19
19
|
"@wdio/local-runner": "^9.0.0",
|
|
@@ -7,7 +7,39 @@
|
|
|
7
7
|
* Mobile-only: on a web project these hit the missing-template guard (SG-E020) and fail
|
|
8
8
|
* loud, same policy as every gesture.
|
|
9
9
|
*/
|
|
10
|
-
import { StepPattern } from '@sun-asterisk/sungen';
|
|
10
|
+
import { StepPattern, ParsedStep, PatternContext, StepTemplateData } from '@sun-asterisk/sungen';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The app-lifecycle templates all resolve the target app through `__resolveAppId()`, a helper the
|
|
14
|
+
* appium test-file template emits ONLY when the feature declares its app id:
|
|
15
|
+
*
|
|
16
|
+
* Feature: plan-list
|
|
17
|
+
* Path: com.example.app/.MainActivity | com.example.app
|
|
18
|
+
*
|
|
19
|
+
* Without that line the spec compiled clean, warned nothing, and then died at runtime with
|
|
20
|
+
* `ReferenceError: __resolveAppId is not defined` — taking the WHOLE spec down, not the one step,
|
|
21
|
+
* because the failure lands in a before hook. (Field case: a mobile unit scaffolded with the nav
|
|
22
|
+
* recipe in `--path` instead of `--reach`, so Path never carried an app id.)
|
|
23
|
+
*
|
|
24
|
+
* Refusing here converts that into a compile-time message naming the missing line.
|
|
25
|
+
*/
|
|
26
|
+
const requiresAppId = (
|
|
27
|
+
step: ParsedStep, context: PatternContext, verb: string
|
|
28
|
+
): StepTemplateData | null => {
|
|
29
|
+
if (context.featurePath) return null;
|
|
30
|
+
const reason =
|
|
31
|
+
`${verb} needs the app id: the mobile lifecycle steps resolve the target app from the feature's `
|
|
32
|
+
+ `Path, and this feature declares none, so the generated helper would be missing and the whole `
|
|
33
|
+
+ `spec would fail at runtime. Add it under the Feature line, e.g. `
|
|
34
|
+
+ `Path: com.example.app/.MainActivity | com.example.app (for a mobile unit, --path carries the `
|
|
35
|
+
+ `APP ID and --reach carries the navigation recipe).`;
|
|
36
|
+
context.diagnostics?.add('SG-E024', reason, { feature: context.featureName, step: step.text });
|
|
37
|
+
return {
|
|
38
|
+
templateName: 'lifecycle-missing-app-id',
|
|
39
|
+
data: { reason },
|
|
40
|
+
comment: `${verb} without a Path app id — see SG-E024`,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
11
43
|
|
|
12
44
|
export const lifecyclePatterns: StepPattern[] = [
|
|
13
45
|
{
|
|
@@ -15,7 +47,8 @@ export const lifecyclePatterns: StepPattern[] = [
|
|
|
15
47
|
// present — `tap [Restart Button]` belongs to the tap pattern, not here.
|
|
16
48
|
name: 'restart-app',
|
|
17
49
|
matcher: (step) => /\brestart(s)?\b/i.test(step.text) && /\bapp\b/i.test(step.text) && !step.selectorRef,
|
|
18
|
-
resolver: () => (
|
|
50
|
+
resolver: (step, context) => requiresAppId(step, context, 'restart the app')
|
|
51
|
+
?? { templateName: 'restart-app-action', data: {}, comment: 'Restart the app (kill → relaunch → settle)' },
|
|
19
52
|
priority: 16,
|
|
20
53
|
},
|
|
21
54
|
{
|
|
@@ -23,7 +56,8 @@ export const lifecyclePatterns: StepPattern[] = [
|
|
|
23
56
|
// (appium:app); the template fails loud with the fix when the cap is absent.
|
|
24
57
|
name: 'reinstall-app',
|
|
25
58
|
matcher: (step) => /\bre-?install(s)?\b/i.test(step.text) && /\bapp\b/i.test(step.text) && !step.selectorRef,
|
|
26
|
-
resolver: () => (
|
|
59
|
+
resolver: (step, context) => requiresAppId(step, context, 'reinstall the app')
|
|
60
|
+
?? { templateName: 'reinstall-app-action', data: {}, comment: 'Reinstall the app (remove → install → launch)' },
|
|
27
61
|
priority: 16,
|
|
28
62
|
},
|
|
29
63
|
{
|