-
Install Appium: Go to official Appium website and download and install the latest version for your operating system.
npm i --location=global appium
you must install
UiAutomator2 Driver
which is a test automation framework for Android devices.appium driver install uiautomator2
-
Next, install Appium Inspector v2 by following the instructions on the Appium inspector repository. Appium Inspector v2 is a desktop application that allows you to inspect the UI of your app and automate actions on it.
- Download and install Android Studio from the official Android Studio website.
- Open Android Studio and create a new project. This will ensure that all necessary components are installed.
- Once the project is created, close Android Studio.
- Open Android Studio and click on the
More Actions
dropdown in the welcome screen or in the toolbar, and selectVirtual Device Manager
. - In the AVD Manager, click on the
Create Device
button. - Select a device definition from the list (e.g. Pixel 2), and click on
Next
. - Choose a system image for the device (e.g. Android 11 - API Level 30), and click on
Finish
to download the image if it's not already installed. Follow the on-screen instructions to complete the installation. - The virtual device will now appear in the Device Manager. To start the device, click on
the
Launch this ADV in the emulator
button in theActions
column.
- Download tha Java 11 from the official Oracle website.
- Install the downloaded JDK by following the installation wizard.
- Open the
System Properties
. - Click on
Advanced
system settings. - Click on the
Environment Variables
button. - Under
System variables
, click onNew
. - Enter
JAVA_HOME
as the variable name and the path to the Maven installation directory as the variable value (e.g.C:\Program Files\Java\jdk-11.0.11
). - Click on
OK
to save the variable. - In the
System variables
section, select thePath
variable and click onEdit
. - Click on
New
and enter%JAVA_HOME%\bin
. - Click on
OK
to save the changes.
- Open the
System Properties
. - Click on
Advanced
system settings. - Click on the
Environment Variables
button. - Under
System variables
, click onNew
. - Enter
ANDROID_HOME
as the variable name and the path to your Android SDK directory as the variable value (e.g.C:\Users\YourUserName\AppData\Local\Android\Sdk
). - Click on
OK
to save the variable. - In the
System variables
section, select thePath
variable and click onEdit
. - Click on
New
and enter%ANDROID_HOME%\platform-tools
. - Click on
New
and enter%ANDROID_HOME%\cmdline-tools\latest\bin
. - Click on "OK" to save the changes.
- Download and install Maven from the official Maven website.
- Extract the downloaded archive to a folder on your computer.
- Open the
System Properties
. - Click on
Advanced
system settings. - Click on the
Environment Variables
button. - Under
System variables
, click onNew
. - Enter
MAVEN_HOME
as the variable name and the path to the Maven installation directory as the variable value (e.g.C:\apache-maven-3.8.3
). - Click on
OK
to save the variable. - In the
System variables
section, select thePath
variable and click onEdit
. - Click on
New
and enter%MAVEN_HOME%\bin
. - Click on
OK
to save the changes.
- Download and install Allure commandline tool from the official Allure website.
- Extract the downloaded archive to a folder on your computer.
- Open the
System Properties
. - Click on
Advanced
system settings. - Click on the
Environment Variables
button. - Under
System variables
, click onNew
. - Enter
ALLURE_HOME
as the variable name and the path to the Allure installation directory as the variable value ( e.g.C:\allure-commandline-2.14.0)
. - Click on
OK
to save the variable. - In the
System variables
section, select thePath
variable and click onEdit
. - Click on
New
and enter%ALLURE_HOME%\bin
. - Click on
OK
to save the changes.
Once you have Git installed, follow these steps to clone a project:
- Open your terminal or command prompt.
- Navigate to the directory where you want to clone the project.
- Clone the project using the git clone command followed by the repository URL:
git clone https://github.com/Diegocortes15/appium-automation-framework-imdb.git
- Open the Google Play Store app on your Android device.
- In the search bar, type
IMDb
and press enter. - Look for the iMDB app in the search results.
- Tap on the iMDB app to open its details page.
- On the iMDB app details page, tap the
Install
button. - Review the app permissions and tap
Accept
if you agree. - Wait for the app to download and install.
To start Appium server you should run the following command in your terminal
appium
- Open your terminal or command prompt.
- Enter the following command to know the list of devices attached:
adb devices
- Copy the device identifier and replace
deviceName
inCapabilities.json
file (src/test/resources/Capabilities.json
).
{
"deviceName": "emulator-5554",
"appPackage": "com.imdb.mobile",
"appActivity": "com.imdb.mobile.HomeActivity",
"platformName": "Android",
"automationName": "UiAutomator2"
}
- Open your terminal or command prompt.
- .Navigate to the root directory of the appium-automation-framework-imdb project.
- Run the clean and verify Maven goals using the following command:
mvn clean verify
This will compile the code, run the tests, and generate an Allure report.
- Once the command finishes running, you can view the Allure report by running the following command:
allure serve target/allure-results
This will start a local web server and open the Allure report in your default browser.
Feature: Verify movie description
As a user I want to verify the description of a movie So that I can know more about it
Scenario: Verify movie description
Given I am on the login screen
When I skip the sign-in process
And I navigate to the search screen
And I search for "Interstellar"
Then I should see the movie description "A team of explorers travel through a wormhole in space in an attempt to
ensure humanity's survival."
mvn test -Dtest=AM_0001#am_0002
Feature: Verify adding a movie to watchlist
Scenario: Add a movie to watchlist and verify
Given the user is logged in
And the user is on the search screen
When the user searches for "Passengers"
And the user adds the movie to the watchlist
And the user navigates to the profile screen
Then the movie title should be displayed in the watchlist
mvn test -Dtest=AM_0003#am_0004
Feature: Verify Movie Rating
As a user I want to be able to rate a movie So that I can share my opinion with other users
Scenario: Verify movie rating
Given I am logged in with Google
When I navigate to the Search screen
And I search for "Puss in Boots: The Last Wish"
And I click the empty rate button in the Reviews section
And I set the movie rating to "8"
Then I should see my user rating as "8"
When I click the rate button in the Reviews section
And I click the remove rating button
Then the movie rating should be removed
mvn test -Dtest=AM_0005#am_0006