From 47f7c7dcae0e5eab56fbd807afe3e8482846bbd0 Mon Sep 17 00:00:00 2001 From: Kenny Hu Date: Wed, 18 Dec 2024 17:01:57 -0500 Subject: [PATCH] eod save, local e2e test working but eas build is not working --- README.md | 12 ++++++++++++ example/App.tsx | 31 ++++++++++++++++++++++++++++-- example/app.json | 12 +++++++++--- example/eas.json | 21 ++++++++++++++++++++ example/maestro/example_tests.yaml | 19 ++++++++++++++++++ 5 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 example/eas.json create mode 100644 example/maestro/example_tests.yaml diff --git a/README.md b/README.md index bab0f4ad..dff90289 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,18 @@ To run example app with local `react-native-radar` dependency: - build native app using expo pre-build and `react-native-plugin` with `npm run install-radar-rebuild`. - run iOS and android example app with `npx expo run:ios` or `npx expo run:android`. +### Example app tests + +If needed, install `maestro` with +``` + brew tap mobile-dev-inc/tap + brew install maestro +``` + +Then, run tests with `maestro test example_tests.yaml`. from `/example/maestro` dir. + + + ## Support diff --git a/example/App.tsx b/example/App.tsx index e69ef0ce..99b6c43b 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { StyleSheet, Text, View, ScrollView, Platform } from "react-native"; +import { StyleSheet, Text, View, ScrollView, Platform, TextInput } from "react-native"; import Radar, { Map, Autocomplete, RadarClientLocationUpdate, RadarLocationUpdate, RadarEventUpdate } from "react-native-radar"; import MapLibreGL from "@maplibre/maplibre-react-native"; import ExampleButton from "./components/exampleButton"; @@ -32,11 +32,12 @@ Radar.on("log", (result: string) => { export default function App() { // add in your test code here! const [displayText, setDisplayText] = useState(""); + const [publishableKey, setPublishableKey] = useState(""); const handlePopulateText = (displayText: string) => { setDisplayText(displayText); }; - Radar.initialize("prj_test_pk_0000000000000000000000000000000000000000", true); + //Radar.initialize("prj_test_pk_0000000000000000000000000000000000000000", true); useEffect(() => { Radar.setLogLevel("debug"); @@ -77,6 +78,32 @@ export default function App() { {displayText} + setPublishableKey(text)} + placeholder="Enter publishable key" + style={{ height: 40, borderColor: 'gray', borderWidth: 1, margin: 10, padding: 5 }} + /> + { + Radar.initialize(publishableKey, true); + + }} + /> + { + Radar.trackOnce() + .then((result) => { + handlePopulateText("trackOnce:" + stringify(result)); + }) + .catch((err) => { + handlePopulateText("trackOnce:" + err); + }); + }} + /> { diff --git a/example/app.json b/example/app.json index 101959ab..1387d92d 100644 --- a/example/app.json +++ b/example/app.json @@ -16,14 +16,14 @@ ], "ios": { "supportsTablet": true, - "bundleIdentifier": "com.radar.example", + "bundleIdentifier": "com.radar.rnexample" }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, - "package": "com.radar.example" + "package": "com.radar.rnexample" }, "web": { "favicon": "./assets/favicon.png" @@ -55,6 +55,12 @@ } } ] - ] + ], + "extra": { + "eas": { + "projectId": "caf6acc9-b3c5-4d95-af29-fd017a05abb8" + } + }, + "owner": "radarlabs" } } diff --git a/example/eas.json b/example/eas.json new file mode 100644 index 00000000..aa4d33aa --- /dev/null +++ b/example/eas.json @@ -0,0 +1,21 @@ +{ + "cli": { + "version": ">= 14.0.2", + "appVersionSource": "remote" + }, + "build": { + "development": { + "developmentClient": true, + "distribution": "internal" + }, + "preview": { + "distribution": "internal" + }, + "production": { + "autoIncrement": true + } + }, + "submit": { + "production": {} + } +} diff --git a/example/maestro/example_tests.yaml b/example/maestro/example_tests.yaml new file mode 100644 index 00000000..057498d3 --- /dev/null +++ b/example/maestro/example_tests.yaml @@ -0,0 +1,19 @@ +appId: com.radar.rnexample +--- +- launchApp +- assertVisible: 'getUser' +- tapOn: "Enter publishable key" +- inputText: + text: '${MAESTRO_RADAR_PUBLISHABLE_KEY}' +- hideKeyboard +- tapOn: + text: 'Initialize' +- setLocation: + latitude: 52.3599976 + longitude: 4.8830301 +- tapOn: + text: 'trackOnce' +- extendedWaitUntil: + visible: '.*SUCCESS.*' + timeout: 10000 # Timeout in milliseconds +