openuispec 0.2.3 → 0.2.4
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/README.md +42 -3
- package/cli/init.ts +2 -0
- package/examples/social-app/AGENTS.md +1 -1
- package/examples/social-app/CLAUDE.md +1 -1
- package/examples/social-app/generated/android/social-app/app/.paparazzi-hashes.json +3 -0
- package/examples/social-app/generated/android/social-app/app/build.gradle.kts +2 -0
- package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/HomeFeedScreen.kt +12 -0
- package/examples/social-app/generated/android/social-app/app/src/test/kotlin/com/social/app/screenshots/HomeFeedScreenshotTest.kt +34 -0
- package/examples/social-app/generated/android/social-app/build.gradle.kts +1 -0
- package/examples/social-app/generated/android/social-app/gradle/libs.versions.toml +2 -0
- package/examples/social-app/generated/android/social-app/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/social-app/generated/android/social-app/gradlew +239 -16
- package/examples/social-app/generated/android/social-app/settings.gradle.kts +4 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/.screenshot-uitest/Sources/ScreenshotUITest.swift +36 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/project.pbxproj +204 -212
- package/examples/todo-orbit/generated/ios/Todo Orbit/project.yml +1 -0
- package/mcp-server/index.ts +64 -1
- package/mcp-server/screenshot-android.ts +462 -0
- package/mcp-server/screenshot-ios.ts +541 -0
- package/mcp-server/screenshot-shared.ts +200 -0
- package/mcp-server/screenshot.ts +15 -1
- package/package.json +3 -2
- package/examples/todo-orbit/generated/ios/Todo Orbit/TodoOrbit.xcodeproj/xcshareddata/xcschemes/TodoOrbit.xcscheme +0 -79
package/README.md
CHANGED
|
@@ -123,10 +123,40 @@ Or run directly: `openuispec mcp`
|
|
|
123
123
|
| `openuispec_get_contract` | Incremental edits | Get a single contract spec, optionally filtered to one variant |
|
|
124
124
|
| `openuispec_get_tokens` | Incremental edits | Get tokens for a specific category (color, typography, spacing, etc.) |
|
|
125
125
|
| `openuispec_get_locale` | Incremental edits | Get a single locale file, optionally filtered to specific keys |
|
|
126
|
-
| `openuispec_screenshot` | Visual verification |
|
|
126
|
+
| `openuispec_screenshot` | Visual verification | Screenshot the web app at a route via headless browser (requires `puppeteer`) |
|
|
127
|
+
| `openuispec_screenshot_android` | Visual verification | Screenshot Android app on emulator — builds APK, installs, captures via adb. Works with any Android project via `project_dir` param |
|
|
128
|
+
| `openuispec_screenshot_ios` | Visual verification | Screenshot iOS app on Simulator — builds with xcodebuild, captures via XCUITest. Works with any iOS project via `project_dir` param |
|
|
127
129
|
|
|
128
130
|
The server includes **protocol-level instructions** that trigger on UI-related requests independently of CLAUDE.md rules — so even if CLAUDE.md is buried under other project rules, the MCP enforcement still works.
|
|
129
131
|
|
|
132
|
+
### Visual verification
|
|
133
|
+
|
|
134
|
+
The screenshot tools work with **any** Android/iOS/web project — they don't require an OpenUISpec manifest. Use `project_dir` to point directly at a project root:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
# With OpenUISpec manifest (auto-discovers generated app)
|
|
138
|
+
openuispec_screenshot_android(screen: "home")
|
|
139
|
+
|
|
140
|
+
# Standalone — any Android project
|
|
141
|
+
openuispec_screenshot_android(project_dir: "/path/to/android/project", screen: "home")
|
|
142
|
+
|
|
143
|
+
# Standalone — any iOS project
|
|
144
|
+
openuispec_screenshot_ios(project_dir: "/path/to/ios/project", scheme: "MyApp")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Additional override params:
|
|
148
|
+
|
|
149
|
+
| Param | Android | iOS | Purpose |
|
|
150
|
+
|-------|---------|-----|---------|
|
|
151
|
+
| `project_dir` | yes | yes | Skip manifest, point directly at project root |
|
|
152
|
+
| `module` | yes | — | Override app module name (default: auto-detect from `settings.gradle`) |
|
|
153
|
+
| `scheme` | — | yes | Override Xcode scheme (default: auto-detect) |
|
|
154
|
+
| `bundle_id` | — | yes | Override bundle ID (default: auto-detect from `project.pbxproj`) |
|
|
155
|
+
|
|
156
|
+
Auto-detection features:
|
|
157
|
+
- **Android**: Scans `settings.gradle.kts`/`.gradle` to find the module with `com.android.application` plugin. Supports both Kotlin DSL and Groovy DSL.
|
|
158
|
+
- **iOS**: Reads deployment target from `project.pbxproj`. For navigation screenshots, generates an XCUITest project via xcodegen — works with both xcodegen-managed and standalone Xcode projects.
|
|
159
|
+
|
|
130
160
|
## Using without MCP
|
|
131
161
|
|
|
132
162
|
You can also use OpenUISpec with any AI by providing context manually:
|
|
@@ -191,8 +221,17 @@ openuispec/
|
|
|
191
221
|
│ ├── index.ts # Entry point
|
|
192
222
|
│ └── init.ts # Project scaffolding + AI rules
|
|
193
223
|
├── mcp-server/ # MCP server (openuispec-mcp)
|
|
194
|
-
│ ├── index.ts # Stdio transport,
|
|
195
|
-
│
|
|
224
|
+
│ ├── index.ts # Stdio transport, 15 tools
|
|
225
|
+
│ ├── screenshot.ts # Dev server + headless browser screenshot (web)
|
|
226
|
+
│ ├── screenshot-shared.ts # Shared utilities for platform screenshot tools
|
|
227
|
+
│ ├── screenshot-android.ts # Android screenshot via emulator (adb screencap)
|
|
228
|
+
│ └── screenshot-ios.ts # iOS screenshot via Simulator (xcodebuild + XCUITest)
|
|
229
|
+
├── scripts/
|
|
230
|
+
│ └── take-all-screenshots.ts # Batch screenshot capture for all example projects
|
|
231
|
+
├── artifacts/ # Screenshot artifacts from generated apps
|
|
232
|
+
│ ├── social-app/screenshots/ # Web + Android screenshots
|
|
233
|
+
│ ├── todo-orbit/screenshots/ # Web + Android + iOS screenshots
|
|
234
|
+
│ └── taskflow/screenshots/ # Web + Android + iOS screenshots
|
|
196
235
|
├── check/ # Composite validation command
|
|
197
236
|
│ └── index.ts # Schema + semantic + readiness
|
|
198
237
|
├── drift/ # Drift detection (spec change tracking)
|
package/cli/init.ts
CHANGED
|
@@ -283,6 +283,8 @@ When the openuispec MCP server is configured, AI assistants should use these too
|
|
|
283
283
|
| \`openuispec_get_tokens\` | Get tokens for a specific category (color, typography, spacing, etc.). |
|
|
284
284
|
| \`openuispec_get_locale\` | Get a single locale file, optionally filtered to specific keys. |
|
|
285
285
|
| \`openuispec_screenshot\` | Take a screenshot of the generated web app at a route (requires \`puppeteer\`). |
|
|
286
|
+
| \`openuispec_screenshot_android\` | Take screenshots of the generated Android app on an emulator (requires running emulator). |
|
|
287
|
+
| \`openuispec_screenshot_ios\` | Take screenshots of the generated iOS app using swift-snapshot-testing (requires Xcode + Simulator). |
|
|
286
288
|
|
|
287
289
|
## CLI commands
|
|
288
290
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
plugins {
|
|
2
|
+
id("app.cash.paparazzi")
|
|
2
3
|
alias(libs.plugins.android.application)
|
|
3
4
|
alias(libs.plugins.compose.compiler)
|
|
4
5
|
kotlin("plugin.serialization")
|
|
@@ -89,4 +90,5 @@ dependencies {
|
|
|
89
90
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
|
90
91
|
debugImplementation(libs.androidx.ui.tooling)
|
|
91
92
|
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
|
93
|
+
|
|
92
94
|
}
|
|
@@ -28,6 +28,7 @@ import androidx.compose.runtime.setValue
|
|
|
28
28
|
import androidx.compose.runtime.snapshotFlow
|
|
29
29
|
import androidx.compose.ui.Modifier
|
|
30
30
|
import androidx.compose.ui.res.stringResource
|
|
31
|
+
import androidx.compose.ui.tooling.preview.Preview
|
|
31
32
|
import com.social.app.R
|
|
32
33
|
import com.social.app.data.MockData
|
|
33
34
|
import com.social.app.ui.components.ChipOption
|
|
@@ -155,3 +156,14 @@ fun HomeFeedScreen(
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
}
|
|
159
|
+
|
|
160
|
+
@Preview(showBackground = true)
|
|
161
|
+
@Composable
|
|
162
|
+
fun HomeFeedScreenPreview() {
|
|
163
|
+
MaterialTheme {
|
|
164
|
+
HomeFeedScreen(
|
|
165
|
+
onPostClick = {},
|
|
166
|
+
onUserClick = {},
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
package com.social.app.screenshots
|
|
2
|
+
|
|
3
|
+
import app.cash.paparazzi.DeviceConfig
|
|
4
|
+
import app.cash.paparazzi.Paparazzi
|
|
5
|
+
import org.junit.Rule
|
|
6
|
+
import org.junit.Test
|
|
7
|
+
import com.social.app.ui.screens.*
|
|
8
|
+
import kotlinx.coroutines.Dispatchers
|
|
9
|
+
import kotlinx.coroutines.test.setMain
|
|
10
|
+
import kotlinx.coroutines.test.resetMain
|
|
11
|
+
import org.junit.After
|
|
12
|
+
import org.junit.Before
|
|
13
|
+
|
|
14
|
+
class HomeFeedScreenshotTest {
|
|
15
|
+
@get:Rule
|
|
16
|
+
val paparazzi = Paparazzi(deviceConfig = DeviceConfig.PIXEL_5)
|
|
17
|
+
|
|
18
|
+
@Before
|
|
19
|
+
fun setUp() {
|
|
20
|
+
Dispatchers.setMain(Dispatchers.Unconfined)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@After
|
|
24
|
+
fun tearDown() {
|
|
25
|
+
Dispatchers.resetMain()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Test
|
|
29
|
+
fun homeFeedScreenPreview() {
|
|
30
|
+
paparazzi.snapshot {
|
|
31
|
+
HomeFeedScreenPreview()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
[versions]
|
|
2
|
+
paparazzi = "2.0.0-alpha04"
|
|
2
3
|
agp = "9.1.0"
|
|
3
4
|
kotlin = "2.3.0"
|
|
4
5
|
coreKtx = "1.18.0"
|
|
@@ -43,6 +44,7 @@ androidx-datastore-preferences = { group = "androidx.datastore", name = "datasto
|
|
|
43
44
|
androidx-datastore-core = { group = "androidx.datastore", name = "datastore-core", version.ref = "datastore" }
|
|
44
45
|
|
|
45
46
|
[plugins]
|
|
47
|
+
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }
|
|
46
48
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
|
47
49
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
|
48
50
|
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
|
Binary file
|
|
@@ -1,25 +1,248 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
3
|
+
#
|
|
4
|
+
# Copyright © 2015 the original authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
19
|
+
#
|
|
7
20
|
|
|
8
|
-
|
|
21
|
+
##############################################################################
|
|
22
|
+
#
|
|
23
|
+
# Gradle start up script for POSIX generated by Gradle.
|
|
24
|
+
#
|
|
25
|
+
# Important for running:
|
|
26
|
+
#
|
|
27
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
28
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
|
29
|
+
# bash, then to run this script, type that shell name before the whole
|
|
30
|
+
# command line, like:
|
|
31
|
+
#
|
|
32
|
+
# ksh Gradle
|
|
33
|
+
#
|
|
34
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
35
|
+
# requires all of these POSIX shell features:
|
|
36
|
+
# * functions;
|
|
37
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
38
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
39
|
+
# * compound commands having a testable exit status, especially «case»;
|
|
40
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
|
41
|
+
#
|
|
42
|
+
# Important for patching:
|
|
43
|
+
#
|
|
44
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
45
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
46
|
+
#
|
|
47
|
+
# The "traditional" practice of packing multiple parameters into a
|
|
48
|
+
# space-separated string is a well documented source of bugs and security
|
|
49
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
50
|
+
# options in "$@", and eventually passing that to Java.
|
|
51
|
+
#
|
|
52
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
53
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
54
|
+
# see the in-line comments for details.
|
|
55
|
+
#
|
|
56
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
57
|
+
# Darwin, MinGW, and NonStop.
|
|
58
|
+
#
|
|
59
|
+
# (3) This script is generated from the Groovy template
|
|
60
|
+
# https://github.com/gradle/gradle/blob/b5fe9efed6cae7b9f2fbdb2d380fb69af16bb752/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
61
|
+
# within the Gradle project.
|
|
62
|
+
#
|
|
63
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
64
|
+
#
|
|
65
|
+
##############################################################################
|
|
9
66
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
67
|
+
# Attempt to set APP_HOME
|
|
68
|
+
|
|
69
|
+
# Resolve links: $0 may be a link
|
|
70
|
+
app_path=$0
|
|
71
|
+
|
|
72
|
+
# Need this for daisy-chained symlinks.
|
|
73
|
+
while
|
|
74
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
75
|
+
[ -h "$app_path" ]
|
|
76
|
+
do
|
|
77
|
+
ls=$( ls -ld "$app_path" )
|
|
78
|
+
link=${ls#*' -> '}
|
|
79
|
+
case $link in #(
|
|
80
|
+
/*) app_path=$link ;; #(
|
|
81
|
+
*) app_path=$APP_HOME$link ;;
|
|
82
|
+
esac
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
# This is normally unused
|
|
86
|
+
# shellcheck disable=SC2034
|
|
87
|
+
APP_BASE_NAME=${0##*/}
|
|
88
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
89
|
+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
|
90
|
+
|
|
91
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
|
+
MAX_FD=maximum
|
|
93
|
+
|
|
94
|
+
warn () {
|
|
95
|
+
echo "$*"
|
|
96
|
+
} >&2
|
|
97
|
+
|
|
98
|
+
die () {
|
|
99
|
+
echo
|
|
100
|
+
echo "$*"
|
|
101
|
+
echo
|
|
14
102
|
exit 1
|
|
103
|
+
} >&2
|
|
104
|
+
|
|
105
|
+
# OS specific support (must be 'true' or 'false').
|
|
106
|
+
cygwin=false
|
|
107
|
+
msys=false
|
|
108
|
+
darwin=false
|
|
109
|
+
nonstop=false
|
|
110
|
+
case "$( uname )" in #(
|
|
111
|
+
CYGWIN* ) cygwin=true ;; #(
|
|
112
|
+
Darwin* ) darwin=true ;; #(
|
|
113
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
|
114
|
+
NONSTOP* ) nonstop=true ;;
|
|
115
|
+
esac
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# Determine the Java command to use to start the JVM.
|
|
120
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
121
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
122
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
123
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
124
|
+
else
|
|
125
|
+
JAVACMD=$JAVA_HOME/bin/java
|
|
126
|
+
fi
|
|
127
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
128
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
129
|
+
|
|
130
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
131
|
+
location of your Java installation."
|
|
132
|
+
fi
|
|
133
|
+
else
|
|
134
|
+
JAVACMD=java
|
|
135
|
+
if ! command -v java >/dev/null 2>&1
|
|
136
|
+
then
|
|
137
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
138
|
+
|
|
139
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
140
|
+
location of your Java installation."
|
|
141
|
+
fi
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# Increase the maximum file descriptors if we can.
|
|
145
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
146
|
+
case $MAX_FD in #(
|
|
147
|
+
max*)
|
|
148
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
149
|
+
# shellcheck disable=SC2039,SC3045
|
|
150
|
+
MAX_FD=$( ulimit -H -n ) ||
|
|
151
|
+
warn "Could not query maximum file descriptor limit"
|
|
152
|
+
esac
|
|
153
|
+
case $MAX_FD in #(
|
|
154
|
+
'' | soft) :;; #(
|
|
155
|
+
*)
|
|
156
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
157
|
+
# shellcheck disable=SC2039,SC3045
|
|
158
|
+
ulimit -n "$MAX_FD" ||
|
|
159
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
160
|
+
esac
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
|
164
|
+
# * args from the command line
|
|
165
|
+
# * the main class name
|
|
166
|
+
# * -classpath
|
|
167
|
+
# * -D...appname settings
|
|
168
|
+
# * --module-path (only if needed)
|
|
169
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
170
|
+
|
|
171
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
172
|
+
if "$cygwin" || "$msys" ; then
|
|
173
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
174
|
+
|
|
175
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
176
|
+
|
|
177
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
178
|
+
for arg do
|
|
179
|
+
if
|
|
180
|
+
case $arg in #(
|
|
181
|
+
-*) false ;; # don't mess with options #(
|
|
182
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
183
|
+
[ -e "$t" ] ;; #(
|
|
184
|
+
*) false ;;
|
|
185
|
+
esac
|
|
186
|
+
then
|
|
187
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
188
|
+
fi
|
|
189
|
+
# Roll the args list around exactly as many times as the number of
|
|
190
|
+
# args, so each arg winds up back in the position where it started, but
|
|
191
|
+
# possibly modified.
|
|
192
|
+
#
|
|
193
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
|
194
|
+
# changing the positional parameters here affects neither the number of
|
|
195
|
+
# iterations, nor the values presented in `arg`.
|
|
196
|
+
shift # remove old arg
|
|
197
|
+
set -- "$@" "$arg" # push replacement arg
|
|
198
|
+
done
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
203
|
+
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
|
|
204
|
+
|
|
205
|
+
# Collect all arguments for the java command:
|
|
206
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
207
|
+
# and any embedded shellness will be escaped.
|
|
208
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
209
|
+
# treated as '${Hostname}' itself on the command line.
|
|
210
|
+
|
|
211
|
+
set -- \
|
|
212
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
213
|
+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
|
214
|
+
"$@"
|
|
215
|
+
|
|
216
|
+
# Stop when "xargs" is not available.
|
|
217
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
218
|
+
then
|
|
219
|
+
die "xargs is not available"
|
|
15
220
|
fi
|
|
16
221
|
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#
|
|
222
|
+
# Use "xargs" to parse quoted args.
|
|
223
|
+
#
|
|
224
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
225
|
+
#
|
|
226
|
+
# In Bash we could simply go:
|
|
227
|
+
#
|
|
228
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
229
|
+
# set -- "${ARGS[@]}" "$@"
|
|
230
|
+
#
|
|
231
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
232
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
233
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
|
234
|
+
# that process (while maintaining the separation between arguments), and wrap
|
|
235
|
+
# the whole thing up as a single "set" statement.
|
|
236
|
+
#
|
|
237
|
+
# This will of course break if any of these variables contains a newline or
|
|
238
|
+
# an unmatched quote.
|
|
239
|
+
#
|
|
20
240
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
241
|
+
eval "set -- $(
|
|
242
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
243
|
+
xargs -n1 |
|
|
244
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
245
|
+
tr '\n' ' '
|
|
246
|
+
)" '"$@"'
|
|
24
247
|
|
|
25
|
-
|
|
248
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
|
|
3
|
+
final class ScreenshotUITest: XCTestCase {
|
|
4
|
+
|
|
5
|
+
func test_01_analytics() {
|
|
6
|
+
let app = XCUIApplication()
|
|
7
|
+
app.launchArguments = ["-AppleLanguages", "(en)"]
|
|
8
|
+
app.launch()
|
|
9
|
+
Thread.sleep(forTimeInterval: 2.0)
|
|
10
|
+
|
|
11
|
+
let target_0_0 = app.descendants(matching: .any).matching(NSPredicate(format: "label ==[c] %@ OR title ==[c] %@", "Analytics", "Analytics")).firstMatch
|
|
12
|
+
if target_0_0.waitForExistence(timeout: 5) {
|
|
13
|
+
target_0_0.tap()
|
|
14
|
+
Thread.sleep(forTimeInterval: 0.8)
|
|
15
|
+
}
|
|
16
|
+
Thread.sleep(forTimeInterval: 0.5)
|
|
17
|
+
let screenshot = XCUIScreen.main.screenshot()
|
|
18
|
+
try! screenshot.pngRepresentation.write(to: URL(fileURLWithPath: "/Users/rustam/Projects/openuispec/artifacts/todo-orbit/screenshots/ios-analytics.png"))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func test_02_settings() {
|
|
22
|
+
let app = XCUIApplication()
|
|
23
|
+
app.launchArguments = ["-AppleLanguages", "(en)"]
|
|
24
|
+
app.launch()
|
|
25
|
+
Thread.sleep(forTimeInterval: 2.0)
|
|
26
|
+
|
|
27
|
+
let target_1_0 = app.descendants(matching: .any).matching(NSPredicate(format: "label ==[c] %@ OR title ==[c] %@", "Settings", "Settings")).firstMatch
|
|
28
|
+
if target_1_0.waitForExistence(timeout: 5) {
|
|
29
|
+
target_1_0.tap()
|
|
30
|
+
Thread.sleep(forTimeInterval: 0.8)
|
|
31
|
+
}
|
|
32
|
+
Thread.sleep(forTimeInterval: 0.5)
|
|
33
|
+
let screenshot = XCUIScreen.main.screenshot()
|
|
34
|
+
try! screenshot.pngRepresentation.write(to: URL(fileURLWithPath: "/Users/rustam/Projects/openuispec/artifacts/todo-orbit/screenshots/ios-settings.png"))
|
|
35
|
+
}
|
|
36
|
+
}
|