chore: update package.json for testing scripts and dependencies

- Added unit and end-to-end testing scripts to package.json.
- Included detox for end-to-end testing and jest-circus for improved test execution.

feat: add testID to LandingScreen logo for better testing

- Added testID attribute to the logo image in LandingScreen for easier identification in tests.

feat: create tokens.ts to re-export design tokens

- Introduced tokens.ts to re-export shared design tokens from lightTheme for consistent imports.
This commit is contained in:
Jonathan Atta
2026-03-03 12:49:42 +01:00
parent da373199e0
commit 41c7634b75
13 changed files with 1428 additions and 3 deletions

View File

@@ -84,6 +84,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
signingConfigs {
debug {
@@ -110,6 +111,7 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
androidTestImplementation('com.wix:detox:+')
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")

View File

@@ -0,0 +1,31 @@
package com.mymobileagent;
import com.wix.detox.Detox;
import com.wix.detox.config.DetoxConfig;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class DetoxTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule =
new ActivityTestRule<>(MainActivity.class, false, false);
@Test
public void runDetoxTests() {
DetoxConfig detoxConfig = new DetoxConfig();
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60);
Detox.runTests(mActivityRule, detoxConfig);
}
}

View File

@@ -16,7 +16,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="${usesCleartextTraffic}"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true">
<activity
android:name=".MainActivity"

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>

View File

@@ -19,3 +19,12 @@ buildscript {
}
apply plugin: "com.facebook.react.rootproject"
allprojects {
repositories {
maven {
url("$rootDir/../node_modules/detox/Detox-android")
}
maven { url 'https://www.jitpack.io' }
}
}