WizardDoc is a Node.js-based tool designed to automate the extraction of test IDs and generate markdown documentation. This is particularly useful for analyzing the page source of Android and iOS applications using Appium WebDriver and creating structured reports.
- Platform Compatibility: Supports both Android and iOS.
- Dynamic App Detection: Detects the foreground app (Android) or installed apps (iOS).
- Markdown Generation: Automatically creates a detailed markdown report with test IDs and component descriptions.
- Custom Filtering: Filter results using
rootIdContainer
. - Interactive Selection: For iOS, it prompts users to select an app if multiple are installed.
Ensure you have Node.js installed. Clone the repository and install dependencies:
npm install
Run the following scripts to execute the tool:
-
Android:
npm run android npm run android:name npm run android:name:root
-
iOS:
npm run ios npm run ios:name npm run ios:name:root
- fileName: Name for the generated markdown file (default:
DefaultFileName
). - rootIdContainer: Filter elements by container ID.
- platform: Choose between
ios
orandroid
.
The output markdown includes:
- Test ID information.
- Component types and descriptions.
- Node.js: Ensure Node.js is installed.
- Appium: Start the Appium server before running any scripts. Use the following command to start Appium:
Ensure it is running on the default port
appium
4723
.
- Android Emulator or Device:
- Ensure you have an Android emulator running or a physical device connected.
- Verify that
adb
is properly configured by running:adb devices
- Appium Server:
- Start the Appium server with:
appium
- Start the Appium server with:
You can start the script using the following commands:
Detects the foreground app package and activity on the connected Android device. Fetches test IDs and generates the markdown report.
npm run android
Use a custom name for the generated markdown file.
npm run android:name
Filters test IDs based on the container ID specified in rootIdContainer
.
npm run android:name:root
- Detects the foreground app using:
adb shell dumpsys activity
- Extracts the package name and activity name of the running app.
- Uses these values to launch the app and retrieve the page source.
- Filters the source for elements matching test ID patterns.
- Generates the markdown report.
Booted iOS Simulator:
- Ensure an iOS simulator is booted and running.
- Verify with:
xcrun simctl list devices
Xcode Tools:
- Install and configure Xcode and the
xcrun
command-line tools.
Appium Server: Start the Appium server with:
appium
You can start the script using the following commands:
Detects installed apps on the simulator and prompts you to select one. Fetches test IDs and generates the markdown report.
npm run ios
Use a custom name for the generated markdown file.
npm run ios:name
Filters test IDs based on the container ID specified in rootIdContainer
.
npm run ios:name:root
- Retrieves the UUID of the running simulator using:
xcrun simctl
- Lists installed apps and prompts the user to select one.
- Uses the selected app's bundle ID to launch the app on the simulator.
- Retrieves the page source and filters it for test IDs matching the specified criteria.
- Generates the markdown report.
src/index.ts
: Entry point of the application.utils/ios.utils.ts
: Functions for iOS simulator interaction.utils/android.utils.ts
: Android-specific utilities.utils/common.utils.ts
: Shared utilities like regex patterns.utils/readme.utils.ts
: Markdown content generation logic.
- @inquirer/prompts: For interactive prompts.
- webdriverio: WebDriver client for Appium.
- Parses command-line arguments to determine platform and options.
- Detects active Android foreground app or prompts for iOS app selection.
- Fetches page source using Appium WebDriver.
- Filters elements based on provided criteria.
- Generates and saves a markdown report.
# DefaultFileName.tsx
![Component Image](change/Name.png)
| **Element** | **Description** | **Test ID** |
|----------------|--------------------------|-------------------|
| Button | Clickable button element | login_button |
| Input Field | Used for inputting text | username_input |
This project is licensed under the ISC License.
For inquiries or contributions, please create an issue in the repository.