Add E2E testing infrastructure with WebdriverIO + Appium
Set up E2E test framework for Android using WebdriverIO, Appium, and UiAutomator2. Add testID props to key components (AuthButton, BaseButton, ChatBubble, CustomTextInput, ProposedEventCard) and apply testIDs to login screen, chat screen, tab bar, and settings. Include initial tests for app launch detection and login flow validation. Update CLAUDE.md with E2E docs.
This commit is contained in:
41
apps/client/e2e/helpers/driver.ts
Normal file
41
apps/client/e2e/helpers/driver.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { remote, type Browser } from "webdriverio";
|
||||
import { getCapabilities } from "../config/capabilities";
|
||||
|
||||
let driver: Browser | null = null;
|
||||
|
||||
const APPIUM_HOST = process.env.APPIUM_HOST || "localhost";
|
||||
const APPIUM_PORT = parseInt(process.env.APPIUM_PORT || "4723", 10);
|
||||
|
||||
/**
|
||||
* Initialize the Appium driver. If already initialized, returns the existing instance.
|
||||
* With --runInBand, all test files share this singleton.
|
||||
*/
|
||||
export async function initDriver(): Promise<Browser> {
|
||||
if (driver) return driver;
|
||||
|
||||
const capabilities = getCapabilities();
|
||||
|
||||
driver = await remote({
|
||||
hostname: APPIUM_HOST,
|
||||
port: APPIUM_PORT,
|
||||
path: "/",
|
||||
capabilities,
|
||||
logLevel: "warn",
|
||||
});
|
||||
|
||||
return driver;
|
||||
}
|
||||
|
||||
export function getDriver(): Browser {
|
||||
if (!driver) {
|
||||
throw new Error("Driver not initialized. Call initDriver() first.");
|
||||
}
|
||||
return driver;
|
||||
}
|
||||
|
||||
export async function quitDriver(): Promise<void> {
|
||||
if (driver) {
|
||||
await driver.deleteSession();
|
||||
driver = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user