Skip to content

Commit da0bd08

Browse files
committed
Refined kotlin sheet logic and updated screenshots on Linux
1 parent 6ba5b56 commit da0bd08

File tree

4 files changed

+51
-19
lines changed

4 files changed

+51
-19
lines changed
5.65 KB
Loading
4.93 KB
Loading

scripts/hellocodenameone/common/src/main/kotlin/com/codenameone/examples/hellocodenameone/tests/KotlinUiTest.kt

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ package com.codenameone.examples.hellocodenameone.tests
33
import com.codename1.components.Accordion
44
import com.codename1.components.MultiButton
55
import com.codename1.components.Switch
6-
import com.codename1.ui.Button
7-
import com.codename1.ui.CheckBox
8-
import com.codename1.ui.Container
9-
import com.codename1.ui.Label
10-
import com.codename1.ui.Sheet
11-
import com.codename1.ui.Slider
12-
import com.codename1.ui.TextArea
13-
import com.codename1.ui.TextField
6+
import com.codename1.testing.TestUtils
7+
import com.codename1.ui.*
148
import com.codename1.ui.layouts.BoxLayout
15-
import com.codename1.ui.util.UITimer
169

1710
class KotlinUiTest : BaseTest() {
1811
override fun runTest(): Boolean {
19-
val kotlinForm = createForm("Kotlin", BoxLayout.y(), "kotlin")
12+
var called = BooleanArray(1)
13+
val kotlinForm = object : Form("Kotlin", BoxLayout.y()) {
14+
override fun onShowCompleted() {
15+
super.onShowCompleted()
16+
called[0] = true
17+
}
18+
}
2019
kotlinForm.addAll(
2120
Label("Kotlin UI Test Components"),
2221
Button("Kotlin Button"),
@@ -58,6 +57,16 @@ class KotlinUiTest : BaseTest() {
5857
sheet.contentPane.add(Label("This is a sheet covering part of the screen"))
5958
sheet.show(0)
6059

60+
var timeout = 100;
61+
while (sheet.parent == null && !called[0]) {
62+
TestUtils.waitFor(10)
63+
timeout--
64+
TestUtils.assertNotEqual(0, timeout)
65+
}
66+
67+
Cn1ssDeviceRunnerHelper.emitCurrentFormScreenshot("kotlin")
68+
done()
69+
6170
return true
6271
}
6372
}

scripts/run-ios-ui-tests.sh

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,17 @@ APP_PROCESS_NAME="${WRAPPER_NAME%.app}"
461461
trap cleanup EXIT
462462

463463
ri_log "Streaming simulator logs to $TEST_LOG"
464+
CN1SS_PREDICATE='(eventMessage CONTAINS "CN1SS" OR composedMessage CONTAINS "CN1SS")'
464465
if [ -n "$SIM_DEVICE_ID" ]; then
465466
xcrun simctl terminate "$SIM_DEVICE_ID" "$BUNDLE_IDENTIFIER" >/dev/null 2>&1 || true
466467
xcrun simctl uninstall "$SIM_DEVICE_ID" "$BUNDLE_IDENTIFIER" >/dev/null 2>&1 || true
467468

468-
xcrun simctl spawn "$SIM_DEVICE_ID" \
469+
stdbuf -oL xcrun simctl spawn "$SIM_DEVICE_ID" \
469470
log stream --style json --level debug \
470-
--predicate 'eventMessage CONTAINS "CN1SS"' \
471+
--predicate "$CN1SS_PREDICATE" \
471472
> "$TEST_LOG" 2>&1 &
472473
else
473-
xcrun simctl spawn booted log stream --style compact --level debug --predicate 'composedMessage CONTAINS "CN1SS"' > "$TEST_LOG" 2>&1 &
474+
stdbuf -oL xcrun simctl spawn booted log stream --style json --level debug --predicate "$CN1SS_PREDICATE" > "$TEST_LOG" 2>&1 &
474475
fi
475476
LOG_STREAM_PID=$!
476477
sleep 2
@@ -547,12 +548,34 @@ declare -a CN1SS_SOURCES=("SIMLOG:$TEST_LOG")
547548
LOG_CHUNKS="$(cn1ss_count_chunks "$TEST_LOG")"; LOG_CHUNKS="${LOG_CHUNKS//[^0-9]/}"; : "${LOG_CHUNKS:=0}"
548549
ri_log "Chunk counts -> simulator log: ${LOG_CHUNKS}"
549550

550-
if [ "${LOG_CHUNKS:-0}" = "0" ]; then
551-
ri_log "STAGE:MARKERS_NOT_FOUND -> simulator output did not include CN1SS chunks"
552-
ri_log "---- CN1SS lines (if any) ----"
553-
(grep "CN1SS:" "$TEST_LOG" || true) | sed 's/^/[CN1SS] /'
554-
exit 12
555-
fi
551+
if [ "${LOG_CHUNKS:-0}" = "0" ]; then
552+
COLLECTED_LOG_DIR="$ARTIFACTS_DIR/simulator-logs"
553+
ensure_dir "$COLLECTED_LOG_DIR"
554+
DEBUG_LOG="$COLLECTED_LOG_DIR/device-runner-debug.log"
555+
if [ -n "$SIM_DEVICE_ID" ]; then
556+
ri_log "Capturing simulator debug log to $DEBUG_LOG"
557+
xcrun simctl spawn "$SIM_DEVICE_ID" log show --style syslog --last 30m > "$DEBUG_LOG" 2>/dev/null || true
558+
else
559+
ri_log "Capturing host simulator debug log to $DEBUG_LOG"
560+
log show --style syslog --last 30m > "$DEBUG_LOG" 2>/dev/null || true
561+
fi
562+
CRASH_LOG_DIR="$COLLECTED_LOG_DIR/crash-reports"
563+
ensure_dir "$CRASH_LOG_DIR"
564+
ri_log "Collecting recent crash reports into $CRASH_LOG_DIR"
565+
find "$HOME/Library/Logs/DiagnosticReports" -type f -name '*.crash' -mmin -120 -print -exec cp {} "$CRASH_LOG_DIR" \; 2>/dev/null || true
566+
if [ -s "$FALLBACK_LOG" ]; then
567+
ri_log "Appending fallback CN1SS log to $TEST_LOG"
568+
{
569+
echo "---- BEGIN FALLBACK CN1SS LOG ----"
570+
cat "$FALLBACK_LOG"
571+
echo "---- END FALLBACK CN1SS LOG ----"
572+
} >> "$TEST_LOG" 2>/dev/null || true
573+
fi
574+
ri_log "STAGE:MARKERS_NOT_FOUND -> simulator output did not include CN1SS chunks"
575+
ri_log "---- CN1SS lines (if any) ----"
576+
(grep "CN1SS:" "$TEST_LOG" || true) | sed 's/^/[CN1SS] /'
577+
exit 12
578+
fi
556579

557580
TEST_NAMES_RAW="$(cn1ss_list_tests "$TEST_LOG" 2>/dev/null | awk 'NF' | sort -u || true)"
558581
declare -a TEST_NAMES=()

0 commit comments

Comments
 (0)