├── .all-contributorsrc ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ ├── feature_request.yml │ └── query.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── browserstack-app.yml │ ├── codeql-analysis.yml │ ├── publish.yml │ ├── stale.yml │ └── test.yml ├── .gitignore ├── .gitpod.yml ├── .talismanrc ├── LICENSE ├── README.md ├── assets ├── android-test.gif ├── browserstack-logo-600x315.png ├── coteafs-appium-logo.png └── semver.png ├── checkstyle-suppressions.xml ├── checkstyle.xml ├── lombok.config ├── pom.xml ├── setting └── settings.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── wasiqb │ │ │ └── coteafs │ │ │ └── appium │ │ │ ├── android │ │ │ ├── AndroidActivity.java │ │ │ ├── AndroidActivityActions.java │ │ │ ├── AndroidDevice.java │ │ │ ├── AndroidDeviceActions.java │ │ │ ├── AndroidDeviceElementActions.java │ │ │ ├── AndroidElementVerify.java │ │ │ └── system │ │ │ │ ├── AlertActivity.java │ │ │ │ └── PermissionActivity.java │ │ │ ├── checker │ │ │ ├── DeviceChecker.java │ │ │ └── ServerChecker.java │ │ │ ├── config │ │ │ ├── AppiumSetting.java │ │ │ ├── device │ │ │ │ ├── DelaySetting.java │ │ │ │ ├── DeviceSetting.java │ │ │ │ ├── OtherSetting.java │ │ │ │ ├── PlaybackSetting.java │ │ │ │ ├── RecordSetting.java │ │ │ │ ├── ScreenshotSetting.java │ │ │ │ ├── VideoStreamSetting.java │ │ │ │ ├── android │ │ │ │ │ ├── AdbSetting.java │ │ │ │ │ ├── AndroidAppSetting.java │ │ │ │ │ ├── AndroidDeviceSetting.java │ │ │ │ │ ├── AndroidVideoSetting.java │ │ │ │ │ ├── AndroidWebSetting.java │ │ │ │ │ ├── AvdSetting.java │ │ │ │ │ ├── WebOptions.java │ │ │ │ │ └── WebPerformancePreferences.java │ │ │ │ └── ios │ │ │ │ │ ├── IOSAppSetting.java │ │ │ │ │ ├── IOSDeviceSetting.java │ │ │ │ │ ├── IOSVideoSetting.java │ │ │ │ │ ├── IOSWebSetting.java │ │ │ │ │ └── WDASetting.java │ │ │ ├── enums │ │ │ │ ├── ApplicationType.java │ │ │ │ ├── AutomationType.java │ │ │ │ ├── Browser.java │ │ │ │ ├── ClipboardType.java │ │ │ │ ├── CloudProviders.java │ │ │ │ ├── DeviceType.java │ │ │ │ ├── KeyCode.java │ │ │ │ ├── Language.java │ │ │ │ ├── LogLevel.java │ │ │ │ ├── PlatformType.java │ │ │ │ ├── Protocol.java │ │ │ │ ├── SwipeDirection.java │ │ │ │ ├── SwipeStartPosition.java │ │ │ │ ├── UnlockType.java │ │ │ │ ├── VideoQuality.java │ │ │ │ └── WaitStrategy.java │ │ │ └── server │ │ │ │ ├── AndroidSetting.java │ │ │ │ ├── IOSSetting.java │ │ │ │ ├── LogSetting.java │ │ │ │ └── ServerSetting.java │ │ │ ├── constants │ │ │ └── ErrorMessage.java │ │ │ ├── device │ │ │ ├── Device.java │ │ │ ├── DeviceActions.java │ │ │ ├── DeviceActivity.java │ │ │ ├── DeviceActivityActions.java │ │ │ ├── DeviceElement.java │ │ │ ├── DeviceElementActions.java │ │ │ └── DeviceElementVerify.java │ │ │ ├── error │ │ │ ├── AppiumConfigParameterNotFoundError.java │ │ │ ├── AppiumSelectorNotImplementedError.java │ │ │ ├── AppiumServerAlreadyRunningError.java │ │ │ ├── AppiumServerLogFileError.java │ │ │ ├── AppiumServerNotRunningError.java │ │ │ ├── AppiumServerNotStartingError.java │ │ │ ├── AppiumServerNotStoppingError.java │ │ │ ├── AppiumServerStoppedError.java │ │ │ ├── CoteafsAppiumError.java │ │ │ ├── DeviceAppNotClosingError.java │ │ │ ├── DeviceAppNotFoundError.java │ │ │ ├── DeviceDesiredCapabilitiesNotSetError.java │ │ │ ├── DeviceDriverDefaultWaitError.java │ │ │ ├── DeviceDriverInitializationFailedError.java │ │ │ ├── DeviceDriverNotStartingError.java │ │ │ ├── DeviceDriverNotStoppingError.java │ │ │ ├── DeviceElementDisabledError.java │ │ │ ├── DeviceElementFindTimedOutError.java │ │ │ ├── DeviceElementNameNotFoundError.java │ │ │ ├── DeviceElementNotDisplayedError.java │ │ │ ├── DeviceElementNotFoundError.java │ │ │ ├── DeviceTypeNotSupportedError.java │ │ │ └── NotEnoughBatteryChargeError.java │ │ │ ├── ios │ │ │ ├── IOSActivity.java │ │ │ ├── IOSActivityActions.java │ │ │ ├── IOSDevice.java │ │ │ ├── IOSDeviceActions.java │ │ │ ├── IOSDeviceElementActions.java │ │ │ └── IOSElementVerify.java │ │ │ ├── service │ │ │ └── AppiumServer.java │ │ │ └── utils │ │ │ ├── BatteryHealth.java │ │ │ ├── CapabilityUtils.java │ │ │ ├── ScreenRecorder.java │ │ │ └── SwipeUtils.java │ └── resources │ │ └── log4j2.yaml └── test │ ├── java │ └── com │ │ └── github │ │ └── wasiqb │ │ └── coetafs │ │ └── appium │ │ └── saucedemo │ │ └── android │ │ ├── SauceDemoTest.java │ │ ├── actions │ │ └── SuccessLoginAction.java │ │ └── page │ │ ├── DashboardPage.java │ │ ├── LoginPage.java │ │ └── components │ │ ├── FilterPopUp.java │ │ └── ProductItem.java │ └── resources │ ├── appium-config.yaml │ ├── apps │ ├── android │ │ └── saucedemo.apk │ └── ios │ │ ├── saucedemo.ipa │ │ └── saucedemo.zip │ └── listener-config.yml ├── testng-local.yaml └── testng.yaml /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "contributorsPerLine": 7, 7 | "contributorsSortAlphabetically": false, 8 | "badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-17BB8A.svg?style=for-the-badge&labelColor=000000)](#contributors)", 9 | "types": { 10 | "custom": { 11 | "symbol": "🔭", 12 | "description": "A custom contribution type.", 13 | "link": "[<%= symbol %>](<%= url %> \"<%= description %>\")," 14 | } 15 | }, 16 | "skipCi": true, 17 | "contributors": [], 18 | "projectName": "coteafs-appium", 19 | "projectOwner": "WasiqB", 20 | "repoType": "github", 21 | "repoHost": "https://github.com" 22 | } 23 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @WasiqB -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at wasbhamla2005@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | I appreciate your interest for contributing in enhancing and evolving the coteafs-appium framework. 4 | 5 | ### 1. Where to start from? 6 | 7 | If you've noticed a bug or have a question that doesn't belong on the 8 | [mailing list][] or [Stack Overflow][], [search the issue tracker][tracker] to see if 9 | someone else has already created a ticket. If not, go ahead and 10 | [add one][new issue]! 11 | 12 | ### 2. Want to fix an issue or add new feature? 13 | 14 | If this is something you think you can fix, then follow the following steps: 15 | 16 | #### Step 0: Discuss with us 17 | 18 | Before jumping on any ticket or any feature which you think should be there in the framework, discuss with us [here][groupdDevs]. Once you get go-ahead from us, you can proceed by following the steps mentioned hereafter. 19 | 20 | #### Step 1: Setup your E-mail in Git 21 | 22 | Assuming you have already done this. But if you are new and may forget this, you can do it as described [here][setup]. 23 | 24 | #### Step 2: Fork and clone coteafs-appium 25 | 26 | To Fork **coteafs-appium** and clone it, see this useful [post][fork]. 27 | 28 | #### Step 3: Create new Branch 29 | 30 | Now create a new branch with descriptive name in your forked repo. Refer [here][branch] to know about Git branches. 31 | 32 | #### Step 4: Make changes 33 | 34 | Make changes and commit it in your newly created branch. Also write Javadocs for methods, unit tests, update the [CHANGELOG][changelogs]. 35 | 36 | #### Step 5: Commit with a descriptive message 37 | 38 | If committing a fix for a ticket, always start with `Fixed #[Ticket ID]` than describe the changes in detail. 39 | For an example on how to write a proper commit message, see [this][commitHelp] post. 40 | 41 | #### Step 6: Push changes to your cloned fork 42 | 43 | After committing the changes, you need to push the commit to your cloned repo by executing `git push origin your-branch-name` command in the terminal. 44 | 45 | #### Step 7: Send PR to us 46 | 47 | Sending Pull Request will be the last step of your contribution. To know how to raise a PR, see [this][pr] post. 48 | 49 | > **NOTE:** From your second contribution onwards, you can skip steps **(1) and (2)**. 50 | 51 | To run the build, 52 | 1. Configure your device details in 'appium-config.yaml' file available at `src/test/resources` under `devices/test`. 53 | 2. Connect Android/iOS devices to your machine or start the emulators. 54 | 3. Run the tests from the command prompt by executing `mvn clean install`. 55 | 56 | [mailing list]: https://groups.google.com/forum/#!forum/coteafs-appium-users 57 | [Stack Overflow]: http://stackoverflow.com/questions/tagged/coteafs-appium 58 | [tracker]: https://github.com/WasiqB/coteafs-appium/issues?q=something 59 | [new issue]: https://github.com/WasiqB/coteafs-appium/issues/new 60 | [fork]: https://help.github.com/articles/fork-a-repo/ 61 | [branch]: https://www.atlassian.com/git/tutorials/using-branches 62 | [setup]: https://help.github.com/articles/setting-your-commit-email-address-in-git 63 | [groupdDevs]: https://groups.google.com/forum/#!forum/coteafs-appium-devs 64 | [changelogs]: ../CHANGELOG.md 65 | [commitHelp]: https://github.com/erlang/otp/wiki/Writing-good-commit-messages 66 | [pr]: https://help.github.com/articles/creating-a-pull-request 67 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: WasiqB 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: "🐛 Bug report" 2 | description: Report errors or unexpected behavior in coteafs-appium framework. 3 | title: "[Bug]" 4 | labels: 5 | - "type: bug" 6 | body: 7 | - type: input 8 | attributes: 9 | label: Version? 10 | placeholder: 4.0.0 11 | description: The version of coteafs-appium which caused the issue. 12 | validations: 13 | required: true 14 | 15 | - type: dropdown 16 | attributes: 17 | label: Platform? 18 | description: Which platform caused the issue? 19 | multiple: false 20 | options: 21 | - Android 22 | - iOS 23 | - Both 24 | - NA 25 | validations: 26 | required: true 27 | 28 | - type: textarea 29 | attributes: 30 | label: Steps to reproduce 31 | description: We highly suggest including a screenshots and a bug report log (GitHub Gist link). 32 | placeholder: Tell us the steps required to trigger your bug. 33 | validations: 34 | required: true 35 | 36 | - type: textarea 37 | attributes: 38 | label: ✔️ Expected Behavior 39 | placeholder: What were you expecting? 40 | validations: 41 | required: true 42 | 43 | - type: textarea 44 | attributes: 45 | label: ❌ Actual Behavior 46 | placeholder: What happened instead? 47 | validations: 48 | required: true 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Want to discuss anything? 4 | url: https://github.com/WasiqB/coteafs-appium/discussions/new 5 | about: Create a discussion about it. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: "⭐ Feature / enhancement request" 2 | description: Propose something new in coteafs-appium framework. 3 | title: "[Feature]" 4 | labels: 5 | - "type: feature" 6 | body: 7 | - type: textarea 8 | attributes: 9 | label: Description of the new feature / enhancement 10 | placeholder: What is the expected behavior of the proposed feature? 11 | validations: 12 | required: true 13 | 14 | - type: textarea 15 | attributes: 16 | label: Scenario when this would be used? 17 | placeholder: | 18 | What is the scenario this would be used? Why is this important to your workflow? 19 | validations: 20 | required: true 21 | 22 | - type: textarea 23 | attributes: 24 | label: Supporting information 25 | placeholder: | 26 | Having additional evidence, data, tweets, blog posts, research, ... anything is extremely helpful. 27 | This information provides context to the scenario that may otherwise be lost. 28 | validations: 29 | required: false 30 | 31 | - type: markdown 32 | attributes: 33 | value: | 34 | Please limit one request per issue. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/query.yml: -------------------------------------------------------------------------------- 1 | name: "❓ Query" 2 | description: Any query related to coteafs-appium 3 | title: "[Query]" 4 | labels: 5 | - help 6 | body: 7 | - type: textarea 8 | attributes: 9 | label: Write your query here 10 | placeholder: What query you have? 11 | validations: 12 | required: true -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Closes: #[ticket no] 2 | 3 | ### What are the changes and their implications? 4 | Describe the changes done. 5 | 6 | ### Checklist 7 | Select all the applicable options: 8 | 9 | - [ ] Breaking (_non-backward compatible_) changes 10 | - [ ] Tests added for changes 11 | - [ ] JavaDoc updated in main and test classes 12 | - [ ] README updated (if applicable) 13 | - [ ] PR with the documentation for the feature raised in the [documentation repo](https://github.com/WasiqB/wasiqb.github.io) 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/browserstack-app.yml: -------------------------------------------------------------------------------- 1 | name: "Upload app to BrowserStack" 2 | 3 | on: 4 | schedule: 5 | - cron: "0 21 25 * *" 6 | workflow_dispatch: 7 | 8 | env: 9 | CLOUD_USER: ${{ secrets.CLOUD_USER }} 10 | CLOUD_KEY: ${{ secrets.CLOUD_KEY }} 11 | 12 | jobs: 13 | upload-app: 14 | name: "Upload App to BrowserStack" 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Check out Git repository 18 | uses: actions/checkout@v2 19 | 20 | - name: Upload Android App 21 | id: android_app_upload 22 | uses: fjogeleit/http-request-action@master 23 | with: 24 | url: https://api-cloud.browserstack.com/app-automate/upload 25 | method: POST 26 | username: ${{ env.CLOUD_USER }} 27 | password: ${{ env.CLOUD_KEY }} 28 | data: '{ "custom_id": "AndroidApp" }' 29 | files: '{ "file": "${{ github.workspace }}/src/test/resources/apps/android/saucedemo.apk" }' 30 | 31 | - name: Upload iOS App 32 | id: ios_app_upload 33 | uses: fjogeleit/http-request-action@master 34 | with: 35 | url: https://api-cloud.browserstack.com/app-automate/upload 36 | method: POST 37 | username: ${{ env.CLOUD_USER }} 38 | password: ${{ env.CLOUD_KEY }} 39 | data: '{ "custom_id": "IOSApp" }' 40 | files: '{ "file": "${{ github.workspace }}/src/test/resources/apps/ios/saucedemo.ipa" }' 41 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: 17 | - master 18 | - main 19 | - release 20 | - issue-* 21 | schedule: 22 | - cron: "0 21 * * *" 23 | 24 | jobs: 25 | analyze: 26 | name: Analyze 27 | runs-on: ubuntu-latest 28 | permissions: 29 | actions: read 30 | contents: read 31 | security-events: write 32 | 33 | strategy: 34 | fail-fast: false 35 | matrix: 36 | language: [ "java" ] 37 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 38 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | - name: Install Java and Maven 45 | uses: actions/setup-java@v2 46 | with: 47 | java-version: "15" 48 | distribution: "adopt" 49 | 50 | # Initializes the CodeQL tools for scanning. 51 | - name: Initialize CodeQL 52 | uses: github/codeql-action/init@v1 53 | with: 54 | languages: ${{ matrix.language }} 55 | # If you wish to specify custom queries, you can do so here or in a config file. 56 | # By default, queries listed here will override any specified in a config file. 57 | # Prefix the list here with "+" to use these queries and those in the config file. 58 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 59 | 60 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 61 | # If this step fails, then you should remove it and run the build manually (see below) 62 | - name: Autobuild 63 | uses: github/codeql-action/autobuild@v1 64 | 65 | # ℹ️ Command-line programs to run using the OS shell. 66 | # 📚 https://git.io/JvXDl 67 | 68 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 69 | # and modify them (or add more) to build your code if your project 70 | # uses a compiled language 71 | 72 | #- run: | 73 | # make bootstrap 74 | # make release 75 | 76 | - name: Perform CodeQL Analysis 77 | uses: github/codeql-action/analyze@v1 78 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Mark stale issues and pull requests 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * *" 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/stale@v3 13 | with: 14 | repo-token: ${{ github.token }} 15 | stale-issue-message: 'Ticket is stale since last 90 days.' 16 | stale-pr-message: 'PR is stale since last 90 days' 17 | stale-issue-label: 'no-issue-activity' 18 | stale-pr-label: 'no-pr-activity' 19 | days-before-stale: 90 20 | days-before-close: 120 21 | close-issue-message: 'Ticket is closed since no activity for last 120 days' 22 | close-pr-message: 'PR is closed without merge since last 120 days.' 23 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test coteafs-appium project 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - main 8 | - release 9 | - issue-* 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Check out Git repository 16 | uses: actions/checkout@v2 17 | 18 | - name: Install Java and Maven 19 | uses: actions/setup-java@v2 20 | with: 21 | java-version: '15' 22 | distribution: 'adopt' 23 | 24 | - name: Build the project 25 | run: mvn install -DskipTests 26 | 27 | - name: Upload target folder 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: target 31 | path: ${{ github.workspace }}/target 32 | 33 | - name: Cache local Maven repository 34 | uses: actions/cache@v2 35 | with: 36 | path: ~/.m2/repository 37 | key: ${{ runner.os }}-maven-${{ github.sha }} 38 | 39 | test: 40 | needs: 41 | - build 42 | runs-on: ubuntu-latest 43 | steps: 44 | - name: Check out Git repository 45 | uses: actions/checkout@v2 46 | 47 | - name: Install Java and Maven 48 | uses: actions/setup-java@v2 49 | with: 50 | java-version: '15' 51 | distribution: 'adopt' 52 | 53 | - name: Restore local Maven repository 54 | uses: actions/cache@v2 55 | with: 56 | path: ~/.m2/repository 57 | key: ${{ runner.os }}-maven-${{ github.sha }} 58 | 59 | - name: Download target folder 60 | uses: actions/download-artifact@v2 61 | with: 62 | name: target 63 | 64 | - name: Test execution 65 | env: 66 | CLOUD_USER: ${{ secrets.CLOUD_USER }} 67 | CLOUD_KEY: ${{ secrets.CLOUD_KEY }} 68 | APP: ${{ secrets.APP }} 69 | APP_IOS: ${{ secrets.APP_IOS }} 70 | run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test 71 | 72 | - name: Test Report 73 | uses: dorny/test-reporter@v1 74 | if: success() || failure() 75 | with: 76 | name: Test Results 77 | path: ${{ github.workspace }}/target/surefire-reports/*.xml 78 | reporter: java-junit 79 | 80 | - name: Upload target folder 81 | uses: actions/upload-artifact@v2 82 | with: 83 | name: target 84 | path: | 85 | ${{ github.workspace }}/target 86 | ${{ github.workspace }}/reports 87 | 88 | analysis: 89 | needs: 90 | - test 91 | runs-on: ubuntu-latest 92 | steps: 93 | - name: Check out Git repository 94 | uses: actions/checkout@v2 95 | with: 96 | fetch-depth: 0 97 | 98 | - name: Install Java and Maven 99 | uses: actions/setup-java@v2 100 | with: 101 | java-version: '15' 102 | distribution: 'adopt' 103 | 104 | - name: Restore local Maven repository 105 | uses: actions/cache@v2 106 | with: 107 | path: ~/.m2/repository 108 | key: ${{ runner.os }}-maven-${{ github.sha }} 109 | 110 | - name: Download target folder 111 | uses: actions/download-artifact@v2 112 | with: 113 | name: target 114 | 115 | - name: Analyse code 116 | env: 117 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 118 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 119 | run: mvn -B sonar:sonar -DskipTests -Dcheckstyle.skip -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ IDEA 2 | /.idea/ 3 | *.iml 4 | 5 | # Eclipse IDE 6 | /.settings/ 7 | /.classpath 8 | /.project 9 | 10 | # VS Code 11 | /.vscode 12 | 13 | # Other output folders 14 | /target/ 15 | /bin/ 16 | /test-output/ 17 | /logs/ 18 | /reports/ 19 | /videos/ 20 | /screenshots/ 21 | 22 | # Mac OSX 23 | .DS_Store -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | github: 2 | prebuilds: 3 | master: true 4 | branches: true 5 | pullRequests: true 6 | pullRequestsFromForks: true 7 | addCheck: true 8 | addComment: false 9 | addBadge: true 10 | tasks: 11 | - before: echo y | sdk install java 17.0.1-oracle 12 | init: mvn clean install -DskipTests 13 | -------------------------------------------------------------------------------- /.talismanrc: -------------------------------------------------------------------------------- 1 | fileignoreconfig: 2 | - filename: src/main/java/com/github/wasiqb/coteafs/appium/error/CoteafsAppiumError.java 3 | checksum: 08c96b7ca6d4bffee5d2a9fe16752f871b851c5aed0b9a92d7cf96017ec6027c 4 | ignore_detectors: [] 5 | - filename: src/main/java/com/github/wasiqb/coteafs/appium/config/ServerSetting.java 6 | checksum: a6419ab781cd6a0776827156f40b57ca48c264fd953c0fb0677e4500d4c46a7e 7 | ignore_detectors: [] 8 | scopeconfig: [] -------------------------------------------------------------------------------- /assets/android-test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/assets/android-test.gif -------------------------------------------------------------------------------- /assets/browserstack-logo-600x315.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/assets/browserstack-logo-600x315.png -------------------------------------------------------------------------------- /assets/coteafs-appium-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/assets/coteafs-appium-logo.png -------------------------------------------------------------------------------- /assets/semver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/assets/semver.png -------------------------------------------------------------------------------- /checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | 36 | 37 | 39 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | config.stopBubbling = true 2 | lombok.addLombokGeneratedAnnotation = true -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | appium 6 | 4.2.0 7 | Robust Automation Framework wrapped over Appium. 8 | https://github.com/WasiqB/coteafs-appium 9 | 2017 10 | 11 | 12 | com.github.wasiqb.coteafs 13 | parent 14 | 3.9.0 15 | 16 | 17 | 18 | scm:git:git@github.com:WasiqB/coteafs-appium.git 19 | scm:git:git@github.com:WasiqB/coteafs-appium.git 20 | git@github.com:WasiqB/coteafs-appium.git 21 | 22 | 23 | 24 | GitHub 25 | https://github.com/WasiqB/coteafs-appium/issues 26 | 27 | 28 | 29 | GitHub Actions 30 | https://github.com/WasiqB/coteafs-appium/actions 31 | 32 | 33 | 34 | 7.6.0 35 | 3.141.59 36 | 1.5.0 37 | 1.15.0 38 | 1.9 39 | 3.4.0 40 | 1.18.22 41 | 2.17.1 42 | 2.13.1 43 | 2.11.0 44 | com.github.wasiqb.coteafs:appium 45 | target/dependency/*.jar 46 | 47 | 48 | 49 | 50 | org.projectlombok 51 | lombok 52 | ${lombok.version} 53 | provided 54 | 55 | 56 | com.github.wasiqb.coteafs 57 | datasource 58 | ${coteafs.data.version} 59 | 60 | 61 | org.apache.commons 62 | commons-text 63 | ${commons.text.version} 64 | 65 | 66 | com.github.wasiqb.coteafs 67 | error 68 | ${coteafs.error.version} 69 | provided 70 | 71 | 72 | com.github.wasiqb.coteafs 73 | listeners 74 | ${coteafs.listeners.version} 75 | 76 | 77 | org.yaml 78 | snakeyaml 79 | ${snake.version} 80 | 81 | 82 | org.testng 83 | testng 84 | ${testng.version} 85 | provided 86 | 87 | 88 | com.google.guava 89 | guava 90 | 91 | 92 | 93 | 94 | org.apache.commons 95 | commons-lang3 96 | ${commons.version} 97 | provided 98 | 99 | 100 | com.google.truth 101 | truth 102 | ${truth.version} 103 | provided 104 | 105 | 106 | com.google.guava 107 | guava 108 | 109 | 110 | 111 | 112 | org.seleniumhq.selenium 113 | selenium-java 114 | ${selenium-version} 115 | 116 | 117 | com.google.guava 118 | guava 119 | ${guava.version} 120 | 121 | 122 | io.appium 123 | java-client 124 | ${appium-version} 125 | 126 | 127 | com.google.guava 128 | guava 129 | 130 | 131 | org.seleniumhq.selenium 132 | selenium-java 133 | 134 | 135 | 136 | 137 | org.apache.logging.log4j 138 | log4j-api 139 | ${log4j.version} 140 | 141 | 142 | org.apache.logging.log4j 143 | log4j-core 144 | ${log4j.version} 145 | 146 | 147 | com.fasterxml.jackson.dataformat 148 | jackson-dataformat-yaml 149 | ${jackson.version} 150 | 151 | 152 | com.fasterxml.jackson.core 153 | jackson-databind 154 | ${jackson.version} 155 | 156 | 157 | commons-io 158 | commons-io 159 | ${io.version} 160 | 161 | 162 | -------------------------------------------------------------------------------- /setting/settings.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 | 23 | ossrh 24 | 25 | true 26 | 27 | 28 | gpg 29 | ${env.GPG_PASSPHRASE} 30 | 31 | 32 | 33 | 34 | 35 | ossrh 36 | ${env.NEXUS_USERNAME} 37 | ${env.NEXUS_PASSWORD} 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/AndroidActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android; 17 | 18 | import static com.github.wasiqb.coteafs.appium.config.enums.AutomationType.UIAUTOMATOR2; 19 | import static com.github.wasiqb.coteafs.appium.utils.BatteryHealth.check; 20 | 21 | import com.github.wasiqb.coteafs.appium.device.DeviceActivity; 22 | import io.appium.java_client.MobileElement; 23 | import io.appium.java_client.android.AndroidBatteryInfo; 24 | import io.appium.java_client.android.AndroidDriver; 25 | import io.appium.java_client.android.AndroidTouchAction; 26 | import org.apache.logging.log4j.LogManager; 27 | import org.apache.logging.log4j.Logger; 28 | 29 | /** 30 | * @author wasiq.bhamla 31 | * @since 26-Apr-2017 6:19:46 PM 32 | */ 33 | public abstract class AndroidActivity 34 | extends DeviceActivity, AndroidDevice, AndroidTouchAction> { 35 | private static final Logger LOG = LogManager.getLogger (); 36 | 37 | /** 38 | * @param device Device instance 39 | * 40 | * @author wasiq.bhamla 41 | * @since 26-Apr-2017 6:20:08 PM 42 | */ 43 | protected AndroidActivity (final AndroidDevice device) { 44 | super (device, new AndroidTouchAction (device.getDriver ())); 45 | } 46 | 47 | /* 48 | * (non-Javadoc) 49 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActivity#onDevice() 50 | */ 51 | @Override 52 | public AndroidDeviceActions onDevice () { 53 | checkBattery (); 54 | LOG.trace ("Preparing to perform actions on Android device..."); 55 | return new AndroidDeviceActions (this.device); 56 | } 57 | 58 | /* 59 | * (non-Javadoc) 60 | * @see 61 | * com.github.wasiqb.coteafs.appium.device.DeviceActivity#onElement(java.lang. 62 | * String) 63 | */ 64 | @Override 65 | public AndroidDeviceElementActions onElement (final String name) { 66 | checkBattery (); 67 | LOG.trace ("Preparing to perform actions on Android device element [{}]...", name); 68 | return new AndroidDeviceElementActions (this.device, name, getElement (name)); 69 | } 70 | 71 | private void checkBattery () { 72 | if (this.device.getSetting () 73 | .getAutomation () == UIAUTOMATOR2 && !this.device.getSetting () 74 | .isCloud ()) { 75 | LOG.trace ("Checking Battery status..."); 76 | final AndroidBatteryInfo battery = this.device.getDriver () 77 | .getBatteryInfo (); 78 | check (battery.getState () 79 | .name (), battery.getLevel ()); 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/AndroidActivityActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android; 17 | 18 | import com.github.wasiqb.coteafs.appium.device.DeviceActivityActions; 19 | import io.appium.java_client.MobileElement; 20 | import io.appium.java_client.android.AndroidDriver; 21 | import io.appium.java_client.android.AndroidTouchAction; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since Oct 23, 2017 11:04:31 PM 26 | */ 27 | public abstract class AndroidActivityActions 28 | extends DeviceActivityActions, AndroidDevice, AndroidTouchAction> { 29 | /** 30 | * @param device Device instance 31 | * 32 | * @author wasiq.bhamla 33 | * @since Oct 23, 2017 11:05:14 PM 34 | */ 35 | protected AndroidActivityActions (final AndroidDevice device) { 36 | super (device); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/AndroidDevice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android; 17 | 18 | import com.github.wasiqb.coteafs.appium.config.device.android.AndroidVideoSetting; 19 | import com.github.wasiqb.coteafs.appium.device.Device; 20 | import com.github.wasiqb.coteafs.appium.service.AppiumServer; 21 | import io.appium.java_client.MobileElement; 22 | import io.appium.java_client.android.AndroidDriver; 23 | import io.appium.java_client.android.AndroidStartScreenRecordingOptions; 24 | import io.appium.java_client.android.AndroidStopScreenRecordingOptions; 25 | import io.appium.java_client.android.AndroidTouchAction; 26 | 27 | /** 28 | * @author wasiq.bhamla 29 | * @since 13-Apr-2017 5:32:01 PM 30 | */ 31 | public class AndroidDevice extends Device, AndroidTouchAction> { 32 | /** 33 | * @param server Server instance 34 | * @param name Device name 35 | * 36 | * @author wasiq.bhamla 37 | * @since 13-Apr-2017 9:12:47 PM 38 | */ 39 | public AndroidDevice (final AppiumServer server, final String name) { 40 | super (server, name); 41 | } 42 | 43 | /* 44 | * (non-Javadoc) 45 | * @see com.github.wasiqb.coteafs.appium.device.Device#startRecordSetting() 46 | */ 47 | @SuppressWarnings ("unchecked") 48 | @Override 49 | protected AndroidStartScreenRecordingOptions startRecordSetting () { 50 | final AndroidStartScreenRecordingOptions options = AndroidStartScreenRecordingOptions.startScreenRecordingOptions (); 51 | final AndroidVideoSetting record = this.setting.getPlayback () 52 | .getRecording () 53 | .getAndroid (); 54 | if (record.getBitRate () != 4) { 55 | options.withBitRate (record.getBitRate ()); 56 | } 57 | if (record.getSize () != null) { 58 | options.withVideoSize (record.getSize ()); 59 | } 60 | return options; 61 | } 62 | 63 | /* 64 | * (non-Javadoc) 65 | * @see com.github.wasiqb.coteafs.appium.device.Device#stopRecordSetting() 66 | */ 67 | @SuppressWarnings ("unchecked") 68 | @Override 69 | protected AndroidStopScreenRecordingOptions stopRecordSetting () { 70 | return AndroidStopScreenRecordingOptions.stopScreenRecordingOptions (); 71 | } 72 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/AndroidDeviceElementActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android; 17 | 18 | import com.github.wasiqb.coteafs.appium.config.enums.AutomationType; 19 | import com.github.wasiqb.coteafs.appium.device.DeviceElementActions; 20 | import io.appium.java_client.MobileElement; 21 | import io.appium.java_client.android.AndroidDriver; 22 | import io.appium.java_client.android.AndroidTouchAction; 23 | import org.apache.logging.log4j.LogManager; 24 | import org.apache.logging.log4j.Logger; 25 | 26 | /** 27 | * @author wasiq.bhamla 28 | * @since 02-May-2017 6:31:57 PM 29 | */ 30 | public class AndroidDeviceElementActions 31 | extends DeviceElementActions, AndroidDevice, AndroidTouchAction> { 32 | private static final Logger log = LogManager.getLogger (); 33 | 34 | /** 35 | * @param device Device instance 36 | * @param name Name of element 37 | * @param element Element under test 38 | * 39 | * @author wasiq.bhamla 40 | * @since 02-May-2017 6:32:14 PM 41 | */ 42 | public AndroidDeviceElementActions (final AndroidDevice device, final String name, final MobileElement element) { 43 | super (device, name, element, new AndroidTouchAction (device.getDriver ())); 44 | } 45 | 46 | /* 47 | * (non-Javadoc) 48 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#pinch(int) 49 | */ 50 | @Override 51 | public void pinch (final int distance) { 52 | if (this.device.getSetting () 53 | .getAutomation () == AutomationType.ESPRESSO) { 54 | super.pinch (distance); 55 | } else { 56 | log.warn ("Pinch is only available when Automation type is Espresso..."); 57 | } 58 | } 59 | 60 | /* 61 | * (non-Javadoc) 62 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#verifyThat() 63 | */ 64 | @Override 65 | public AndroidElementVerify verifyThat () { 66 | return new AndroidElementVerify (this); 67 | } 68 | 69 | /* 70 | * (non-Javadoc) 71 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#zoom(int) 72 | */ 73 | @Override 74 | public void zoom (final int distance) { 75 | if (this.device.getSetting () 76 | .getAutomation () == AutomationType.ESPRESSO) { 77 | super.zoom (distance); 78 | } else { 79 | log.warn ("Zoom is only available when Automation type is Espresso..."); 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/AndroidElementVerify.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android; 17 | 18 | import com.github.wasiqb.coteafs.appium.device.DeviceElementVerify; 19 | import io.appium.java_client.MobileElement; 20 | import io.appium.java_client.android.AndroidDriver; 21 | import io.appium.java_client.android.AndroidTouchAction; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since 20-May-2017 12:26:00 PM 26 | */ 27 | public class AndroidElementVerify 28 | extends DeviceElementVerify, AndroidDevice, AndroidTouchAction> { 29 | /** 30 | * @param actions Actions instance 31 | * 32 | * @author wasiq.bhamla 33 | * @since 20-May-2017 12:26:38 PM 34 | */ 35 | public AndroidElementVerify (final AndroidDeviceElementActions actions) { 36 | super (actions); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/system/AlertActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android.system; 17 | 18 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 19 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 20 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 21 | import org.openqa.selenium.By; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since Feb 8, 2018 3:44:36 PM 26 | */ 27 | public class AlertActivity extends AndroidActivity { 28 | /** 29 | * @param device Device instance 30 | * 31 | * @author wasiq.bhamla 32 | * @since Feb 8, 2018 3:44:36 PM 33 | */ 34 | public AlertActivity (final AndroidDevice device) { 35 | super (device); 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActivity#prepare() 41 | */ 42 | @Override 43 | protected DeviceElement prepare () { 44 | final DeviceElement alert = DeviceElement.create ("Alert") 45 | .forAndroid (By.id ("android:id/parentPanel")); 46 | 47 | DeviceElement.create ("Title") 48 | .parent (alert) 49 | .forAndroid (By.id ("android:id/alertTitle")); 50 | DeviceElement.create ("Message") 51 | .parent (alert) 52 | .forAndroid (By.id ("android:id/message")); 53 | DeviceElement.create ("OK") 54 | .parent (alert) 55 | .forAndroid (By.id ("android:id/button1")); 56 | 57 | return alert; 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/android/system/PermissionActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.android.system; 17 | 18 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 19 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 20 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 21 | import org.openqa.selenium.By; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since 10-May-2017 7:53:52 PM 26 | */ 27 | public class PermissionActivity extends AndroidActivity { 28 | /** 29 | * @param device Device instance 30 | * 31 | * @author wasiq.bhamla 32 | * @since 10-May-2017 7:53:57 PM 33 | */ 34 | public PermissionActivity (final AndroidDevice device) { 35 | super (device); 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActivity#build() 41 | */ 42 | @Override 43 | protected DeviceElement prepare () { 44 | final DeviceElement container = DeviceElement.create ("Permission Window") 45 | .forAndroid (By.id ("com.android.packageinstaller:id/dialog_container")); 46 | DeviceElement.create ("Message") 47 | .parent (container) 48 | .forAndroid (By.id ("com.android.packageinstaller:id/permission_message")); 49 | DeviceElement.create ("Allow") 50 | .parent (container) 51 | .forAndroid (By.id ("com.android.packageinstaller:id/permission_allow_button")); 52 | DeviceElement.create ("Deny") 53 | .parent (container) 54 | .forAndroid (By.id ("com.android.packageinstaller:id/permission_deny_button")); 55 | return container; 56 | } 57 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/checker/DeviceChecker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.checker; 17 | 18 | import static com.github.wasiqb.coteafs.error.util.ErrorUtil.fail; 19 | import static java.text.MessageFormat.format; 20 | 21 | import com.github.wasiqb.coteafs.appium.error.DeviceDesiredCapabilitiesNotSetError; 22 | import com.github.wasiqb.coteafs.appium.error.DeviceElementDisabledError; 23 | import com.github.wasiqb.coteafs.appium.error.DeviceElementNotDisplayedError; 24 | import io.appium.java_client.MobileElement; 25 | 26 | /** 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 4:30:02 PM 29 | */ 30 | public final class DeviceChecker { 31 | /** 32 | * @param key Capability key 33 | * @param value Capability value 34 | * 35 | * @author wasiq.bhamla 36 | * @since 12-May-2017 7:31:31 PM 37 | */ 38 | public static void checkCapabilitiesParams (final String key, final Object value) { 39 | if (value == null) { 40 | final String msg = "Device Desired Capabilities value for [{0}] key not set."; 41 | fail (DeviceDesiredCapabilitiesNotSetError.class, format (msg, key)); 42 | } 43 | } 44 | 45 | /** 46 | * @param element Element under test 47 | * @param name Name of element 48 | * 49 | * @author wasiq.bhamla 50 | * @since 04-May-2017 10:10:28 PM 51 | */ 52 | public static void checkDeviceElementDisplayed (final MobileElement element, final String name) { 53 | if (!element.isDisplayed ()) { 54 | final String msg = "Device element [{0}] is not displayed."; 55 | fail (DeviceElementNotDisplayedError.class, format (msg, name)); 56 | } 57 | } 58 | 59 | /** 60 | * @param element Element under test 61 | * @param name Name of element 62 | * 63 | * @author wasiq.bhamla 64 | * @since 04-May-2017 11:08:59 PM 65 | */ 66 | public static void checkDeviceElementEnabled (final MobileElement element, final String name) { 67 | if (!element.isEnabled ()) { 68 | final String msg = "Device element [{0}] is disabled."; 69 | fail (DeviceElementDisabledError.class, format (msg, name)); 70 | } 71 | } 72 | 73 | private DeviceChecker () { 74 | // Utility class. 75 | } 76 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/checker/ServerChecker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.checker; 17 | 18 | import static com.github.wasiqb.coteafs.error.util.ErrorUtil.fail; 19 | import static java.text.MessageFormat.format; 20 | 21 | import com.github.wasiqb.coteafs.appium.error.AppiumConfigParameterNotFoundError; 22 | import com.github.wasiqb.coteafs.appium.error.AppiumServerNotRunningError; 23 | import com.github.wasiqb.coteafs.appium.service.AppiumServer; 24 | 25 | /** 26 | * @author wasiq.bhamla 27 | * @since 09-May-2017 3:49:21 PM 28 | */ 29 | public final class ServerChecker { 30 | /** 31 | * @param key Config key 32 | * @param value Config value 33 | * 34 | * @author wasiq.bhamla 35 | * @since 09-May-2017 3:52:30 PM 36 | */ 37 | public static void checkServerConfigParams (final String key, final Object value) { 38 | if (value == null) { 39 | final String msg = "Server Config value for {0} key not set."; 40 | fail (AppiumConfigParameterNotFoundError.class, format (msg, key)); 41 | } 42 | } 43 | 44 | /** 45 | * @param server Server instance 46 | * 47 | * @author wasiq.bhamla 48 | * @since 04-May-2017 4:36:57 PM 49 | */ 50 | public static void checkServerRunning (final AppiumServer server) { 51 | if (!server.isRunning ()) { 52 | fail (AppiumServerNotRunningError.class, "Server not started yet."); 53 | } 54 | } 55 | 56 | private ServerChecker () { 57 | // Utility class. 58 | } 59 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/AppiumSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config; 17 | 18 | import java.util.Map; 19 | 20 | import com.github.wasiqb.coteafs.appium.config.device.DeviceSetting; 21 | import com.github.wasiqb.coteafs.appium.config.server.ServerSetting; 22 | import com.github.wasiqb.coteafs.datasource.annotation.DataFile; 23 | import lombok.Data; 24 | 25 | /** 26 | * @author wasiq.bhamla 27 | * @since 12-Apr-2017 8:58:57 PM 28 | */ 29 | @Data 30 | @DataFile (fileName = "appium-config.yaml") 31 | public class AppiumSetting { 32 | private DeviceSetting device; 33 | private Map devices; 34 | private ServerSetting server; 35 | private Map servers; 36 | 37 | /** 38 | * @param key Device key 39 | * 40 | * @return the device 41 | * 42 | * @author wasiq.bhamla 43 | * @since 12-Apr-2017 9:00:16 PM 44 | */ 45 | public DeviceSetting getDevice (final String key) { 46 | return this.devices.get (key); 47 | } 48 | 49 | /** 50 | * @param key Server key 51 | * 52 | * @return the server 53 | * 54 | * @author wasiq.bhamla 55 | * @since 12-Apr-2017 9:00:16 PM 56 | */ 57 | public ServerSetting getServer (final String key) { 58 | return this.servers.get (key); 59 | } 60 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/DelaySetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class DelaySetting { 28 | private long afterSwipe; 29 | private long afterTap; 30 | private long beforeSwipe; 31 | private long beforeTap; 32 | private int explicit = 30; 33 | private int implicit = 30; 34 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/DeviceSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | import com.github.wasiqb.coteafs.appium.config.device.android.AndroidDeviceSetting; 24 | import com.github.wasiqb.coteafs.appium.config.device.ios.IOSDeviceSetting; 25 | import com.github.wasiqb.coteafs.appium.config.enums.AutomationType; 26 | import com.github.wasiqb.coteafs.appium.config.enums.Browser; 27 | import com.github.wasiqb.coteafs.appium.config.enums.DeviceType; 28 | import com.github.wasiqb.coteafs.appium.config.enums.Language; 29 | import com.github.wasiqb.coteafs.appium.config.enums.PlatformType; 30 | import lombok.Data; 31 | 32 | /** 33 | * @author wasiq.bhamla 34 | * @since 12-Apr-2017 8:34:28 PM 35 | */ 36 | @Data 37 | public class DeviceSetting { 38 | private AndroidDeviceSetting android; 39 | private boolean autoWebView; 40 | private AutomationType automation = AutomationType.APPIUM; 41 | private Browser browser; 42 | private Map cloudCapabilities = new HashMap<> (); 43 | private boolean headless; 44 | private IOSDeviceSetting ios; 45 | private Language language = Language.US; 46 | private String name; 47 | private PlatformType os = PlatformType.ANDROID; 48 | private OtherSetting others = new OtherSetting (); 49 | private PlaybackSetting playback = new PlaybackSetting (); 50 | private int sessionTimeout = 60; 51 | private DeviceType type = DeviceType.SIMULATOR; 52 | private String version; 53 | 54 | /** 55 | * @return Cloud Capabilities 56 | * 57 | * @author Wasiq Bhamla 58 | * @since Mar 13, 2021 59 | */ 60 | public boolean isCloud () { 61 | return getCloudCapabilities ().size () > 0; 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/OtherSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class OtherSetting { 28 | private boolean clearFiles; 29 | private boolean clearLogs; 30 | private boolean fullReset; 31 | private boolean noReset; 32 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/PlaybackSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author wasiq.bhamla 24 | * @since Jan 18, 2018 9:32:14 PM 25 | */ 26 | @Data 27 | public class PlaybackSetting { 28 | private DelaySetting delay = new DelaySetting (); 29 | private int maxSwipeCount = 5; 30 | private RecordSetting recording = new RecordSetting (); 31 | private ScreenshotSetting screenshot = new ScreenshotSetting (); 32 | private VideoStreamSetting stream = new VideoStreamSetting (); 33 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/RecordSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import static java.lang.System.getProperty; 21 | import static java.text.MessageFormat.format; 22 | 23 | import com.github.wasiqb.coteafs.appium.config.device.android.AndroidVideoSetting; 24 | import com.github.wasiqb.coteafs.appium.config.device.ios.IOSVideoSetting; 25 | import lombok.Data; 26 | 27 | /** 28 | * @author wasiqb 29 | * @since Oct 13, 2018 30 | */ 31 | @Data 32 | public class RecordSetting { 33 | private AndroidVideoSetting android = new AndroidVideoSetting (); 34 | private boolean enabled; 35 | private IOSVideoSetting ios = new IOSVideoSetting (); 36 | private String path = format ("{0}/videos", getProperty ("user.dir")); 37 | private String prefix = "VID"; 38 | private int timeLimit = 3; 39 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ScreenshotSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import static java.lang.System.getProperty; 21 | import static java.text.MessageFormat.format; 22 | 23 | import lombok.Data; 24 | 25 | /** 26 | * @author Wasiq Bhamla 27 | * @since Mar 13, 2021 28 | */ 29 | @Data 30 | public class ScreenshotSetting { 31 | private boolean onError; 32 | private String path = format ("{0}/screenshots", getProperty ("user.dir")); 33 | private String prefix = "SCR"; 34 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/VideoStreamSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device; 19 | 20 | import com.github.wasiqb.coteafs.appium.config.enums.VideoQuality; 21 | import lombok.Data; 22 | 23 | /** 24 | * @author Wasiq Bhamla 25 | * @since Mar 13, 2021 26 | */ 27 | @Data 28 | public class VideoStreamSetting { 29 | private int bitRate = 20; 30 | private boolean enabled; 31 | private int height = 1024; 32 | private String host = "127.0.0.1"; 33 | private int port = 8093; 34 | private VideoQuality quality = VideoQuality.MEDIUM; 35 | private int width = 700; 36 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AdbSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class AdbSetting { 28 | private String host; 29 | private int port; 30 | private long timeout; 31 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AndroidAppSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.ApplicationType.NATIVE; 21 | import static org.apache.commons.lang3.StringUtils.EMPTY; 22 | 23 | import java.util.List; 24 | 25 | import com.github.wasiqb.coteafs.appium.config.enums.ApplicationType; 26 | import lombok.Data; 27 | 28 | /** 29 | * @author Wasiq Bhamla 30 | * @since Mar 13, 2021 31 | */ 32 | @Data 33 | public class AndroidAppSetting { 34 | private String activityName = EMPTY; 35 | private boolean external; 36 | private boolean grantPermission; 37 | private boolean ignoreUnimportantViews; 38 | private long installTimeout = 90000; 39 | private boolean noStopOnReset; 40 | private List otherApps; 41 | private String packageName = EMPTY; 42 | private String path = EMPTY; 43 | private ApplicationType type = NATIVE; 44 | private String waitActivity = EMPTY; 45 | private String waitPackage = EMPTY; 46 | private long waitTimeout = 20000; 47 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AndroidDeviceSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import com.github.wasiqb.coteafs.appium.config.enums.UnlockType; 21 | import lombok.Data; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since Jan 18, 2018 9:05:52 PM 26 | */ 27 | @Data 28 | public class AndroidDeviceSetting { 29 | private AdbSetting adb = new AdbSetting (); 30 | private AndroidAppSetting app = new AndroidAppSetting (); 31 | private AvdSetting avd = new AvdSetting (); 32 | private boolean disableAnimation; 33 | private boolean skipDeviceInit; 34 | private boolean skipServerInstall; 35 | private boolean skipUnlock; 36 | private int systemPort; 37 | private String unlockKey; 38 | private UnlockType unlockType; 39 | private AndroidWebSetting web = new AndroidWebSetting (); 40 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AndroidVideoSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class AndroidVideoSetting { 28 | private int bitRate = 4; 29 | private String size = "500x720"; 30 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AndroidWebSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import static org.apache.commons.lang3.StringUtils.EMPTY; 21 | 22 | import lombok.Data; 23 | 24 | /** 25 | * @author Wasiq Bhamla 26 | * @since Mar 13, 2021 27 | */ 28 | @Data 29 | public class AndroidWebSetting { 30 | private boolean acceptSslCerts = true; 31 | private String chromeDriverPath = EMPTY; 32 | private boolean nativeScreenshot; 33 | private WebOptions options = new WebOptions (); 34 | private boolean showBrowserLogs; 35 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/AvdSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import static io.appium.java_client.android.NetworkSpeed.FULL; 21 | import static org.apache.commons.lang3.StringUtils.EMPTY; 22 | 23 | import io.appium.java_client.android.NetworkSpeed; 24 | import lombok.Data; 25 | 26 | /** 27 | * @author Wasiq Bhamla 28 | * @since Mar 13, 2021 29 | */ 30 | @Data 31 | public class AvdSetting { 32 | private String args = EMPTY; 33 | private long launchTimeout = 120000; 34 | private String name = EMPTY; 35 | private NetworkSpeed networkSpeed = FULL; 36 | private long readyTimeout = 120000; 37 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/WebOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import java.util.List; 21 | 22 | import lombok.Data; 23 | 24 | /** 25 | * @author Wasiq Bhamla 26 | * @since Mar 13, 2021 27 | */ 28 | @Data 29 | public class WebOptions { 30 | private List args; 31 | private WebPerformancePreferences performancePreferences = new WebPerformancePreferences (); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/android/WebPerformancePreferences.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.android; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class WebPerformancePreferences { 28 | private boolean network = false; 29 | private boolean page = false; 30 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ios/IOSAppSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.ios; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.ApplicationType.NATIVE; 21 | import static org.apache.commons.lang3.StringUtils.EMPTY; 22 | 23 | import com.github.wasiqb.coteafs.appium.config.enums.ApplicationType; 24 | import lombok.Data; 25 | 26 | /** 27 | * @author Wasiq Bhamla 28 | * @since Mar 13, 2021 29 | */ 30 | @Data 31 | public class IOSAppSetting { 32 | private String bundleId = EMPTY; 33 | private boolean external; 34 | private long launchTimeout = 20000; 35 | private String path = EMPTY; 36 | private ApplicationType type = NATIVE; 37 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ios/IOSDeviceSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.ios; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author wasiq.bhamla 24 | * @since Jan 18, 2018 9:11:11 PM 25 | */ 26 | @Data 27 | public class IOSDeviceSetting { 28 | private IOSAppSetting app = new IOSAppSetting (); 29 | private boolean autoAcceptAlerts; 30 | private WDASetting wda = new WDASetting (); 31 | private IOSWebSetting web = new IOSWebSetting (); 32 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ios/IOSVideoSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.ios; 19 | 20 | import static io.appium.java_client.ios.IOSStartScreenRecordingOptions.VideoQuality.MEDIUM; 21 | 22 | import io.appium.java_client.ios.IOSStartScreenRecordingOptions.VideoQuality; 23 | import lombok.Data; 24 | 25 | /** 26 | * @author Wasiq Bhamla 27 | * @since Mar 13, 2021 28 | */ 29 | @Data 30 | public class IOSVideoSetting { 31 | private String codec = "mpeg4"; 32 | private int fps = 10; 33 | private VideoQuality quality = MEDIUM; 34 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ios/IOSWebSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.ios; 19 | 20 | import static org.apache.commons.lang3.StringUtils.EMPTY; 21 | 22 | import lombok.Data; 23 | 24 | /** 25 | * @author Wasiq Bhamla 26 | * @since Mar 13, 2021 27 | */ 28 | @Data 29 | public class IOSWebSetting { 30 | private boolean allowPopups; 31 | private boolean consoleLogs; 32 | private String initialUrl = EMPTY; 33 | private boolean nativeTaps; 34 | private boolean networkLogs; 35 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/device/ios/WDASetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.device.ios; 19 | 20 | import static org.apache.commons.lang3.StringUtils.EMPTY; 21 | 22 | import lombok.Data; 23 | 24 | /** 25 | * @author Wasiq Bhamla 26 | * @since Mar 13, 2021 27 | */ 28 | @Data 29 | public class WDASetting { 30 | private String agentPath = EMPTY; 31 | private String bootstrapPath = EMPTY; 32 | private long connectionTimeout; 33 | private long launchTimeout = 60000; 34 | private int localPort = 8100; 35 | private String signingId = EMPTY; 36 | private int startupRetries = 2; 37 | private long startupRetryInterval = 10000; 38 | private String teamId = EMPTY; 39 | private String updateBundleId = EMPTY; 40 | private boolean useNew; 41 | private boolean usePrebuilt; 42 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/ApplicationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 12-Apr-2017 8:37:00 PM 21 | */ 22 | public enum ApplicationType { 23 | /** 24 | * Hybrid App. 25 | */ 26 | HYBRID, 27 | /** 28 | * Native App. 29 | */ 30 | NATIVE, 31 | /** 32 | * Web App. 33 | */ 34 | WEB 35 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/AutomationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | import io.appium.java_client.remote.AutomationName; 19 | 20 | /** 21 | * @author wasiq.bhamla 22 | * @since 24-Apr-2017 9:11:30 PM 23 | */ 24 | public enum AutomationType { 25 | /** 26 | * Appium. 27 | */ 28 | APPIUM(AutomationName.APPIUM), 29 | /** 30 | * Espresso. 31 | */ 32 | ESPRESSO(AutomationName.ESPRESSO), 33 | /** 34 | * Android UIAutomator2. 35 | */ 36 | UIAUTOMATOR2(AutomationName.ANDROID_UIAUTOMATOR2), 37 | /** 38 | * XCUITest. 39 | */ 40 | XCUI(AutomationName.IOS_XCUI_TEST); 41 | 42 | private final String name; 43 | 44 | AutomationType(final String name) { 45 | this.name = name; 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * @see java.lang.Enum#toString() 51 | */ 52 | @Override 53 | public String toString() { 54 | return this.name; 55 | } 56 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/Browser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | import io.appium.java_client.remote.MobileBrowserType; 19 | 20 | /** 21 | * @author wasiq.bhamla 22 | * @since Jul 15, 2017 4:50:08 PM 23 | */ 24 | public enum Browser { 25 | /** 26 | * System browser. 27 | */ 28 | BROWSER(MobileBrowserType.BROWSER), 29 | /** 30 | * Chrome browser. 31 | */ 32 | CHROME(MobileBrowserType.CHROME), 33 | /** 34 | * Chromiuim browser. 35 | */ 36 | CHROMIUM(MobileBrowserType.CHROMIUM), 37 | /** 38 | * Safari browser. 39 | */ 40 | SAFARI(MobileBrowserType.SAFARI); 41 | 42 | private final String name; 43 | 44 | Browser(final String name) { 45 | this.name = name; 46 | } 47 | 48 | /** 49 | * @return the browser 50 | * @author wasiq.bhamla 51 | * @since Jul 15, 2017 5:04:12 PM 52 | */ 53 | @Override 54 | public String toString() { 55 | return this.name; 56 | } 57 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/ClipboardType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | import io.appium.java_client.clipboard.ClipboardContentType; 19 | 20 | /** 21 | * @author wasiqb 22 | * @since Nov 2, 2018 23 | */ 24 | public enum ClipboardType { 25 | /** 26 | * Image. 27 | */ 28 | IMAGE(ClipboardContentType.IMAGE), 29 | /** 30 | * Text. 31 | */ 32 | TEXT(ClipboardContentType.PLAINTEXT), 33 | /** 34 | * URL. 35 | */ 36 | URL(ClipboardContentType.URL); 37 | 38 | private final ClipboardContentType type; 39 | 40 | ClipboardType(final ClipboardContentType type) { 41 | this.type = type; 42 | } 43 | 44 | /** 45 | * @return the type 46 | * @author wasiqb 47 | * @since Nov 2, 2018 48 | */ 49 | public ClipboardContentType getType() { 50 | return this.type; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/CloudProviders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.enums; 19 | 20 | /** 21 | * List of cloud providers. 22 | * 23 | * @author Wasiq Bhamla 24 | * @since 29-11-2020 25 | */ 26 | public enum CloudProviders { 27 | /** 28 | * Cloud Provider URL 29 | * 30 | * @since Mar 13, 2021 31 | */ 32 | BROWSERSTACK ("hub-cloud.browserstack.com"); 33 | 34 | private final String url; 35 | 36 | CloudProviders (final String url) { 37 | this.url = url; 38 | } 39 | 40 | /** 41 | * @return Server URL 42 | */ 43 | public String getUrl () { 44 | return this.url; 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/DeviceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Aug 1, 2017 3:56:25 PM 21 | */ 22 | public enum DeviceType { 23 | /** 24 | * Indicates real device. 25 | */ 26 | REAL, 27 | /** 28 | * Indicates simulator / emulators. 29 | */ 30 | SIMULATOR 31 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/KeyCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.enums; 19 | 20 | import io.appium.java_client.android.nativekey.AndroidKey; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since 21-Mar-2021 25 | */ 26 | public enum KeyCode { 27 | /** 28 | * Home key 29 | */ 30 | HOME (AndroidKey.HOME), 31 | /** 32 | * Power key 33 | */ 34 | POWER (AndroidKey.POWER), 35 | /** 36 | * Volume up key 37 | */ 38 | VOLUME_UP (AndroidKey.VOLUME_UP), 39 | /** 40 | * Volume down key 41 | */ 42 | VOLUME_DOWN (AndroidKey.VOLUME_DOWN), 43 | /** 44 | * Back key 45 | */ 46 | BACK (AndroidKey.BACK), 47 | /** 48 | * Enter key 49 | */ 50 | ENTER (AndroidKey.ENTER); 51 | 52 | private final AndroidKey key; 53 | 54 | KeyCode (final AndroidKey key) { 55 | this.key = key; 56 | } 57 | 58 | public AndroidKey getKey () { 59 | return this.key; 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/Language.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.enums; 19 | 20 | import java.util.Locale; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since 18-Apr-2021 25 | */ 26 | public enum Language { 27 | /** 28 | * French. 29 | */ 30 | FRANCE (Locale.FRANCE), 31 | /** 32 | * Japanese. 33 | */ 34 | JAPAN (Locale.JAPAN), 35 | /** 36 | * English UK. 37 | */ 38 | UK (Locale.UK), 39 | /** 40 | * English US. 41 | */ 42 | US (Locale.US); 43 | 44 | private final Locale locale; 45 | 46 | Language (final Locale locale) { 47 | this.locale = locale; 48 | } 49 | 50 | public Locale getLocale () { 51 | return this.locale; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/LogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Oct 27, 2017 3:03:59 PM 21 | */ 22 | public enum LogLevel { 23 | /** 24 | * Debug. 25 | */ 26 | DEBUG("debug"), 27 | /** 28 | * Debug+Debug 29 | */ 30 | DEBUG_DEBUG("debug:debug"), 31 | /** 32 | * Debug+Error 33 | */ 34 | DEBUG_ERROR("debug:error"), 35 | /** 36 | * Debug+Info 37 | */ 38 | DEBUG_INFO("debug:info"), 39 | /** 40 | * Debug+Warn 41 | */ 42 | DEBUG_WARN("debug:warn"), 43 | /** 44 | * Error 45 | */ 46 | ERROR("error"), 47 | /** 48 | * Error+Debug 49 | */ 50 | ERROR_DEBUG("error:debug"), 51 | /** 52 | * Error+Error 53 | */ 54 | ERROR_ERROR("error:error"), 55 | /** 56 | * Error+Info 57 | */ 58 | ERROR_INFO("error:info"), 59 | /** 60 | * Error+Warn 61 | */ 62 | ERROR_WARN("error:warn"), 63 | /** 64 | * Info 65 | */ 66 | INFO("info"), 67 | /** 68 | * Info+Debug 69 | */ 70 | INFO_DEBUG("info:debug"), 71 | /** 72 | * Info+Error 73 | */ 74 | INFO_ERROR("info:error"), 75 | /** 76 | * Info+Info 77 | */ 78 | INFO_INFO("info:info"), 79 | /** 80 | * Info+Warn 81 | */ 82 | INFO_WARN("info:warn"), 83 | /** 84 | * Warn 85 | */ 86 | WARN("warn"), 87 | /** 88 | * Warn+Debug 89 | */ 90 | WARN_DEBUG("warn:debug"), 91 | /** 92 | * Warn+Error 93 | */ 94 | WARN_ERROR("warn:error"), 95 | /** 96 | * Warn+Info 97 | */ 98 | WARN_INFO("warn:info"), 99 | /** 100 | * Warn+Warn 101 | */ 102 | WARN_WARN("warn:warn"); 103 | 104 | private final String level; 105 | 106 | /** 107 | * @author wasiq.bhamla 108 | * @since Oct 27, 2017 3:07:08 PM 109 | */ 110 | LogLevel(final String level) { 111 | this.level = level; 112 | } 113 | 114 | /* 115 | * (non-Javadoc) 116 | * @see java.lang.Enum#toString() 117 | */ 118 | @Override 119 | public String toString() { 120 | return this.level; 121 | } 122 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/PlatformType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | import io.appium.java_client.remote.MobilePlatform; 19 | 20 | /** 21 | * @author wasiq.bhamla 22 | * @since 12-Apr-2017 8:34:59 PM 23 | */ 24 | public enum PlatformType { 25 | /** 26 | * Android Device. 27 | */ 28 | ANDROID(MobilePlatform.ANDROID), 29 | /** 30 | * iOS Device. 31 | */ 32 | IOS(MobilePlatform.IOS), 33 | /** 34 | * Windows Device. 35 | */ 36 | WINDOWS(MobilePlatform.WINDOWS); 37 | 38 | private final String name; 39 | 40 | PlatformType(final String name) { 41 | this.name = name; 42 | } 43 | 44 | /* 45 | * (non-Javadoc) 46 | * @see java.lang.Enum#toString() 47 | */ 48 | @Override 49 | public String toString() { 50 | return this.name; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/Protocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiqb 20 | * @since Sep 29, 2018 21 | */ 22 | public enum Protocol { 23 | /** 24 | * HTTP protocol. 25 | */ 26 | HTTP("http"), 27 | /** 28 | * HTTPS protocol. 29 | */ 30 | HTTPS("https"); 31 | 32 | private final String name; 33 | 34 | Protocol(final String name) { 35 | this.name = name; 36 | } 37 | 38 | /** 39 | * @return the protocol name 40 | * @author wasiqb 41 | * @since Sep 29, 2018 42 | */ 43 | public String getName() { 44 | return this.name; 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/SwipeDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Oct 16, 2017 9:34:46 PM 21 | */ 22 | public enum SwipeDirection { 23 | /** 24 | * Swipe up. 25 | */ 26 | DOWN(0, 1), 27 | /** 28 | * Swipe left. 29 | */ 30 | LEFT(-1, 0), 31 | /** 32 | * Swipe right. 33 | */ 34 | RIGHT(1, 0), 35 | /** 36 | * Swipe up. 37 | */ 38 | UP(0, -1); 39 | 40 | private final int x; 41 | private final int y; 42 | 43 | /** 44 | * @author wasiq.bhamla 45 | * @since Oct 20, 2017 7:56:06 PM 46 | */ 47 | SwipeDirection(final int x, final int y) { 48 | this.x = x; 49 | this.y = y; 50 | } 51 | 52 | /** 53 | * @return the x 54 | * @author wasiq.bhamla 55 | * @since Oct 20, 2017 7:57:09 PM 56 | */ 57 | public int getX() { 58 | return this.x; 59 | } 60 | 61 | /** 62 | * @return the y 63 | * @author wasiq.bhamla 64 | * @since Oct 20, 2017 7:57:09 PM 65 | */ 66 | public int getY() { 67 | return this.y; 68 | } 69 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/SwipeStartPosition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Jan 31, 2018 2:50:44 PM 21 | */ 22 | public enum SwipeStartPosition { 23 | /** 24 | * Start from bottom border. 25 | */ 26 | BOTTOM, 27 | /** 28 | * Start from center. 29 | */ 30 | CENTER, 31 | /** 32 | * Start from left border. 33 | */ 34 | LEFT, 35 | /** 36 | * Start from right border 37 | */ 38 | RIGHT, 39 | /** 40 | * Start from top border. 41 | */ 42 | TOP 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/UnlockType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.enums; 19 | 20 | /** 21 | * @author Wasiq Bhamla 22 | * @since Mar 13, 2021 23 | */ 24 | public enum UnlockType { 25 | FINGERPRINT, 26 | PASSWORD, 27 | PATTERN, 28 | PIN 29 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/VideoQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.enums; 19 | 20 | /** 21 | * @author Wasiq Bhamla 22 | * @since Mar 13, 2021 23 | */ 24 | public enum VideoQuality { 25 | HD (100), 26 | HIGH (75), 27 | LOW (25), 28 | MEDIUM (50); 29 | 30 | private final int quality; 31 | 32 | VideoQuality (final int quality) { 33 | this.quality = quality; 34 | } 35 | 36 | /** 37 | * @return video quality 38 | */ 39 | public int getQuality () { 40 | return this.quality; 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/enums/WaitStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.enums; 17 | 18 | /** 19 | * @author wasiqb 20 | * @since Oct 20, 2018 21 | */ 22 | public enum WaitStrategy { 23 | /** 24 | * Wait until element is enabled. 25 | */ 26 | ENABLED, 27 | /** 28 | * No wait. 29 | */ 30 | NONE, 31 | /** 32 | * Wait until element is present. 33 | */ 34 | PRESENT, 35 | /** 36 | * Wait until element is displayed. 37 | */ 38 | VISIBLE 39 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/server/AndroidSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.server; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class AndroidSetting { 28 | private int bootstrapPort; 29 | private String chromeDriverPath; 30 | private int chromeDriverPort; 31 | private boolean reboot; 32 | private boolean suppressAdbKill; 33 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/server/IOSSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.server; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | * @author Wasiq Bhamla 24 | * @since Mar 13, 2021 25 | */ 26 | @Data 27 | public class IOSSetting { 28 | private int backendRetries; 29 | private String defaultDevice; 30 | private String ipaPath; 31 | private boolean safari; 32 | private String tracePath; 33 | private int wdaPort; 34 | private int wkdProxyPort; 35 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/server/LogSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.config.server; 17 | 18 | import static java.lang.System.getProperty; 19 | import static java.lang.Thread.currentThread; 20 | import static java.text.MessageFormat.format; 21 | 22 | import com.github.wasiqb.coteafs.appium.config.enums.LogLevel; 23 | import lombok.Data; 24 | 25 | /** 26 | * @author Wasiq Bhamla 27 | * @since Mar 13, 2021 28 | */ 29 | @Data 30 | public class LogSetting { 31 | private static final String PATH_PATTERN = "{0}/logs/server-{1}.log"; 32 | 33 | private boolean asyncTrace; 34 | private boolean debugSpacing; 35 | private LogLevel level = LogLevel.ERROR; 36 | private boolean localTimezone; 37 | private boolean noColors; 38 | private String path = format (PATH_PATTERN, getProperty ("user.dir"), currentThread ().getId ()); 39 | private boolean timestamp; 40 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/config/server/ServerSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2020, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coteafs.appium.config.server; 19 | 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | import com.github.wasiqb.coteafs.appium.config.enums.CloudProviders; 25 | import com.github.wasiqb.coteafs.appium.config.enums.Protocol; 26 | import lombok.Data; 27 | 28 | /** 29 | * @author wasiq.bhamla 30 | * @since 12-Apr-2017 8:43:22 PM 31 | */ 32 | @Data 33 | public class ServerSetting { 34 | private boolean allowCors; 35 | private List allowInsecure; 36 | private AndroidSetting android = new AndroidSetting (); 37 | private String appiumPath; 38 | private String callbackIp; 39 | private int callbackPort; 40 | private CloudProviders cloud; 41 | private Map environments = new HashMap<> (); 42 | private boolean external; 43 | private String host; 44 | private IOSSetting ios = new IOSSetting (); 45 | private LogSetting logs = new LogSetting (); 46 | private String nodeConfig; 47 | private String nodePath; 48 | private String password; 49 | private int port; 50 | private boolean preLaunch; 51 | private Protocol protocol = Protocol.HTTP; 52 | private boolean relaxedSecurity; 53 | private boolean sessionOverride; 54 | private int startUpTimeout = 60; 55 | private boolean strictCapabilities; 56 | private String userName; 57 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/constants/ErrorMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.constants; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Jul 22, 2017 10:02:54 PM 21 | */ 22 | public interface ErrorMessage { 23 | /** 24 | * Server stopped error message. 25 | */ 26 | String SERVER_STOPPED = "Server Session has been stopped."; 27 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/device/DeviceActivityActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.device; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | import io.appium.java_client.AppiumDriver; 22 | import io.appium.java_client.MobileElement; 23 | import io.appium.java_client.TouchAction; 24 | 25 | /** 26 | * @param Driver 27 | * @param Device 28 | * @param 29 | * 30 | * @author wasiq.bhamla 31 | * @since Oct 23, 2017 10:51:31 PM 32 | */ 33 | public abstract class DeviceActivityActions, E extends Device, T extends TouchAction> { 34 | private final E device; 35 | private final Map values; 36 | 37 | /** 38 | * @param device Device instance 39 | * 40 | * @author wasiq.bhamla 41 | * @since Oct 23, 2017 10:51:31 PM 42 | */ 43 | protected DeviceActivityActions (final E device) { 44 | this.device = device; 45 | this.values = new HashMap<> (); 46 | } 47 | 48 | /** 49 | * @param element Element name 50 | * @param value Input value 51 | * 52 | * @return instance 53 | * 54 | * @author wasiq.bhamla 55 | * @since Oct 23, 2017 11:01:15 PM 56 | */ 57 | public DeviceActivityActions addInputValue (final String element, final Object value) { 58 | this.values.put (element, value); 59 | return this; 60 | } 61 | 62 | /** 63 | * @return the device 64 | * 65 | * @author wasiq.bhamla 66 | * @since Oct 23, 2017 10:55:13 PM 67 | */ 68 | public E getDevice () { 69 | return this.device; 70 | } 71 | 72 | /** 73 | * @author wasiq.bhamla 74 | * @since Oct 23, 2017 10:53:59 PM 75 | */ 76 | public abstract void perform (); 77 | 78 | @SuppressWarnings ("unchecked") 79 | protected X value (final String element) { 80 | return (X) this.values.get (element); 81 | } 82 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/device/DeviceElementVerify.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.device; 17 | 18 | import static com.google.common.truth.Truth.assertThat; 19 | 20 | import io.appium.java_client.AppiumDriver; 21 | import io.appium.java_client.MobileElement; 22 | import io.appium.java_client.TouchAction; 23 | import org.apache.logging.log4j.LogManager; 24 | import org.apache.logging.log4j.Logger; 25 | 26 | /** 27 | * @param 28 | * @param 29 | * @param 30 | * 31 | * @author wasiq.bhamla 32 | * @since 19-May-2017 9:57:58 PM 33 | */ 34 | public class DeviceElementVerify, E extends Device, T extends TouchAction> { 35 | private static final Logger log = LogManager.getLogger (); 36 | 37 | private final DeviceElementActions actions; 38 | 39 | /** 40 | * @param actions Actions instance 41 | * 42 | * @author wasiq.bhamla 43 | * @since 19-May-2017 9:59:32 PM 44 | */ 45 | public DeviceElementVerify (final DeviceElementActions actions) { 46 | this.actions = actions; 47 | } 48 | 49 | /** 50 | * @author wasiq.bhamla 51 | * @since 19-May-2017 10:07:53 PM 52 | */ 53 | public void shouldBeDisabled () { 54 | log.info ("Verifying if element is disabled..."); 55 | assertThat (this.actions.enabled ()).isFalse (); 56 | } 57 | 58 | /** 59 | * @author wasiq.bhamla 60 | * @since 19-May-2017 10:08:28 PM 61 | */ 62 | public void shouldBeDisplayed () { 63 | log.info ("Verifying if element is displayed..."); 64 | assertThat (this.actions.visible ()).isTrue (); 65 | } 66 | 67 | /** 68 | * @author wasiq.bhamla 69 | * @since 19-May-2017 10:07:22 PM 70 | */ 71 | public void shouldBeEnabled () { 72 | log.info ("Verifying if element is enabled..."); 73 | assertThat (this.actions.enabled ()).isTrue (); 74 | } 75 | 76 | /** 77 | * @author wasiq.bhamla 78 | * @since 20-May-2017 12:24:26 PM 79 | */ 80 | public void shouldNotBeDisplayed () { 81 | log.info ("Verifying if element is not displayed..."); 82 | assertThat (this.actions.visible ()).isFalse (); 83 | } 84 | 85 | /** 86 | * @param expected Expected value 87 | * 88 | * @author wasiq.bhamla 89 | * @since 20-May-2017 12:39:27 PM 90 | */ 91 | public void textShouldBeEqualTo (final String expected) { 92 | log.info ("Verifying if element text is equal to [{}]...", expected); 93 | assertThat (this.actions.text ()).isEqualTo (expected); 94 | } 95 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumConfigParameterNotFoundError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 09-May-2017 3:46:59 PM 21 | */ 22 | public class AppiumConfigParameterNotFoundError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 8185078640460346377L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 09-May-2017 3:46:59 PM 29 | */ 30 | public AppiumConfigParameterNotFoundError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 09-May-2017 3:46:59 PM 39 | */ 40 | public AppiumConfigParameterNotFoundError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumSelectorNotImplementedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Feb 2, 2018 3:48:40 PM 21 | */ 22 | public class AppiumSelectorNotImplementedError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 7886747426324422769L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since Feb 2, 2018 3:48:41 PM 29 | */ 30 | public AppiumSelectorNotImplementedError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since Feb 2, 2018 3:48:41 PM 39 | */ 40 | public AppiumSelectorNotImplementedError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerAlreadyRunningError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:44:46 PM 21 | */ 22 | public class AppiumServerAlreadyRunningError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 3122700421661631230L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:12:22 PM 29 | */ 30 | public AppiumServerAlreadyRunningError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:44:46 PM 39 | */ 40 | public AppiumServerAlreadyRunningError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerLogFileError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since Oct 31, 2017 9:24:59 PM 21 | */ 22 | public class AppiumServerLogFileError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -1270139515211883488L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since Oct 31, 2017 9:25:00 PM 29 | */ 30 | public AppiumServerLogFileError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since Oct 31, 2017 9:25:00 PM 39 | */ 40 | public AppiumServerLogFileError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerNotRunningError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 4:27:12 PM 21 | */ 22 | public class AppiumServerNotRunningError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 8585241762112136560L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 4:36:48 PM 29 | */ 30 | public AppiumServerNotRunningError(final String message) { 31 | super(message, null); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 4:27:12 PM 39 | */ 40 | public AppiumServerNotRunningError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerNotStartingError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:37:59 PM 21 | */ 22 | public class AppiumServerNotStartingError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 7896083001637597129L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:15:07 PM 29 | */ 30 | public AppiumServerNotStartingError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:38:00 PM 39 | */ 40 | public AppiumServerNotStartingError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerNotStoppingError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:47:27 PM 21 | */ 22 | public class AppiumServerNotStoppingError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 5886144403365923036L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:15:21 PM 29 | */ 30 | public AppiumServerNotStoppingError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:47:27 PM 39 | */ 40 | public AppiumServerNotStoppingError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/AppiumServerStoppedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 12-May-2017 10:00:29 PM 21 | */ 22 | public class AppiumServerStoppedError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -16535073449188572L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 12-May-2017 10:00:30 PM 29 | */ 30 | public AppiumServerStoppedError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 12-May-2017 10:00:30 PM 39 | */ 40 | public AppiumServerStoppedError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/CoteafsAppiumError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | import com.github.wasiqb.coteafs.error.CoteafsError; 19 | import com.github.wasiqb.coteafs.error.enums.Category; 20 | import com.github.wasiqb.coteafs.error.enums.Reason; 21 | import com.github.wasiqb.coteafs.error.enums.Severity; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since Oct 14, 2017 8:51:55 PM 26 | */ 27 | class CoteafsAppiumError extends CoteafsError { 28 | private static final long serialVersionUID = -8566294740519833332L; 29 | 30 | /** 31 | * @param message 32 | * @author wasiq.bhamla 33 | * @since Oct 14, 2017 8:51:56 PM 34 | */ 35 | public CoteafsAppiumError(final String message) { 36 | super(message, Reason.R2, Category.C1, Severity.CRITICAL); 37 | } 38 | 39 | /** 40 | * @param message 41 | * @param cause 42 | * @author wasiq.bhamla 43 | * @since Oct 14, 2017 8:51:56 PM 44 | */ 45 | public CoteafsAppiumError(final String message, final Throwable cause) { 46 | super(message, cause, Reason.R2, Category.C1, Severity.CRITICAL); 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceAppNotClosingError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:55:17 PM 21 | */ 22 | public class DeviceAppNotClosingError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -911705055646490050L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:16:42 PM 29 | */ 30 | public DeviceAppNotClosingError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:55:17 PM 39 | */ 40 | public DeviceAppNotClosingError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceAppNotFoundError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 06-May-2017 4:03:58 PM 21 | */ 22 | public class DeviceAppNotFoundError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 1403120362024067556L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 06-May-2017 4:03:58 PM 29 | */ 30 | public DeviceAppNotFoundError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 06-May-2017 4:03:58 PM 39 | */ 40 | public DeviceAppNotFoundError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceDesiredCapabilitiesNotSetError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 12-May-2017 7:29:59 PM 21 | */ 22 | public class DeviceDesiredCapabilitiesNotSetError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 2603048064389553019L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 12-May-2017 7:30:02 PM 29 | */ 30 | public DeviceDesiredCapabilitiesNotSetError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 12-May-2017 7:30:02 PM 39 | */ 40 | public DeviceDesiredCapabilitiesNotSetError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceDriverDefaultWaitError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 06-May-2017 4:11:39 PM 21 | */ 22 | public class DeviceDriverDefaultWaitError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 3213298782710610781L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 06-May-2017 4:11:39 PM 29 | */ 30 | public DeviceDriverDefaultWaitError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 06-May-2017 4:11:39 PM 39 | */ 40 | public DeviceDriverDefaultWaitError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceDriverInitializationFailedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 06-May-2017 4:07:48 PM 21 | */ 22 | public class DeviceDriverInitializationFailedError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -3202324172947020043L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 06-May-2017 4:07:48 PM 29 | */ 30 | public DeviceDriverInitializationFailedError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 06-May-2017 4:07:48 PM 39 | */ 40 | public DeviceDriverInitializationFailedError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceDriverNotStartingError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:52:46 PM 21 | */ 22 | public class DeviceDriverNotStartingError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 1786319114640601285L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:16:56 PM 29 | */ 30 | public DeviceDriverNotStartingError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:52:46 PM 39 | */ 40 | public DeviceDriverNotStartingError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceDriverNotStoppingError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 9:57:00 PM 21 | */ 22 | public class DeviceDriverNotStoppingError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 6550193998074883544L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:17:11 PM 29 | */ 30 | public DeviceDriverNotStoppingError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 9:57:00 PM 39 | */ 40 | public DeviceDriverNotStoppingError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceElementDisabledError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 11:07:35 PM 21 | */ 22 | public class DeviceElementDisabledError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -7319931622304889401L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:07:35 PM 29 | */ 30 | public DeviceElementDisabledError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 11:07:35 PM 39 | */ 40 | public DeviceElementDisabledError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceElementFindTimedOutError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 06-May-2017 4:17:32 PM 21 | */ 22 | public class DeviceElementFindTimedOutError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 4342518976798681279L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 06-May-2017 4:17:32 PM 29 | */ 30 | public DeviceElementFindTimedOutError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 06-May-2017 4:17:32 PM 39 | */ 40 | public DeviceElementFindTimedOutError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceElementNameNotFoundError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 03-Jun-2017 3:44:40 PM 21 | */ 22 | public class DeviceElementNameNotFoundError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -7772079377357876689L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 03-Jun-2017 3:44:41 PM 29 | */ 30 | public DeviceElementNameNotFoundError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 03-Jun-2017 3:44:41 PM 39 | */ 40 | public DeviceElementNameNotFoundError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceElementNotDisplayedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 10:11:47 PM 21 | */ 22 | public class DeviceElementNotDisplayedError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -2632375399231145369L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:05:48 PM 29 | */ 30 | public DeviceElementNotDisplayedError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 10:11:47 PM 39 | */ 40 | public DeviceElementNotDisplayedError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceElementNotFoundError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 04-May-2017 10:05:02 PM 21 | */ 22 | public class DeviceElementNotFoundError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = 7290657595577298146L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 04-May-2017 11:17:36 PM 29 | */ 30 | public DeviceElementNotFoundError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 04-May-2017 10:05:02 PM 39 | */ 40 | public DeviceElementNotFoundError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/DeviceTypeNotSupportedError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiq.bhamla 20 | * @since 17-May-2017 7:41:49 PM 21 | */ 22 | public class DeviceTypeNotSupportedError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -675650350464360559L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiq.bhamla 28 | * @since 17-May-2017 7:41:50 PM 29 | */ 30 | public DeviceTypeNotSupportedError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiq.bhamla 38 | * @since 17-May-2017 7:41:50 PM 39 | */ 40 | public DeviceTypeNotSupportedError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/error/NotEnoughBatteryChargeError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.error; 17 | 18 | /** 19 | * @author wasiqb 20 | * @since Oct 2, 2018 21 | */ 22 | public class NotEnoughBatteryChargeError extends CoteafsAppiumError { 23 | private static final long serialVersionUID = -4401868812886874760L; 24 | 25 | /** 26 | * @param message 27 | * @author wasiqb 28 | * @since Oct 2, 2018 29 | */ 30 | public NotEnoughBatteryChargeError(final String message) { 31 | super(message); 32 | } 33 | 34 | /** 35 | * @param message 36 | * @param cause 37 | * @author wasiqb 38 | * @since Oct 2, 2018 39 | */ 40 | public NotEnoughBatteryChargeError(final String message, final Throwable cause) { 41 | super(message, cause); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import static com.github.wasiqb.coteafs.appium.utils.BatteryHealth.check; 19 | 20 | import com.github.wasiqb.coteafs.appium.config.enums.DeviceType; 21 | import com.github.wasiqb.coteafs.appium.device.DeviceActivity; 22 | import io.appium.java_client.MobileElement; 23 | import io.appium.java_client.ios.IOSBatteryInfo; 24 | import io.appium.java_client.ios.IOSDriver; 25 | import io.appium.java_client.ios.IOSTouchAction; 26 | import org.apache.logging.log4j.LogManager; 27 | import org.apache.logging.log4j.Logger; 28 | 29 | /** 30 | * @author wasiq.bhamla 31 | * @since 26-Apr-2017 7:41:49 PM 32 | */ 33 | public abstract class IOSActivity extends DeviceActivity, IOSDevice, IOSTouchAction> { 34 | private static final Logger log = LogManager.getLogger (); 35 | 36 | /** 37 | * @param device Device instance 38 | * 39 | * @author wasiq.bhamla 40 | * @since 26-Apr-2017 7:42:13 PM 41 | */ 42 | protected IOSActivity (final IOSDevice device) { 43 | super (device, new IOSTouchAction (device.getDriver ())); 44 | } 45 | 46 | /* 47 | * (non-Javadoc) 48 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActivity#onDevice() 49 | */ 50 | @Override 51 | public IOSDeviceActions onDevice () { 52 | checkBattery (); 53 | log.trace ("Preparing to perform actions on iOS device..."); 54 | return new IOSDeviceActions (this.device); 55 | } 56 | 57 | /* 58 | * (non-Javadoc) 59 | * @see 60 | * com.github.wasiqb.coteafs.appium.device.DeviceActivity#onElement(java.lang. 61 | * String) 62 | */ 63 | @Override 64 | public IOSDeviceElementActions onElement (final String name) { 65 | checkBattery (); 66 | log.trace ("Preparing to perform actions on iOS device element [{}]...", name); 67 | return new IOSDeviceElementActions (this.device, name, getElement (name)); 68 | } 69 | 70 | private void checkBattery () { 71 | final IOSBatteryInfo battery = this.device.getDriver () 72 | .getBatteryInfo (); 73 | if (!this.device.getSetting () 74 | .isCloud () && this.device.getSetting () 75 | .getType () == DeviceType.REAL) { 76 | check (battery.getState () 77 | .name (), battery.getLevel ()); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSActivityActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import com.github.wasiqb.coteafs.appium.device.DeviceActivityActions; 19 | import io.appium.java_client.MobileElement; 20 | import io.appium.java_client.ios.IOSDriver; 21 | import io.appium.java_client.ios.IOSTouchAction; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since Oct 23, 2017 11:06:13 PM 26 | */ 27 | public abstract class IOSActivityActions 28 | extends DeviceActivityActions, IOSDevice, IOSTouchAction> { 29 | /** 30 | * @param device Device instance 31 | * 32 | * @author wasiq.bhamla 33 | * @since Oct 23, 2017 11:06:33 PM 34 | */ 35 | protected IOSActivityActions (final IOSDevice device) { 36 | super (device); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSDevice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import com.github.wasiqb.coteafs.appium.config.device.ios.IOSVideoSetting; 19 | import com.github.wasiqb.coteafs.appium.device.Device; 20 | import com.github.wasiqb.coteafs.appium.service.AppiumServer; 21 | import io.appium.java_client.MobileElement; 22 | import io.appium.java_client.ios.IOSDriver; 23 | import io.appium.java_client.ios.IOSStartScreenRecordingOptions; 24 | import io.appium.java_client.ios.IOSStartScreenRecordingOptions.VideoQuality; 25 | import io.appium.java_client.ios.IOSStopScreenRecordingOptions; 26 | import io.appium.java_client.ios.IOSTouchAction; 27 | 28 | /** 29 | * @author wasiq.bhamla 30 | * @since 13-Apr-2017 5:33:35 PM 31 | */ 32 | public class IOSDevice extends Device, IOSTouchAction> { 33 | /** 34 | * @param server Server instance 35 | * @param name Server name 36 | * 37 | * @author wasiq.bhamla 38 | * @since 13-Apr-2017 9:12:09 PM 39 | */ 40 | public IOSDevice (final AppiumServer server, final String name) { 41 | super (server, name); 42 | } 43 | 44 | /* 45 | * (non-Javadoc) 46 | * @see com.github.wasiqb.coteafs.appium.device.Device#startRecordSetting() 47 | */ 48 | @SuppressWarnings ("unchecked") 49 | @Override 50 | protected IOSStartScreenRecordingOptions startRecordSetting () { 51 | final IOSStartScreenRecordingOptions options = IOSStartScreenRecordingOptions.startScreenRecordingOptions (); 52 | final IOSVideoSetting record = this.setting.getPlayback () 53 | .getRecording () 54 | .getIos (); 55 | if (record.getQuality () != VideoQuality.MEDIUM) { 56 | options.withVideoQuality (record.getQuality ()); 57 | } 58 | if (record.getFps () > 0) { 59 | options.withFps (record.getFps ()); 60 | } 61 | if (record.getCodec () != null) { 62 | options.withVideoType (record.getCodec ()); 63 | } 64 | return options; 65 | } 66 | 67 | /* 68 | * (non-Javadoc) 69 | * @see com.github.wasiqb.coteafs.appium.device.Device#stopRecordSetting() 70 | */ 71 | @SuppressWarnings ("unchecked") 72 | @Override 73 | protected IOSStopScreenRecordingOptions stopRecordSetting () { 74 | return IOSStopScreenRecordingOptions.stopScreenRecordingOptions (); 75 | } 76 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSDeviceActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import static com.github.wasiqb.coteafs.appium.constants.ErrorMessage.SERVER_STOPPED; 19 | import static com.github.wasiqb.coteafs.error.util.ErrorUtil.fail; 20 | 21 | import java.awt.image.BufferedImage; 22 | import java.io.File; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | 28 | import com.github.wasiqb.coteafs.appium.config.enums.ClipboardType; 29 | import com.github.wasiqb.coteafs.appium.config.enums.SwipeDirection; 30 | import com.github.wasiqb.coteafs.appium.device.DeviceActions; 31 | import com.github.wasiqb.coteafs.appium.error.AppiumServerStoppedError; 32 | import io.appium.java_client.MobileElement; 33 | import io.appium.java_client.ios.IOSDriver; 34 | import io.appium.java_client.ios.IOSTouchAction; 35 | import org.apache.logging.log4j.LogManager; 36 | import org.apache.logging.log4j.Logger; 37 | import org.openqa.selenium.Alert; 38 | import org.openqa.selenium.NoSuchSessionException; 39 | import org.openqa.selenium.TimeoutException; 40 | 41 | /** 42 | * @author wasiq.bhamla 43 | * @since 26-Apr-2017 11:34:39 PM 44 | */ 45 | public class IOSDeviceActions extends DeviceActions, IOSDevice, IOSTouchAction> { 46 | private static final Logger log = LogManager.getLogger (); 47 | 48 | /** 49 | * @param device Device instance 50 | * 51 | * @author wasiq.bhamla 52 | * @since 26-Apr-2017 11:34:58 PM 53 | */ 54 | public IOSDeviceActions (final IOSDevice device) { 55 | super (device, new IOSTouchAction (device.getDriver ())); 56 | } 57 | 58 | /** 59 | * @return clipboard text 60 | * 61 | * @author wasiqb 62 | * @since Nov 2, 2018 63 | */ 64 | public String clipboard () { 65 | log.info ("Getting clipboard text..."); 66 | return this.driver.getClipboardText (); 67 | } 68 | 69 | /** 70 | * @param type Getting clipboard for type 71 | * 72 | * @return clipboard 73 | * 74 | * @author wasiqb 75 | * @since Nov 2, 2018 76 | */ 77 | public String clipboard (final ClipboardType type) { 78 | log.info ("Getting clipboard [{}]...", type); 79 | return this.driver.getClipboard (type.getType ()); 80 | } 81 | 82 | /** 83 | * @param img Image to save on clipboard 84 | * 85 | * @author Faisal Khatri 86 | * @since Mar 13, 2021 87 | */ 88 | public void clipboard (final BufferedImage img) { 89 | log.info ("Setting clipboard image..."); 90 | try { 91 | this.driver.setClipboardImage (img); 92 | } catch (final IOException e) { 93 | log.warn ("Error while setting clipboard image...."); 94 | log.warn (e.getMessage ()); 95 | } 96 | } 97 | 98 | /** 99 | * @param text Text to save in Clipboard 100 | * 101 | * @author Faisal Khatri 102 | * @since Mar 13, 2021 103 | */ 104 | public void clipboard (final String text) { 105 | log.trace ("Setting clipboard text to [{}]...", text); 106 | this.driver.setClipboardText (text); 107 | } 108 | 109 | /** 110 | * @param url Navigation URL 111 | * 112 | * @author Faisal Khatri 113 | * @since Mar 13, 2021 114 | */ 115 | public void clipboard (final URL url) { 116 | log.trace ("Setting clipboard URL to [{}]...", url); 117 | this.driver.setClipboardUrl (url); 118 | } 119 | 120 | /** 121 | * @return message 122 | * 123 | * @author wasiq.bhamla 124 | * @since 09-May-2017 8:46:51 PM 125 | */ 126 | public String handleAlert () { 127 | log.trace ("Handling iOS Alert pop-up..."); 128 | try { 129 | final Alert alert = this.wait.until (d -> d.switchTo () 130 | .alert ()); 131 | final String description = alert.getText (); 132 | log.info ("Alert Text: [{}]", description); 133 | alert.accept (); 134 | return description; 135 | } catch (final TimeoutException e) { 136 | log.warn ("Expecting Alert not displayed..."); 137 | log.warn (e.getMessage ()); 138 | } catch (final NoSuchSessionException e) { 139 | fail (AppiumServerStoppedError.class, SERVER_STOPPED, e); 140 | } 141 | return null; 142 | } 143 | 144 | /** 145 | * @param strategy Hide keyboard strategy 146 | * @param keyName Key name to press for hiding keyboard 147 | * 148 | * @author wasiq.bhamla 149 | * @since 08-May-2017 3:21:20 PM 150 | */ 151 | public void hideKeyboard (final String strategy, final String keyName) { 152 | log.info ("Hiding keyboard on device using {} strategy for key {}...", strategy, keyName); 153 | try { 154 | if (this.driver.isKeyboardShown ()) { 155 | this.driver.hideKeyboard (strategy, keyName); 156 | } 157 | } catch (final NoSuchSessionException e) { 158 | fail (AppiumServerStoppedError.class, SERVER_STOPPED, e); 159 | } 160 | } 161 | 162 | /* 163 | * (non-Javadoc) 164 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActions#pinch(int) 165 | */ 166 | @Override 167 | public void pinch (final int distance) { 168 | log.info ("Pinching on device screen by [{}] distance...", distance); 169 | final Map param = new HashMap<> (); 170 | param.put ("scale", 0.5); 171 | param.put ("velocity", distance); 172 | this.device.executeCommand ("mobile: pinch", param); 173 | } 174 | 175 | /** 176 | * @param devicePath Path on device 177 | * @param filePath File path to put on device 178 | * 179 | * @author Wasiq Bhamla 180 | * @since 19-Mar-2021 181 | */ 182 | public void pushFile (final String devicePath, final String filePath) { 183 | log.info ("Pushing file to Android device..."); 184 | try { 185 | this.driver.pushFile (devicePath, new File (filePath)); 186 | } catch (final IOException e) { 187 | log.error ("Error while pushing file to device..."); 188 | log.catching (e); 189 | } 190 | } 191 | 192 | /** 193 | * @author wasiq.bhamla 194 | * @since 26-Apr-2017 11:37:04 PM 195 | */ 196 | public void shake () { 197 | log.info ("Shaking the device..."); 198 | try { 199 | this.driver.shake (); 200 | } catch (final NoSuchSessionException e) { 201 | fail (AppiumServerStoppedError.class, SERVER_STOPPED, e); 202 | } 203 | } 204 | 205 | /** 206 | * @param direction Swipe direction 207 | * 208 | * @author wasiqb 209 | * @since Oct 28, 2018 210 | */ 211 | public void swipe (final SwipeDirection direction) { 212 | log.info ("Swiping [{}] on device screen...", direction); 213 | final Map param = new HashMap<> (); 214 | param.put ("direction", direction.name () 215 | .toLowerCase ()); 216 | this.device.executeCommand ("mobile: swipe", param); 217 | } 218 | 219 | /* 220 | * (non-Javadoc) 221 | * @see com.github.wasiqb.coteafs.appium.device.DeviceActions#zoom(int) 222 | */ 223 | @Override 224 | public void zoom (final int distance) { 225 | log.info ("Zooming in device screen by [{}] distance...", distance); 226 | final Map param = new HashMap<> (); 227 | param.put ("scale", 1.5); 228 | param.put ("velocity", distance); 229 | this.device.executeCommand ("mobile: pinch", param); 230 | } 231 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSDeviceElementActions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | import com.github.wasiqb.coteafs.appium.config.enums.SwipeDirection; 22 | import com.github.wasiqb.coteafs.appium.device.DeviceElementActions; 23 | import io.appium.java_client.MobileElement; 24 | import io.appium.java_client.ios.IOSDriver; 25 | import io.appium.java_client.ios.IOSTouchAction; 26 | import org.apache.logging.log4j.LogManager; 27 | import org.apache.logging.log4j.Logger; 28 | import org.openqa.selenium.Point; 29 | 30 | /** 31 | * @author wasiq.bhamla 32 | * @since 02-May-2017 6:37:57 PM 33 | */ 34 | public class IOSDeviceElementActions extends DeviceElementActions, IOSDevice, IOSTouchAction> { 35 | private static final Logger log = LogManager.getLogger (IOSDeviceElementActions.class); 36 | 37 | /** 38 | * @param device Device instance 39 | * @param name Element name 40 | * @param element Element under test 41 | * 42 | * @author wasiq.bhamla 43 | * @since 02-May-2017 6:38:12 PM 44 | */ 45 | public IOSDeviceElementActions (final IOSDevice device, final String name, final MobileElement element) { 46 | super (device, name, element, new IOSTouchAction (device.getDriver ())); 47 | } 48 | 49 | /* 50 | * (non-Javadoc) 51 | * @see 52 | * com.github.wasiqb.coteafs.appium.device.DeviceElementActions#dragDrop(io. 53 | * appium.java_client. MobileElement) 54 | */ 55 | @Override 56 | public void dragDrop (final MobileElement dropElement) { 57 | log.info ("Performing drag on element [{}]...", this.name); 58 | final Point fromCenter = this.element.getCenter (); 59 | final Point fromLocation = this.element.getLocation (); 60 | final Point toCenter = dropElement.getCenter (); 61 | 62 | final Map param = prepareParam (); 63 | param.put ("duration", this.setting.getDelay () 64 | .getBeforeSwipe ()); 65 | param.put ("fromX", fromCenter.getX () - fromLocation.getX ()); 66 | param.put ("fromY", fromCenter.getY () - fromLocation.getY ()); 67 | param.put ("toX", toCenter.getX () - fromLocation.getX ()); 68 | param.put ("toY", toCenter.getY () - fromLocation.getY ()); 69 | this.device.executeCommand ("mobile: dragFromToForDuration", param); 70 | } 71 | 72 | /* 73 | * (non-Javadoc) 74 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#longPress() 75 | */ 76 | @Override 77 | public void longPress () { 78 | log.info ("Long pressing on element [{}]...", this.name); 79 | 80 | final Map param = prepareParam (); 81 | param.put ("duration", 1.0); 82 | this.device.executeCommand ("mobile: touchAndHold", param); 83 | } 84 | 85 | /* 86 | * (non-Javadoc) 87 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#pinch(int) 88 | */ 89 | @Override 90 | public void pinch (final int distance) { 91 | log.info ("Pinching on element [{}]...", this.name); 92 | 93 | final Map param = prepareParam (); 94 | param.put ("scale", 0.5); 95 | param.put ("velocity", distance); 96 | this.device.executeCommand ("mobile: pinch", param); 97 | } 98 | 99 | /** 100 | * @param direction Swipe direction 101 | * 102 | * @author wasiqb 103 | * @since Oct 28, 2018 104 | */ 105 | public void swipe (final SwipeDirection direction) { 106 | log.info ("Swiping on element [{}]...", this.name); 107 | 108 | final Map param = prepareParam (); 109 | param.put ("direction", direction.name () 110 | .toLowerCase ()); 111 | this.device.executeCommand ("mobile: swipe", param); 112 | } 113 | 114 | /* 115 | * (non-Javadoc) 116 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#tap() 117 | */ 118 | @Override 119 | public void tap () { 120 | log.info ("Tapping on element [{}]...", this.name); 121 | final Point center = this.element.getCenter (); 122 | final Point location = this.element.getLocation (); 123 | 124 | final Map param = prepareParam (); 125 | param.put ("x", center.getX () - location.getX ()); 126 | param.put ("y", center.getY () - location.getY ()); 127 | this.device.executeCommand ("mobile: tap", param); 128 | } 129 | 130 | /* 131 | * (non-Javadoc) 132 | * @see 133 | * com.github.wasiqb.coteafs.appium.device.DeviceElementActions#verifyThat() 134 | */ 135 | @Override 136 | public IOSElementVerify verifyThat () { 137 | return new IOSElementVerify (this); 138 | } 139 | 140 | /* 141 | * (non-Javadoc) 142 | * @see com.github.wasiqb.coteafs.appium.device.DeviceElementActions#zoom(int) 143 | */ 144 | @Override 145 | public void zoom (final int distance) { 146 | log.info ("Zooming on element [{}]...", this.name); 147 | 148 | final Map param = prepareParam (); 149 | param.put ("scale", 1.5); 150 | param.put ("velocity", distance); 151 | this.device.executeCommand ("mobile: pinch", param); 152 | } 153 | 154 | private Map prepareParam () { 155 | final Map param = new HashMap<> (); 156 | param.put ("element", this.element.getId ()); 157 | return param; 158 | } 159 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/ios/IOSElementVerify.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.ios; 17 | 18 | import com.github.wasiqb.coteafs.appium.device.DeviceElementVerify; 19 | import io.appium.java_client.MobileElement; 20 | import io.appium.java_client.ios.IOSDriver; 21 | import io.appium.java_client.ios.IOSTouchAction; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since 20-May-2017 12:29:27 PM 26 | */ 27 | public class IOSElementVerify extends DeviceElementVerify, IOSDevice, IOSTouchAction> { 28 | /** 29 | * @param actions Action instance 30 | * 31 | * @author wasiq.bhamla 32 | * @since 20-May-2017 12:31:51 PM 33 | */ 34 | public IOSElementVerify (final IOSDeviceElementActions actions) { 35 | super (actions); 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/utils/BatteryHealth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.utils; 17 | 18 | import static com.github.wasiqb.coteafs.error.util.ErrorUtil.fail; 19 | 20 | import com.github.wasiqb.coteafs.appium.error.NotEnoughBatteryChargeError; 21 | import org.apache.logging.log4j.LogManager; 22 | import org.apache.logging.log4j.Logger; 23 | 24 | /** 25 | * @author wasiqb 26 | * @since Oct 2, 2018 27 | */ 28 | public final class BatteryHealth { 29 | private static final Logger log = LogManager.getLogger (); 30 | 31 | /** 32 | * @param state Battery state 33 | * @param level Battery level 34 | * 35 | * @author wasiqb 36 | * @since Oct 2, 2018 37 | */ 38 | public static void check (final String state, final double level) { 39 | log.trace ("Current Battery status is [{}] with charge level as [{}%]...", state, level * 100); 40 | if (!state.equals ("CHARGING") && !state.equals ("FULL") && level < 0.2) { 41 | fail (NotEnoughBatteryChargeError.class, 42 | "Battery does not have enough charging, to continue, put your device on USB..."); 43 | } 44 | } 45 | 46 | private BatteryHealth () { 47 | // Utility class. 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/utils/CapabilityUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.utils; 17 | 18 | import com.github.wasiqb.coteafs.appium.checker.DeviceChecker; 19 | import org.apache.logging.log4j.LogManager; 20 | import org.apache.logging.log4j.Logger; 21 | import org.openqa.selenium.remote.DesiredCapabilities; 22 | 23 | /** 24 | * @author wasiq.bhamla 25 | * @since 08-May-2017 7:51:42 PM 26 | */ 27 | public final class CapabilityUtils { 28 | private static final Logger log = LogManager.getLogger (); 29 | 30 | public static void setCapability (final String key, final T value, final DesiredCapabilities capabilities) { 31 | setCapability (key, value, null, capabilities); 32 | } 33 | 34 | /** 35 | * @param key Capability key 36 | * @param value Capability value 37 | * @param defaultValue Capability default value 38 | * @param capabilities Capabilities 39 | * 40 | * @author wasiq.bhamla 41 | * @since 12-May-2017 9:54:46 PM 42 | */ 43 | public static void setCapability (final String key, final T value, final T defaultValue, 44 | final DesiredCapabilities capabilities) { 45 | setCapability (key, value, defaultValue, capabilities, false); 46 | } 47 | 48 | /** 49 | * @param key Capability key 50 | * @param value Capability value 51 | * @param defaultValue Capability default value 52 | * @param capabilities Capabilities 53 | * @param mandatory Is mandatory 54 | * 55 | * @author wasiq.bhamla 56 | * @since 08-May-2017 7:53:28 PM 57 | */ 58 | public static void setCapability (final String key, final T value, final T defaultValue, 59 | final DesiredCapabilities capabilities, final boolean mandatory) { 60 | if (mandatory) { 61 | DeviceChecker.checkCapabilitiesParams (key, value); 62 | } 63 | if (value != null && value != defaultValue) { 64 | if (value instanceof Integer && (Integer) value == 0) { 65 | return; 66 | } 67 | log.trace ("Setting capability [key: {}, value: {}]...", key, value); 68 | capabilities.setCapability (key, value); 69 | } 70 | } 71 | 72 | /** 73 | * @author wasiq.bhamla 74 | * @since Jul 23, 2017 2:47:32 PM 75 | */ 76 | private CapabilityUtils () { 77 | // Utility class. 78 | } 79 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/utils/ScreenRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2020, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.utils; 17 | 18 | import static java.text.MessageFormat.format; 19 | import static org.apache.commons.io.FileUtils.writeByteArrayToFile; 20 | 21 | import java.io.File; 22 | import java.io.IOException; 23 | import java.text.SimpleDateFormat; 24 | import java.util.Base64; 25 | import java.util.Calendar; 26 | import java.util.HashMap; 27 | import java.util.Map; 28 | 29 | import com.github.wasiqb.coteafs.appium.config.device.RecordSetting; 30 | import com.github.wasiqb.coteafs.appium.config.device.VideoStreamSetting; 31 | import org.apache.logging.log4j.LogManager; 32 | import org.apache.logging.log4j.Logger; 33 | 34 | /** 35 | * @author wasiqb 36 | * @since Oct 13, 2018 37 | */ 38 | public class ScreenRecorder { 39 | private static final Logger LOG = LogManager.getLogger (); 40 | 41 | /** 42 | * @param streamSetting Video Stream settings 43 | * 44 | * @return streaming args 45 | * 46 | * @author Wasiq Bhamla 47 | * @since 11-Mar-2021 48 | */ 49 | public static Map getVideoStreamArgs (final VideoStreamSetting streamSetting) { 50 | final Map args = new HashMap<> (); 51 | args.put ("host", streamSetting.getHost ()); 52 | args.put ("port", streamSetting.getPort ()); 53 | args.put ("width", streamSetting.getWidth ()); 54 | args.put ("height", streamSetting.getHeight ()); 55 | args.put ("quality", streamSetting.getQuality () 56 | .getQuality ()); 57 | args.put ("bitRate", streamSetting.getBitRate () * 100000); 58 | LOG.trace ("Video streaming args: {}", args); 59 | return args; 60 | } 61 | 62 | /** 63 | * @param content Video content 64 | * @param setting Video record settings 65 | * 66 | * @author wasiqb 67 | * @since Oct 13, 2018 68 | */ 69 | public static void saveRecording (final String content, final RecordSetting setting) { 70 | final byte[] decode = Base64.getDecoder () 71 | .decode (content); 72 | try { 73 | final String path = setting.getPath (); 74 | final String prefix = setting.getPrefix (); 75 | final SimpleDateFormat date = new SimpleDateFormat ("yyyyMMdd-HHmmss"); 76 | final String timeStamp = date.format (Calendar.getInstance () 77 | .getTime ()); 78 | final String fileName = format ("{0}/{1}-{2}.{3}", path, prefix, timeStamp, "mp4"); 79 | LOG.info ("Saving video recording to [{}] path...", fileName); 80 | writeByteArrayToFile (new File (fileName), decode); 81 | } catch (final IOException e) { 82 | LOG.error ("Error occurred while saving video recording..."); 83 | LOG.catching (e); 84 | } 85 | } 86 | 87 | private ScreenRecorder () { 88 | // Utility class. 89 | } 90 | } -------------------------------------------------------------------------------- /src/main/java/com/github/wasiqb/coteafs/appium/utils/SwipeUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, Wasiq Bhamla. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.github.wasiqb.coteafs.appium.utils; 17 | 18 | import static com.github.wasiqb.coteafs.error.util.ErrorUtil.fail; 19 | import static io.appium.java_client.touch.WaitOptions.waitOptions; 20 | import static io.appium.java_client.touch.offset.PointOption.point; 21 | import static java.text.MessageFormat.format; 22 | import static java.time.Duration.ofMillis; 23 | 24 | import com.github.wasiqb.coteafs.appium.config.device.DelaySetting; 25 | import com.github.wasiqb.coteafs.appium.config.enums.SwipeDirection; 26 | import com.github.wasiqb.coteafs.appium.config.enums.SwipeStartPosition; 27 | import com.github.wasiqb.coteafs.appium.error.DeviceElementNotDisplayedError; 28 | import io.appium.java_client.MobileElement; 29 | import io.appium.java_client.TouchAction; 30 | import lombok.Builder; 31 | import org.openqa.selenium.Dimension; 32 | import org.openqa.selenium.Point; 33 | 34 | /** 35 | * @author wasiq.bhamla 36 | * @since 21-Mar-2021 37 | */ 38 | @Builder (builderMethodName = "init", buildMethodName = "prepare") 39 | public final class SwipeUtils> { 40 | private final T actions; 41 | @Builder.Default 42 | private final SwipeDirection direction = SwipeDirection.DOWN; 43 | @Builder.Default 44 | private final int distancePercent = 20; 45 | private final Point elementLocation; 46 | private final Dimension elementSize; 47 | @Builder.Default 48 | private final int maxSwipe = 10; 49 | private final Dimension screenSize; 50 | private final DelaySetting setting; 51 | @Builder.Default 52 | private final SwipeStartPosition startPosition = SwipeStartPosition.CENTER; 53 | private final MobileElement targetElement; 54 | 55 | /** 56 | * @param fromElement Drag element 57 | * @param toElement Drop `fromElement` to this element 58 | * 59 | * @return touch action 60 | * 61 | * @author wasiq.bhamla 62 | * @since Feb 2, 2018 3:25:54 PM 63 | */ 64 | public T dragTo (final MobileElement fromElement, final MobileElement toElement) { 65 | final Point source = fromElement.getCenter (); 66 | final Point target = toElement.getCenter (); 67 | return this.actions.press (point (source.getX (), source.getY ())) 68 | .waitAction (waitOptions (ofMillis (this.setting.getBeforeSwipe ()))) 69 | .moveTo (point (target.getX (), target.getY ())) 70 | .release () 71 | .waitAction (waitOptions (ofMillis (this.setting.getAfterSwipe ()))); 72 | } 73 | 74 | /** 75 | * @return action 76 | * 77 | * @author Wasiq Bhamla 78 | * @since 21-Mar-2021 79 | */ 80 | public T swipeTo () { 81 | T result = swipe (); 82 | if (this.targetElement != null) { 83 | boolean found = false; 84 | for (int index = 0; index < this.maxSwipe; index++) { 85 | if (this.targetElement.isDisplayed ()) { 86 | found = true; 87 | break; 88 | } 89 | result = swipe (); 90 | } 91 | if (!found) { 92 | final String message = "Element not found even after {0} swipes in {1} direction."; 93 | fail (DeviceElementNotDisplayedError.class, format (message, this.direction, this.maxSwipe)); 94 | } 95 | } 96 | return result; 97 | } 98 | 99 | private Point getStartPoint () { 100 | final int x; 101 | final int y; 102 | int width = this.screenSize.getWidth (); 103 | int height = this.screenSize.getHeight (); 104 | Point location = new Point (0, 0); 105 | 106 | if (this.elementSize != null) { 107 | width = this.elementSize.getWidth (); 108 | height = this.elementSize.getHeight (); 109 | location = this.elementLocation; 110 | } 111 | 112 | switch (this.startPosition) { 113 | case BOTTOM -> { 114 | x = width / 2; 115 | y = this.elementSize != null && height + location.getY () < this.screenSize.getHeight () 116 | ? height 117 | : height - 5; 118 | } 119 | case CENTER -> { 120 | x = width / 2; 121 | y = height / 2; 122 | } 123 | case LEFT -> { 124 | x = this.elementSize != null && width + location.getX () > 0 ? 0 : 5; 125 | y = height / 2; 126 | } 127 | case RIGHT -> { 128 | x = this.elementSize != null && width + location.getX () < this.screenSize.getWidth () 129 | ? width 130 | : width - 5; 131 | y = height / 2; 132 | } 133 | default -> { 134 | x = width / 2; 135 | y = 5; 136 | } 137 | } 138 | return new Point (location.getX () + x, location.getY () + y); 139 | } 140 | 141 | private T swipe () { 142 | final double distance = this.distancePercent / 100.0; 143 | final Point source = getStartPoint (); 144 | int endX = source.getX () + (int) (source.getX () * this.direction.getX () * distance); 145 | int endY = source.getY () + (int) (source.getY () * this.direction.getY () * distance); 146 | if (this.elementSize != null) { 147 | endX = source.getX () + (int) (this.elementSize.getWidth () * this.direction.getX () * distance); 148 | endY = source.getY () + (int) (this.elementSize.getHeight () * this.direction.getY () * distance); 149 | } 150 | return this.actions.press (point (source.getX (), source.getY ())) 151 | .waitAction (waitOptions (ofMillis (this.setting.getBeforeSwipe ()))) 152 | .moveTo (point (endX, endY)) 153 | .release (); 154 | } 155 | } -------------------------------------------------------------------------------- /src/main/resources/log4j2.yaml: -------------------------------------------------------------------------------- 1 | Configuration: 2 | status: warn 3 | name: Default 4 | monitorInterval: 30 5 | 6 | properties: 7 | property: 8 | - name: log-path 9 | value: logs 10 | - name: error-log 11 | value: coteafs-appium-log-error 12 | - name: all-log 13 | value: coteafs-appium-log-all 14 | - name: test-log 15 | value: coteafs-appium-log-main 16 | - name: log-pattern 17 | value: "[%d{HH:mm:ss.SSS}] [%-5level] - %msg (%logger{1}:%L) %throwable{short.message}%n" 18 | 19 | appenders: 20 | Console: 21 | name: "console-log" 22 | target: SYSTEM_OUT 23 | PatternLayout: 24 | pattern: ${log-pattern} 25 | RollingFile: 26 | - name: "all-log-appender" 27 | fileName: ${log-path}/${all-log}.log 28 | filePattern: ${log-path}/${all-log}-%d{yyyy-MM-dd}.log 29 | append: false 30 | immediateFlush: true 31 | PatternLayout: 32 | pattern: ${log-pattern} 33 | Policies: 34 | TimeBasedTriggeringPolicy: 35 | interval: 1 36 | modulate: true 37 | SizeBasedTriggeringPolicy: 38 | size: 5MB 39 | - name: "test-log-appender" 40 | fileName: ${log-path}/${test-log}.log 41 | filePattern: ${log-path}/${test-log}-%d{yyyy-MM-dd}.log 42 | append: false 43 | immediateFlush: true 44 | PatternLayout: 45 | pattern: ${log-pattern} 46 | Policies: 47 | TimeBasedTriggeringPolicy: 48 | interval: 1 49 | modulate: true 50 | SizeBasedTriggeringPolicy: 51 | size: 5MB 52 | - name: "error-log-appender" 53 | fileName: ${log-path}/${error-log}.log 54 | filePattern: ${log-path}/${error-log}-%d{yyyy-MM-dd}.log 55 | append: false 56 | immediateFlush: true 57 | PatternLayout: 58 | pattern: ${log-pattern} 59 | Policies: 60 | TimeBasedTriggeringPolicy: 61 | interval: 1 62 | modulate: true 63 | SizeBasedTriggeringPolicy: 64 | size: 5MB 65 | Async: 66 | name: async 67 | AppenderRef: 68 | ref: "test-log-appender" 69 | 70 | Loggers: 71 | Root: 72 | level: all 73 | AppenderRef: 74 | - ref: "console-log" 75 | level: debug 76 | - ref: "async" 77 | level: info 78 | - ref: "all-log-appender" 79 | level: trace 80 | - ref: "error-log-appender" 81 | level: error -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/SauceDemoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android; 19 | 20 | import static com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage.PASSWORD; 21 | import static com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage.USER_NAME; 22 | 23 | import com.github.wasiqb.coetafs.appium.saucedemo.android.actions.SuccessLoginAction; 24 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 25 | import com.github.wasiqb.coteafs.appium.service.AppiumServer; 26 | import org.testng.annotations.AfterTest; 27 | import org.testng.annotations.BeforeTest; 28 | import org.testng.annotations.Optional; 29 | import org.testng.annotations.Parameters; 30 | import org.testng.annotations.Test; 31 | 32 | public class SauceDemoTest { 33 | private AndroidDevice device; 34 | private AppiumServer server; 35 | 36 | @BeforeTest 37 | @Parameters ({ "server", "device" }) 38 | public void setupTest (@Optional final String serverName, @Optional final String deviceName) { 39 | this.server = new AppiumServer (serverName); 40 | this.server.start (); 41 | 42 | this.device = new AndroidDevice (this.server, deviceName); 43 | this.device.start (); 44 | } 45 | 46 | @AfterTest 47 | public void tearDownTest () { 48 | this.device.stop (); 49 | this.server.stop (); 50 | } 51 | 52 | @Test 53 | public void testLogin () { 54 | final SuccessLoginAction loginAction = new SuccessLoginAction (this.device); 55 | loginAction.addInputValue (USER_NAME, "standard_user") 56 | .addInputValue (PASSWORD, "secret_sauce") 57 | .perform (); 58 | } 59 | } -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/actions/SuccessLoginAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android.actions; 19 | 20 | import static com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage.LOGIN_BTN; 21 | import static com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage.PASSWORD; 22 | import static com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage.USER_NAME; 23 | 24 | import com.github.wasiqb.coetafs.appium.saucedemo.android.page.LoginPage; 25 | import com.github.wasiqb.coteafs.appium.android.AndroidActivityActions; 26 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 27 | 28 | public class SuccessLoginAction extends AndroidActivityActions { 29 | public SuccessLoginAction (final AndroidDevice device) { 30 | super (device); 31 | } 32 | 33 | @Override 34 | public void perform () { 35 | final LoginPage loginPage = new LoginPage (getDevice ()); 36 | loginPage.onElement (USER_NAME) 37 | .enterText (value (USER_NAME)); 38 | loginPage.onElement (PASSWORD) 39 | .enterText (PASSWORD); 40 | loginPage.onElement (LOGIN_BTN) 41 | .tap (); 42 | } 43 | } -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/page/DashboardPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android.page; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.WaitStrategy.VISIBLE; 21 | import static com.github.wasiqb.coteafs.appium.device.DeviceElement.create; 22 | import static io.appium.java_client.MobileBy.AccessibilityId; 23 | import static org.openqa.selenium.By.id; 24 | 25 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 26 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 27 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 28 | 29 | public class DashboardPage extends AndroidActivity { 30 | public static final String CART = "Cart"; 31 | public static final String DROP_ZONE = "Drop zone"; 32 | public static final String FILTER = "Filter"; 33 | public static final String MENU = "Menu"; 34 | public static final String PRODUCTS = "Product list"; 35 | public static final String TOGGLE = "Toggle view"; 36 | 37 | protected DashboardPage (final AndroidDevice device) { 38 | super (device); 39 | } 40 | 41 | @Override 42 | protected DeviceElement prepare () { 43 | final DeviceElement main = create ("Main").forAndroid (id ("android:id/content")); 44 | 45 | create (MENU).parent (main) 46 | .waitStrategy (VISIBLE) 47 | .forAndroid (AccessibilityId ("test-Menu")); 48 | create (CART).parent (main) 49 | .forAndroid (AccessibilityId ("test-Cart")) 50 | .waitStrategy (VISIBLE); 51 | create (DROP_ZONE).parent (main) 52 | .waitStrategy (VISIBLE) 53 | .forAndroid (AccessibilityId ("test-Cart drop zone")); 54 | create (TOGGLE).parent (main) 55 | .waitStrategy (VISIBLE) 56 | .forAndroid (AccessibilityId ("test-Toggle")); 57 | create (FILTER).parent (main) 58 | .waitStrategy (VISIBLE) 59 | .forAndroid (AccessibilityId ("test-Modal Selector Button")); 60 | create (PRODUCTS).parent (main) 61 | .waitStrategy (VISIBLE) 62 | .forAndroid (AccessibilityId ("test-PRODUCTS")); 63 | 64 | return main; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/page/LoginPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android.page; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.WaitStrategy.VISIBLE; 21 | import static com.github.wasiqb.coteafs.appium.device.DeviceElement.create; 22 | import static io.appium.java_client.MobileBy.AccessibilityId; 23 | 24 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 25 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 26 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 27 | 28 | public class LoginPage extends AndroidActivity { 29 | public static final String LOGIN_BTN = "Login button"; 30 | public static final String PASSWORD = "Password"; 31 | public static final String USER_NAME = "User Name"; 32 | 33 | public LoginPage (final AndroidDevice device) { 34 | super (device); 35 | } 36 | 37 | @Override 38 | protected DeviceElement prepare () { 39 | final DeviceElement page = create ("Login Form").forAndroid (AccessibilityId ("test-Login")); 40 | 41 | create (USER_NAME).parent (page) 42 | .waitStrategy (VISIBLE) 43 | .forAndroid (AccessibilityId ("test-Username")); 44 | create (PASSWORD).parent (page) 45 | .waitStrategy (VISIBLE) 46 | .forAndroid (AccessibilityId ("test-Password")); 47 | create (LOGIN_BTN).parent (page) 48 | .waitStrategy (VISIBLE) 49 | .forAndroid (AccessibilityId ("test-LOGIN")); 50 | 51 | return page; 52 | } 53 | } -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/page/components/FilterPopUp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android.page.components; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.WaitStrategy.VISIBLE; 21 | import static com.github.wasiqb.coteafs.appium.device.DeviceElement.create; 22 | import static io.appium.java_client.MobileBy.AndroidUIAutomator; 23 | import static org.openqa.selenium.By.id; 24 | 25 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 26 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 27 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 28 | 29 | public class FilterPopUp extends AndroidActivity { 30 | public static final String OPTION = "Filter Option: {0}"; 31 | 32 | protected FilterPopUp (final AndroidDevice device) { 33 | super (device); 34 | } 35 | 36 | @Override 37 | protected DeviceElement prepare () { 38 | final DeviceElement main = create ("Main").forAndroid (id ("android:id/content")); 39 | 40 | create (OPTION).parent (main) 41 | .forAndroid (AndroidUIAutomator ("new UiSelector().textContains(\"{0}\")")) 42 | .waitStrategy (VISIBLE); 43 | 44 | return main; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/com/github/wasiqb/coetafs/appium/saucedemo/android/page/components/ProductItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2021, Wasiq Bhamla. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | package com.github.wasiqb.coetafs.appium.saucedemo.android.page.components; 19 | 20 | import static com.github.wasiqb.coteafs.appium.config.enums.WaitStrategy.VISIBLE; 21 | import static com.github.wasiqb.coteafs.appium.device.DeviceElement.create; 22 | import static io.appium.java_client.MobileBy.AccessibilityId; 23 | 24 | import com.github.wasiqb.coteafs.appium.android.AndroidActivity; 25 | import com.github.wasiqb.coteafs.appium.android.AndroidDevice; 26 | import com.github.wasiqb.coteafs.appium.device.DeviceElement; 27 | 28 | public class ProductItem extends AndroidActivity { 29 | public static final String ADD_CART = "Add to Cart"; 30 | public static final String DESCRIPTION = "Product Description"; 31 | public static final String DRAG_HANDLE = "Product Drag handle"; 32 | public static final String PRICE = "Product Price"; 33 | public static final String TITLE = "Product Title"; 34 | 35 | protected ProductItem (final AndroidDevice device) { 36 | super (device); 37 | } 38 | 39 | @Override 40 | protected DeviceElement prepare () { 41 | final DeviceElement item = create ("Product Item").forAndroid (AccessibilityId ("test-Item")); 42 | 43 | create (TITLE).parent (item) 44 | .forAndroid (AccessibilityId ("test-Item title")) 45 | .waitStrategy (VISIBLE); 46 | create (DESCRIPTION).parent (item) 47 | .forAndroid (AccessibilityId ("test-Item description")) 48 | .waitStrategy (VISIBLE); 49 | create (PRICE).parent (item) 50 | .forAndroid (AccessibilityId ("test-Price")) 51 | .waitStrategy (VISIBLE); 52 | create (DRAG_HANDLE).parent (item) 53 | .forAndroid (AccessibilityId ("test-Drag Handle")) 54 | .waitStrategy (VISIBLE); 55 | create (ADD_CART).parent (item) 56 | .forAndroid (AccessibilityId ("test-ADD TO CART")) 57 | .waitStrategy (VISIBLE); 58 | 59 | return item; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/resources/appium-config.yaml: -------------------------------------------------------------------------------- 1 | server: &default_server 2 | host: 0.0.0.0 3 | appium_path: /Users/in-wasiq.bhamla/.nvm/versions/node/v14.15.4/lib/node_modules/appium/build/lib/main.js 4 | session_override: true 5 | logs: 6 | level: DEBUG 7 | path: logs/appium-server.log 8 | timestamp: true 9 | local_timezone: true 10 | debug_spacing: true 11 | 12 | servers: 13 | android: 14 | <<: *default_server 15 | port: 4723 16 | allow_insecure: 17 | - adb_screen_streaming 18 | android: 19 | suppress_adb_kill: true 20 | ios: 21 | <<: *default_server 22 | port: 4725 23 | ios: 24 | wda_port: 8101 25 | browserstack: 26 | protocol: HTTPS 27 | cloud: BROWSERSTACK 28 | user_name: ${env:CLOUD_USER} 29 | password: ${env:CLOUD_KEY} 30 | 31 | device: &default_device 32 | os: ANDROID 33 | type: REAL 34 | language: US 35 | session_timeout: 120000 36 | others: 37 | clear_files: true 38 | no_reset: false 39 | full_reset: false 40 | clear_logs: true 41 | playback: 42 | stream: 43 | enabled: false 44 | width: 700 45 | height: 1024 46 | quality: HIGH 47 | bit_rate: 50 48 | screenshot: 49 | on_error: true 50 | recording: 51 | enabled: false 52 | time_limit: 5 53 | android: 54 | size: 800x720 55 | ios: 56 | fps: 30 57 | delay: 58 | before_swipe: 200 59 | after_swipe: 100 60 | before_tap: 0 61 | after_tap: 0 62 | implicit: 1 63 | explicit: 5 64 | 65 | devices: 66 | android: 67 | <<: *default_device 68 | name: Google_Pixel_4_XL 69 | version: 11.0 70 | automation: UIAUTOMATOR2 71 | type: SIMULATOR 72 | android: 73 | avd: 74 | name: Google_Pixel_4_XL 75 | launch_timeout: 60000 76 | ready_timeout: 60000 77 | args: -gpu swiftshader_indirect 78 | app: 79 | install_timeout: 60000 80 | type: HYBRID 81 | path: apps/android/saucedemo.apk 82 | wait_activity: com.swaglabsmobileapp.MainActivity 83 | android_bs: 84 | name: Samsung Galaxy S10 85 | automation: UIAUTOMATOR2 86 | cloud_capabilities: 87 | os_version: 9.0 88 | device: Samsung Galaxy S10 89 | app: AndroidApp 90 | project: Project Appium 91 | build: Build-1 92 | name: Test 1 93 | browserstack.appium_version: 1.20.2 94 | playback: 95 | screenshot: 96 | on_error: true 97 | android: 98 | app: 99 | ignore_unimportant_views: false 100 | ios_bs: 101 | name: iPhone 12 Pro Max 102 | os: IOS 103 | automation: XCUI 104 | cloud_capabilities: 105 | os_version: 14 106 | device: iPhone 12 Pro Max 107 | app: IOSApp 108 | project: Project Appium 109 | build: Build-1 110 | name: IOS_Test 1 111 | browserstack.appium_version: 1.20.2 112 | iphone: 113 | <<: *default_device 114 | name: iPhone 12 Pro 115 | version: 14.4 116 | automation: XCUI 117 | type: SIMULATOR 118 | os: IOS 119 | ios: 120 | app: 121 | path: apps/ios/saucedemo.zip 122 | type: HYBRID 123 | -------------------------------------------------------------------------------- /src/test/resources/apps/android/saucedemo.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/src/test/resources/apps/android/saucedemo.apk -------------------------------------------------------------------------------- /src/test/resources/apps/ios/saucedemo.ipa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/src/test/resources/apps/ios/saucedemo.ipa -------------------------------------------------------------------------------- /src/test/resources/apps/ios/saucedemo.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WasiqB/coteafs-appium/d827b9030d3a9d8cda52618f9c046ed6a5b20b1d/src/test/resources/apps/ios/saucedemo.zip -------------------------------------------------------------------------------- /src/test/resources/listener-config.yml: -------------------------------------------------------------------------------- 1 | log: 2 | configurations: true 3 | data_provider: true 4 | execution: true 5 | suites: true 6 | tests: true -------------------------------------------------------------------------------- /testng-local.yaml: -------------------------------------------------------------------------------- 1 | name: coteafs-appium Test Suite 2 | listeners: 3 | - com.github.wasiqb.coteafs.listeners.ConfigListener 4 | - com.github.wasiqb.coteafs.listeners.SuiteListener 5 | - com.github.wasiqb.coteafs.listeners.TestListener 6 | - com.github.wasiqb.coteafs.listeners.ExecutionListener 7 | - com.github.wasiqb.coteafs.listeners.DataProviderListener 8 | - com.github.wasiqb.coteafs.listeners.AnnotationTransformer 9 | - com.github.wasiqb.coteafs.listeners.SuiteResultReporter 10 | tests: 11 | - name: Android Test Local App 12 | parameters: { server: android, device: android } 13 | classes: 14 | - name: com.github.wasiqb.coetafs.appium.saucedemo.android.SauceDemoTest 15 | includedMethods: 16 | - testLogin 17 | -------------------------------------------------------------------------------- /testng.yaml: -------------------------------------------------------------------------------- 1 | name: coteafs-appium Test Suite 2 | listeners: 3 | - com.github.wasiqb.coteafs.listeners.ConfigListener 4 | - com.github.wasiqb.coteafs.listeners.SuiteListener 5 | - com.github.wasiqb.coteafs.listeners.TestListener 6 | - com.github.wasiqb.coteafs.listeners.ExecutionListener 7 | - com.github.wasiqb.coteafs.listeners.DataProviderListener 8 | - com.github.wasiqb.coteafs.listeners.AnnotationTransformer 9 | - com.github.wasiqb.coteafs.listeners.SuiteResultReporter 10 | tests: 11 | - name: Android Test 12 | parameters: { server: browserstack, device: android_bs } 13 | classes: 14 | - name: com.github.wasiqb.coetafs.appium.saucedemo.android.SauceDemoTest 15 | includedMethods: 16 | - testLogin 17 | --------------------------------------------------------------------------------