-
-
Notifications
You must be signed in to change notification settings - Fork 23
Add Comprehensive Appium E2E Testing Framework for Sefaria Mobile App #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5b92ab8
138ecfb
24435cd
60b0f5c
99731e2
f549e9f
514860f
8539a2e
cd3e685
1a16345
b689cd4
04e8a77
9b27826
93339c2
481e121
49f3ee3
30b5a54
2c5932e
04f3828
d0888d5
8f88832
3b3ce67
5ae2224
b9b69f2
ab9d9ad
2ef317f
5baa52c
6a705b0
b74d4c6
ee247ce
1d426e1
0852587
d3c8940
6702b42
f682f39
c2f894b
313d063
bfc757e
e84cfe2
78c6878
3d9f407
a5b4b38
aeba1f6
c2660d0
726a455
a49a991
d3de7c0
a85f3b3
0d866fe
e961bc4
7c00fef
04fa999
c79a82b
8cc364f
952591e
f05178d
0d0fa2b
1bd2c0c
9005898
b23d3f2
c8313e1
880f968
e9d5613
528237a
f05be63
333bd51
990cb47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Run Android BrowserStack Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| platform: | ||
| description: 'Platform to test' | ||
| required: true | ||
| default: 'android' | ||
| type: choice | ||
| options: | ||
| - android | ||
|
|
||
| jobs: | ||
| run-android-tests: | ||
| runs-on: ubuntu-latest | ||
| name: Android Tests | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
|
|
||
| - name: Navigate to test directory | ||
| run: cd automatic-e2e-tests | ||
|
|
||
| - name: Clean npm cache | ||
| working-directory: automatic-e2e-tests | ||
| run: npm cache clean --force | ||
|
|
||
| - name: Clean up logs and screenshots | ||
| working-directory: automatic-e2e-tests | ||
| run: | | ||
| npm run cleanup:android | ||
|
|
||
| - name: Install Dependencies | ||
| working-directory: automatic-e2e-tests | ||
| run: npm install | ||
|
|
||
| - name: Run Android Tests on BrowserStack | ||
| working-directory: automatic-e2e-tests | ||
| env: | ||
| PLATFORM: android | ||
| RUN_ENV: browserstack | ||
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
| ANDROID_BROWSERSTACK_APP_ID: ${{ secrets.ANDROID_BROWSERSTACK_APP_ID }} | ||
| GITHUB_ACTIONS: true | ||
| run: npm run test:android:browserstack | ||
|
|
||
| - name: Upload Android test logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-logs | ||
| path: automatic-e2e-tests/logs/android/ | ||
| if-no-files-found: warn | ||
|
|
||
| - name: Upload Android screenshots if tests fail | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-screenshots | ||
| path: automatic-e2e-tests/screenshots/android/ | ||
| if-no-files-found: ignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Run iOS BrowserStack Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| platform: | ||
| description: 'Platform to test' | ||
| required: true | ||
| default: 'ios' | ||
| type: choice | ||
| options: | ||
| - ios | ||
|
|
||
| jobs: | ||
| run-ios-tests: | ||
| runs-on: ubuntu-latest | ||
| name: iOS Tests | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
|
|
||
| - name: Navigate to test directory | ||
| run: cd automatic-e2e-tests | ||
|
|
||
| - name: Clean npm cache | ||
| working-directory: automatic-e2e-tests | ||
| run: npm cache clean --force | ||
|
|
||
| - name: Clean up logs and screenshots | ||
| working-directory: automatic-e2e-tests | ||
| run: | | ||
| npm run cleanup:ios | ||
|
|
||
| - name: Install Dependencies | ||
| working-directory: automatic-e2e-tests | ||
| run: npm install | ||
|
|
||
| - name: Run iOS Tests on BrowserStack | ||
| working-directory: automatic-e2e-tests | ||
| env: | ||
| PLATFORM: ios | ||
| RUN_ENV: browserstack | ||
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
| IOS_BROWSERSTACK_APP_ID: ${{ secrets.IOS_BROWSERSTACK_APP_ID }} | ||
| GITHUB_ACTIONS: true | ||
| run: npm run test:ios:browserstack | ||
|
|
||
| - name: Upload iOS test logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ios-logs | ||
| path: automatic-e2e-tests/logs/ios/ | ||
| if-no-files-found: warn | ||
|
|
||
| - name: Upload iOS screenshots if tests fail | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ios-screenshots | ||
| path: automatic-e2e-tests/screenshots/ios/ | ||
| if-no-files-found: ignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Node modules | ||
| node_modules/ | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.* | ||
| .secrets | ||
|
|
||
|
|
||
| # Build output | ||
| .dist/ | ||
| dist/ | ||
| build/ | ||
| out/ | ||
|
|
||
|
|
||
| # logs and screenshots | ||
| screenshots/ios/* | ||
| screenshots/android/* | ||
| logs/android/* | ||
| logs/ios/* | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
|
|
||
| # APK, AAB, and IPA | ||
| *.apk | ||
| *.aab | ||
| *.ipa |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "require": ["ts-node/register"], | ||
| "loader": "ts-node/esm", | ||
| "extensions": ["ts"], | ||
| "timeout": 300000, | ||
| "exit": true, | ||
| "recursive": true, | ||
| "reporter": "spec", | ||
| "spec": ["tests/**/*.spec.ts", "!tests/**/sanity.spec.ts"], | ||
| "ui": "bdd" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "require": ["ts-node/register"], | ||
| "loader": "ts-node/esm", | ||
| "extensions": ["ts"], | ||
| "timeout": 300000, | ||
| "exit": true, | ||
| "recursive": false, | ||
| "reporter": "spec", | ||
| "spec": "tests/sanity.spec.ts", | ||
| "ui": "bdd" | ||
| } |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't let the many small comments confuse you. This is a good file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have a naming difference in between different MD files. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| # Sefaria Mobile Testing Framework - File Overview | ||
|
|
||
| This document describes the purpose and main usage of each file and folder in the E2E test directory. | ||
| Use this as a quick reference for contributors and maintainers. | ||
|
|
||
| --- | ||
|
|
||
| ## Directory Structure | ||
|
|
||
| - **Selectors/** | ||
| Contains platform-specific selectors for Android and iOS. | ||
| - **selectors/android/selectors.ts** | ||
| Android-specific UI selectors and XPath patterns. | ||
| - **selectors/ios/selectors.ts** | ||
| iOS-specific UI selectors and XPath patterns. | ||
|
|
||
| - **logs/** and **screenshots/** | ||
| Centralized logs and screenshots for both platforms. | ||
|
|
||
| - **scripts/** | ||
| Utility scripts (e.g., cleanup.js). `run-parallel-tests.js` for running tests in parallel on multiple devices. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You give two examples. But one is in brackets and one isn't. |
||
|
|
||
| - **devices.json** | ||
| Configuration file for devices used in parallel testing. Set specific devices and version for Android and iOS. | ||
|
|
||
| --- | ||
|
|
||
| ## components/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confusing styling. |
||
|
|
||
| > **Note:** The files in this directory follow the Page Object Model (POM) pattern, where each file represents a specific page or component of the app. | ||
HershelT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Reusable page/component objects for high-level UI actions (cross-platform). | ||
|
|
||
| - **display_settings.ts** | ||
| Helpers for toggling display settings and language. | ||
HershelT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - **navbar.ts** | ||
| Functions to interact with the navigation bar. | ||
|
|
||
| - **reader_page.ts** | ||
| Utilities for validating titles and text on the reader page. | ||
|
|
||
| - **search_page.ts** | ||
| Helpers for typing into the search bar and selecting from search results. | ||
|
|
||
| - **topics_page.ts** | ||
| Functions for navigating and validating the Topics page. | ||
|
|
||
| - **index.ts** | ||
| Central import point for all components, allowing easy access to all page objects. | ||
|
|
||
| - **\*.ts** | ||
| Add new component helpers as needed. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this is.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was trying to make it represent a wild card, like add more later! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahh I think it's understood implicitly |
||
|
|
||
| --- | ||
|
|
||
| ## constants/ | ||
|
|
||
| Centralized constants for timeouts, gestures, colors, errors, and text. | ||
|
|
||
| - **timeouts.ts** | ||
| All timeout values organized by operation type. | ||
|
|
||
| - **gestures.ts** | ||
| Gesture configuration for swipes, scrolls, etc. Used for user interaction simulations. | ||
|
|
||
| - **colors.ts** | ||
| Sefaria brand colors and color thresholds. | ||
|
|
||
| - **errors.ts** | ||
| Error message templates and logging helpers. | ||
|
|
||
| - **text_constants.ts** | ||
| Text snippets, Hebrew months, and other static text. | ||
|
|
||
| - **index.ts** | ||
| Central import point for all constants, with dynamic platform selector loading. | ||
| This file **automatically loads the correct selectors** at runtime based on the current platform (Android or iOS), so you can always import `Selectors` from `constants` and it will "just work". | ||
|
|
||
| --- | ||
|
|
||
| ## tests/ | ||
|
|
||
| Where your actual test suites live. | ||
|
|
||
| - **regression.spec.ts** | ||
| Main end-to-end regression test suite. Used for full app validation. | ||
|
|
||
| - **sanity.spec.ts** | ||
| Quick sanity checks to verify basic app functionality. Runs faster than full regression. Used for quick validation. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe mention why/how it runs faster |
||
|
|
||
| - **\*.spec.ts** | ||
| Add new test files for specific features or components. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too, I don't think this line is needed |
||
|
|
||
| --- | ||
|
|
||
| ## utils/ | ||
|
|
||
| Helper modules for low-level actions, API calls, and cross-cutting concerns. | ||
|
|
||
| - **browserstack_report.ts** | ||
| Helpers for interacting with the BrowserStack session API (set session status, report results). | ||
|
|
||
| - **gesture.ts** | ||
| Gesture and scrolling utilities: swipe, scroll, and element search with screen dimension caching. | ||
|
|
||
| - **helper_functions.ts** | ||
| General-purpose helpers: text escaping, color conversion, date formatting, and assertion helpers. | ||
|
|
||
| - **load_credentials.ts** | ||
| Loads environment variables and credentials from `.env` file in the root directory of `automatic-e2e-tests/`. | ||
|
|
||
| - **PopUps.ts** | ||
| Handles the initial offline popup in the app. | ||
|
|
||
| - **sefariaAPI.ts** | ||
| Fetches and caches data from the Sefaria API. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You change the naming convention in popups and sefariaApi There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, this could potentially be a POM. |
||
|
|
||
| - **text_finder.ts** | ||
| Locates and interacts with text and elements by text or content-desc, and more. **Important:** Used all across tests and functions. | ||
|
|
||
| - **ui_checker.ts** | ||
| Checks pixel colors of UI elements and viewgroups. | ||
|
|
||
| - **index.ts** | ||
| Central import point for all utilities. | ||
|
|
||
| - **\*.ts** | ||
| Add new utility functions as needed. | ||
|
|
||
| --- | ||
|
|
||
| _Last updated: July 2025_ | ||
|
|
||
| --- | ||
|
|
||
| [⬅ README](./README.md) | ||
Uh oh!
There was an error while loading. Please reload this page.