Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .detoxrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const launchArgs = {
disableAnimations: true,
};

/** @type {Detox.DetoxConfig} */
module.exports = {
testRunner: {
args: {
$0: "jest",
config: "e2e/jest.config.ts",
},
jest: {
setupTimeout: 120000,
},
},
apps: {
"ios.release": {
launchArgs,
type: "ios.app",
binaryPath:
"ios/build/Build/Products/Release-iphonesimulator/YOUR_APP.app",
build:
"xcodebuild -workspace ios/YOUR_APP.xcworkspace -scheme YOUR_APP -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
},
"android.release": {
launchArgs,
type: "android.apk",
binaryPath: "android/app/build/outputs/apk/release/app-release.apk",
build: `cd android && "./gradlew" assembleRelease assembleAndroidTest -DtestBuildType=release`,
},
},
devices: {
simulator: {
type: "ios.simulator",
device: {
type: "iPhone 15",
},
},
attached: {
type: "android.attached",
device: {
adbName: ".*",
},
},
emulator: {
type: "android.emulator",
device: {
avdName: "Medium_Phone_API_36.0",
},
},
},
configurations: {
"ios.sim.release": {
device: "simulator",
app: "ios.release",
},
"android.att.release": {
device: "attached",
app: "android.release",
},
"android.emu.release": {
device: "emulator",
app: "android.release",
},
},
};
5 changes: 4 additions & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export default ({ config }: ConfigContext) =>
plugins: [
["./scripts/fdroid/removeDKBuildId.ts"],
["./scripts/fdroid/disableDependencyMetadata.ts"],
["./scripts/fdroid/excludeNonfreeDependencies.ts"],
[
"./scripts/detox/configureDetox.ts",
// { subdomains: "*" }, // uncomment to debug app
],
[
"expo-build-properties",
{
Expand Down
10 changes: 0 additions & 10 deletions components/LoadingIndicator.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion components/ServerForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef, useState } from "react";
import { Text, Button, Input, CheckBox } from "@ui-kitten/components";
import { cleanServerUrl, verifyEvccServer } from "../utils/server";
import LoadingIndicator from "../components/LoadingIndicator";
import LoadingIndicator from "./animations/LoadingIndicator";
import { useTranslation } from "react-i18next";
import { BasicAuth } from "types";

Expand Down
11 changes: 11 additions & 0 deletions components/animations/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ActivityIndicatorProps, View } from "react-native";
import { ActivityIndicator as RNActivityIndicator } from "react-native";
import { disableAnimations } from "./launchArguments";

export default function ActivityIndicator(props?: ActivityIndicatorProps) {
return (
<View style={{ justifyContent: "center", alignItems: "center" }}>
<RNActivityIndicator {...props} animating={!disableAnimations()} />
</View>
);
}
11 changes: 11 additions & 0 deletions components/animations/LoadingIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { View } from "react-native";
import { SpinnerProps } from "@ui-kitten/components";
import Spinner from "./Spinner";

export default function LoadingIndicator(props?: SpinnerProps) {
return (
<View style={{ justifyContent: "center", alignItems: "center" }}>
<Spinner {...props} />
</View>
);
}
9 changes: 9 additions & 0 deletions components/animations/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {
SpinnerProps,
Spinner as UIKittenSpinner,
} from "@ui-kitten/components";
import { disableAnimations } from "./launchArguments";

export default function Spinner(props: SpinnerProps) {
return <UIKittenSpinner {...props} animating={!disableAnimations()} />;
}
9 changes: 9 additions & 0 deletions components/animations/launchArguments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LaunchArguments } from "react-native-launch-arguments";

interface LaunchArgs {
disableAnimations?: boolean;
}

export function disableAnimations(): boolean {
return !!LaunchArguments.value<LaunchArgs>().disableAnimations;
}
14 changes: 14 additions & 0 deletions e2e/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Config } from "@jest/types";

module.exports = {
preset: "ts-jest",
rootDir: "..",
testMatch: ["<rootDir>/e2e/**/*.test.ts"],
testTimeout: 120000,
maxWorkers: 1,
globalSetup: "detox/runners/jest/globalSetup",
globalTeardown: "detox/runners/jest/globalTeardown",
reporters: ["detox/runners/jest/reporter"],
testEnvironment: "detox/runners/jest/testEnvironment",
verbose: true,
} satisfies Config.InitialOptions;
18 changes: 18 additions & 0 deletions e2e/starter.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import "detox";

describe("Example", () => {
beforeAll(async () => {
await device.launchApp();
});

beforeEach(async () => {
await device.reloadReactNative();
});

it("open and leave demo server", async () => {
await element(by.id("useDemo")).tap();

await web.element(by.web.id("topNavigatonDropdown")).tap();
// await web.element(by.web.value("Change Server")).tap(); // TODO: use testID
});
});
Loading