{"id":50308516,"url":"https://github.com/reyadhsupto/mobilewright-typescript-automation","last_synced_at":"2026-05-28T18:30:48.287Z","repository":{"id":357793778,"uuid":"1225359860","full_name":"reyadhsupto/mobilewright-typescript-automation","owner":"reyadhsupto","description":"Hybrid(andoid,ios) automation framework built using mobilewright and typescript following screen object model(SOM).","archived":false,"fork":false,"pushed_at":"2026-05-14T08:55:13.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-14T10:43:19.505Z","etag":null,"topics":["app-automation","mobilewright","playwright-typescript","test-automation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reyadhsupto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-30T07:43:19.000Z","updated_at":"2026-05-14T08:55:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/reyadhsupto/mobilewright-typescript-automation","commit_stats":null,"previous_names":["reyadhsupto/mobilewright-typescript-automation"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/reyadhsupto/mobilewright-typescript-automation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyadhsupto%2Fmobilewright-typescript-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyadhsupto%2Fmobilewright-typescript-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyadhsupto%2Fmobilewright-typescript-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyadhsupto%2Fmobilewright-typescript-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reyadhsupto","download_url":"https://codeload.github.com/reyadhsupto/mobilewright-typescript-automation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyadhsupto%2Fmobilewright-typescript-automation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33622066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app-automation","mobilewright","playwright-typescript","test-automation"],"created_at":"2026-05-28T18:30:41.703Z","updated_at":"2026-05-28T18:30:48.125Z","avatar_url":"https://github.com/reyadhsupto.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mobilewright-typescript-automation\n\nHybrid (Android, iOS) automation framework built using **mobilewright** and **TypeScript** following the **Screen Object Model (SOM)** pattern.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Installation](#installation)\n- [Framework Setup](#framework-setup)\n- [Available Commands](#available-commands)\n- [Architecture](#architecture)\n- [BaseScreen Class](#basescreen-class)\n- [Page Objects](#page-objects)\n- [Writing Tests](#writing-tests)\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js (v14 or higher)\n- npm or yarn\n- Git\n- Connected Android/iOS device or emulator\n\n### Quick Start\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/reyadhsupto/mobilewright-typescript-automation.git\n   cd mobilewright-typescript-automation\n   ```\n\n2. **Install dependencies:**\n   ```bash\n   npm install\n   ```\n\n3. **Install mobilewright agents:**\n   ```bash\n   npm run mobilewright:install\n   ```\n\n4. **List connected devices:**\n   ```bash\n   npx mobilewright devices\n   ```\n\n5. **Run tests:**\n   ```bash\n   npx mobilewright test\n   ```\n\n---\n\n## Installation\n\n### Install mobilewright\n\n```bash\nnpm install mobilewright\nnpm install --save-dev @mobilewright/test\n```\n\n### Install mobilewright agents\n\nRequired for platform-specific automation:\n\n```bash\nnpm run mobilewright:install\n```\n\nOr directly:\n\n```bash\nnpx mobilewright install\n```\n\n---\n\n## Framework Setup\n\n### Project Structure\n\n```\nsrc/\n└── screens/\n    ├── baseScreen.ts              # Base class for all screen objects\n    ├── popupScreen.ts             # Popup handling\n    └── estimationScreen.ts        # Estimation/booking flow\n\ntests/\n└── example.spec.ts                # Example test file\n\nmobilewright.config.ts             # Configuration file\npackage.json                        # Dependencies\n```\n\n### Configuration\n\nEdit `mobilewright.config.ts` to set up your device:\n\n```typescript\nimport { defineConfig } from 'mobilewright';\n\nexport default defineConfig({\n  platform: 'android',                    // 'android' or 'ios'\n  bundleId: 'com.pathao.user.qa',        // Your app bundle ID\n  deviceName: /Redmi Note 12/,           // Device name pattern\n  deviceId: 'fe574666',                  // Device ID\n  timeout: 30_000,                       // Default timeout in ms\n  testDir: './tests'                     // Test directory\n});\n```\n\n---\n\n## Available Commands\n\n### NPM Scripts\n\n```bash\n# Run all tests\nnpm test\n# or\nnpx mobilewright test\n\n# Run specific test file\nnpx mobilewright test tests/example.spec.ts\n\n# List connected devices\nnpx mobilewright devices\n\n# Install mobilewright agents\nnpm run mobilewright:install\n```\n\n### Manual Commands\n\n```bash\n# Install mobilewright globally\nnpm install -g mobilewright\n\n# Install required agents\nnpx mobilewright install\n\n# List available devices\nnpx mobilewright devices\n\n# Run tests\nnpx mobilewright test [path/to/test]\n\n# Run tests with watch mode\nnpx mobilewright test --watch\n```\n\n---\n\n## Architecture\n\n### Screen Object Model (SOM)\n\nThis framework follows the **Screen Object Model** pattern where:\n\n- Each screen/page is represented as a class\n- All interactions with elements are encapsulated in methods\n- Tests remain clean and maintainable\n- Locators are centralized and reusable\n\n### Pattern Structure\n\n```\nBaseScreen\n├── PopupScreen\n├── EstimationScreen\n└── [Other Screen Objects]\n\nTest File\n├── Initialize Screen Objects\n├── Perform Actions (via screen methods)\n└── Assert Results\n```\n\n---\n\n## BaseScreen Class\n\nThe `BaseScreen` is the foundation class that all screen objects extend. It provides common functionality and methods for interacting with elements.\n\n### Features\n\n- **Locator Methods** - Find elements by various selectors\n- **Action Methods** - Tap, fill, swipe, scroll, etc.\n- **Assertion Methods** - Verify element states\n- **Utility Methods** - Logging, screenshots, waits\n\n### Key Methods\n\n#### Locator Methods\n\n```typescript\n// Get element by test ID (accessibility identifier)\nconst locator = await screen.getByTestId('com.app:id/elementId');\n\n// Get element by visible text\nconst locator = await screen.getByText('Button Text');\n\n// Get element by exact text\nconst locator = await screen.getByText('Exact Text', true);\n\n// Get element by type\nconst locator = await screen.getByType('Button');\n\n// Get element by placeholder\nconst locator = await screen.getByPlaceholder('Enter email');\n\n// Get element by accessibility label\nconst locator = await screen.getByLabel('Continue');\n\n// Get element by semantic role\nconst locator = await screen.getByRole('button', 'Submit');\n```\n\n#### Action Methods\n\n```typescript\n// Tap/Click element\nawait screen.tap(locator, timeout);\n\n// Double tap element\nawait screen.doubleTap(locator, timeout);\n\n// Long press element\nawait screen.longPress(locator, duration, timeout);\n\n// Fill text input\nawait screen.fill(locator, 'text', timeout);\n\n// Get element text\nconst text = await screen.getText(locator, timeout);\n\n// Get input value\nconst value = await screen.getValue(locator, timeout);\n\n// Swipe on screen\nawait screen.swipeScreen({ direction: 'up', distance: 200 });\n\n// Swipe element\nawait screen.swipeElement(locator, 'down', options);\n\n// Scroll element into view\nawait screen.scrollIntoView(locator, timeout);\n\n// Wait for time\nawait screen.waitForTime(5000, 'Waiting for page load');\n```\n\n#### State Check Methods\n\n```typescript\n// Check if element is visible\nconst isVisible = await screen.isVisible(locator);\n\n// Check if element is enabled\nconst isEnabled = await screen.isEnabled(locator);\n\n// Check if element is selected\nconst isSelected = await screen.isSelected(locator);\n\n// Check if element is focused\nconst isFocused = await screen.isFocused(locator);\n\n// Check if checkbox/switch is checked\nconst isChecked = await screen.isChecked(locator);\n```\n\n#### Assertion Methods\n\n```typescript\n// Assert element is visible\nawait screen.assertVisible(locator);\n\n// Assert element is NOT visible\nawait screen.assertNotVisible(locator);\n\n// Assert element is enabled\nawait screen.assertEnabled(locator);\n\n// Assert element is disabled\nawait screen.assertDisabled(locator);\n\n// Assert element has text\nawait screen.assertText(locator, 'Expected Text');\n\n// Assert element contains text\nawait screen.assertContainsText(locator, 'Partial Text');\n```\n\n#### Utility Methods\n\n```typescript\n// Log view tree for debugging\nawait screen.logTree();\n\n// Take screenshot\nawait screen.takeScreenshot('screenshot.png', 'jpeg');\n```\n\n---\n\n## Page Objects\n\n### PopupScreen\n\nHandles popup dialogs and modal interactions.\n\n**Methods:**\n- `isPopupVisible()` - Check if popup is visible\n- `waitForPopupToDisappear(timeout)` - Wait for popup to close (default: 15s)\n- `getPopupDetails()` - Get all popup element details\n- `printDebugInfo()` - Print debug information\n\n**Example Usage:**\n\n```typescript\nconst popupScreen = new PopupScreen(screen);\n\nconst isVisible = await popupScreen.isPopupVisible();\nif (isVisible) {\n  await popupScreen.waitForPopupToDisappear(15000);\n}\n```\n\n### EstimationScreen\n\nHandles estimation/booking flow interactions.\n\n**Methods:**\n- `clickAddressInput(timeout?)` - Click address field\n- `fillAddressInput(address, timeout?)` - Fill address text\n- `clickAndFillAddress(address, timeout?)` - Click and fill combined\n- `selectAddressFromSuggestion(text, timeout?)` - Select from dropdown\n- `selectBikeService(timeout?)` - Select bike option\n- `openPaymentOptions(timeout?)` - Open payment menu\n- `selectCashPayment(timeout?)` - Select cash payment\n- `clickChooseButton(timeout?)` - Click choose button\n- `clickConfirmPickup(timeout?)` - Confirm pickup\n- `completeEstimationFlow(address, suggestion)` - Complete full flow\n- `verifyAddressInputVisible()` - Assert address is visible\n- `printDebugInfo()` - Print debug info\n\n**Example Usage:**\n\n```typescript\nconst estimationScreen = new EstimationScreen(screen);\n\nawait estimationScreen.selectBikeService(15000);\nawait estimationScreen.clickAndFillAddress('airport', 15000);\nawait estimationScreen.selectAddressFromSuggestion('Hazrat Shahjalal International Airport', 15000);\n```\n\n---\n\n## Writing Tests\n\n### Basic Test Structure\n\n```typescript\nimport { test, expect } from '@mobilewright/test';\nimport { PopupScreen } from '../src/screens/popupScreen';\nimport { EstimationScreen } from '../src/screens/estimationScreen';\n\ntest('Complete booking flow', async ({ screen, device }) =\u003e {\n  // Initialize page objects\n  const popupScreen = new PopupScreen(screen);\n  const estimationScreen = new EstimationScreen(screen);\n\n  // Check for popup\n  const isPopupVisible = await popupScreen.isPopupVisible();\n  if (isPopupVisible) {\n    await popupScreen.waitForPopupToDisappear(15000);\n  }\n\n  // Select service and fill address\n  await estimationScreen.selectBikeService(15000);\n  await estimationScreen.clickAndFillAddress('airport', 15000);\n\n  // Assert results\n  await estimationScreen.verifyAddressInputVisible();\n});\n```\n\n### Test Best Practices\n\n1. **Use page objects** - Never interact with elements directly in tests\n2. **Use meaningful timeouts** - Different operations need different timeouts\n3. **Add logging** - Methods already include console.log for debugging\n4. **Handle errors gracefully** - Try-catch where necessary\n5. **Use descriptive names** - Make test purposes clear\n\n---\n\n## Debugging\n\n### View Tree\n\nLog the current screen structure:\n\n```typescript\nawait screen.logTree();\n```\n\n### Screenshots\n\nCapture screen state:\n\n```typescript\nawait screen.takeScreenshot('debug.png', 'jpeg');\n```\n\n### Debug Info\n\nPage objects include debug methods:\n\n```typescript\nawait estimationScreen.printDebugInfo();\n```\n\n---\n\n## Resources\n\n- [Mobilewright Documentation](https://mobilewright.dev/docs/)\n- [Mobilewright GitHub](https://github.com/mobile-next/mobilewright)\n- [TypeScript Documentation](https://www.typescriptlang.org/docs/)\n\n---\n\n## Contributing\n\n1. Follow the Screen Object Model pattern\n2. Always extend BaseScreen for new page objects\n3. Add comprehensive JSDoc comments\n4. Test your changes before committing\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\nHappy Testing!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyadhsupto%2Fmobilewright-typescript-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freyadhsupto%2Fmobilewright-typescript-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyadhsupto%2Fmobilewright-typescript-automation/lists"}