Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajio Assignment Implemenation #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions caps/capabilities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"android": {
"platformName": "android",
"platformVersion": "11.0",
"automationName": "UiAutomator2",
"autoGrantPermissions": true,
"appPackage": "com.appiumpro.the_app",
"uiautomator2ServerInstallTimeout": 10000,
"adbExecTimeout": 15000,
"eventTimings": true,
"enablePerformanceLogging": true,
"printPageSourceOnFindFailure": true,
"app": {
"local": "./temp/sampleApps/TheApp-release.apk"
},
"deviceName": "android",
"noSign": true
},
"hostMachines": [
{
"machineIP": "127.0.0.1"
}
]
}
20 changes: 20 additions & 0 deletions configs/BookMyShow_config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
RUNNER=distribute
FRAMEWORK=cucumber
RUNNER_LEVEL=methods
CAPS=./caps/capabilities.json
APPLITOOLS_CONFIGURATION=./configs/applitools_config.json
BASE_URL_FOR_WEB=BOOKMYSHOW_BASE_URL
BROWSER=chrome
ENVIRONMENT_CONFIG_FILE=./src/test/resources/environments.json
IS_VISUAL=false
LOG_DIR=target
LOG_PROPERTIES_FILE=./src/test/resources/log4j.properties
PARALLEL=1
PLATFORM=web
REPORT_PORTAL_FILE=src/test/resources/reportportal.properties
RUN_IN_CI=false
TARGET_ENVIRONMENT=prod
TEST_DATA_FILE=./src/test/resources/testData.json
MAX_NUMBER_OF_APPIUM_DRIVERS=5
MAX_NUMBER_OF_WEB_DRIVERS=5
BROWSER_CONFIG_FILE=./configs/browser_config.json
20 changes: 20 additions & 0 deletions configs/ajio_Shopping_config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
RUNNER=distribute
FRAMEWORK=cucumber
RUNNER_LEVEL=methods
CAPS=./caps/capabilities.json
APPLITOOLS_CONFIGURATION=./configs/applitools_config.json
BASE_URL_FOR_WEB=AJIO_BASE_URL
BROWSER=chrome
ENVIRONMENT_CONFIG_FILE=./src/test/resources/environments.json
IS_VISUAL=false
LOG_DIR=target
LOG_PROPERTIES_FILE=./src/test/resources/log4j.properties
PARALLEL=1
PLATFORM=web
REPORT_PORTAL_FILE=src/test/resources/reportportal.properties
RUN_IN_CI=false
TARGET_ENVIRONMENT=prod
TEST_DATA_FILE=./src/test/resources/testData.json
MAX_NUMBER_OF_APPIUM_DRIVERS=5
MAX_NUMBER_OF_WEB_DRIVERS=5
BROWSER_CONFIG_FILE=./configs/browser_config.json
4 changes: 2 additions & 2 deletions configs/browser_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"disable-default-apps",
"disable-extensions",
"enable-user-metrics",
"incognito",
"show-taps",
"disable-infobars"
],
Expand All @@ -21,7 +20,8 @@
"jhb": true
},
"arguments": [
"use-fake-device-for-media-stream"
"use-fake-device-for-media-stream",
"incognito"
],
"maximize": true,
"acceptInsecureCerts": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.znsio.sample.e2e.businessLayer.ajioShopping;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.ajioShopping.AjioHomePageScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

import java.util.Map;

public class AjioHomePageBL {
private final String currentUserPersona;
private final Platform currentPlatform;
private final TestExecutionContext context;
private final SoftAssertions softly;

public AjioHomePageBL(String userPersona, Platform forPlatform) {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = userPersona;
this.currentPlatform = forPlatform;
Runner.setCurrentDriverForUser(userPersona, forPlatform, context);
}

public AjioHomePageBL() {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public ProductListBL signIn(Map userDetails, String product) {
String username = String.valueOf(userDetails.get("username"));
String password = String.valueOf(userDetails.get("password"));
String firstName = String.valueOf(userDetails.get("firstName"));

boolean isSignedIn = AjioHomePageScreen.get().signIn(username, password, firstName);
softly.assertThat(isSignedIn).as(String.format(firstName+" is not logged In")).isTrue();
AjioHomePageScreen.get().searchProduct(product);
return new ProductListBL();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.znsio.sample.e2e.businessLayer.ajioShopping;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.ajioShopping.CartPageScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

public class CartPageBL {
private final String currentUserPersona;
private final Platform currentPlatform;
private final TestExecutionContext context;
private final SoftAssertions softly;

public CartPageBL(String userPersona, Platform forPlatform) {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = userPersona;
this.currentPlatform = forPlatform;
Runner.setCurrentDriverForUser(userPersona, forPlatform, context);
}

public CartPageBL() {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public void userAppliesCouponAndGetETA() {
CartPageScreen.get().applyCouponAndGetETA();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.znsio.sample.e2e.businessLayer.ajioShopping;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.ajioShopping.ProductLandingPageScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

public class ProductLandingPageBL {
private final String currentUserPersona;
private final Platform currentPlatform;
private final TestExecutionContext context;
private final SoftAssertions softly;

public ProductLandingPageBL(String userPersona, Platform forPlatform) {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = userPersona;
this.currentPlatform = forPlatform;
Runner.setCurrentDriverForUser(userPersona, forPlatform, context);
}

public ProductLandingPageBL() {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public CartPageBL userAddProductToBag() {
ProductLandingPageScreen.get().addProductToBag();
return new CartPageBL();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.znsio.sample.e2e.businessLayer.ajioShopping;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.ajioShopping.ProductListPageScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

public class ProductListBL{
private final String currentUserPersona;
private final Platform currentPlatform;
private final TestExecutionContext context;
private final SoftAssertions softly;

public ProductListBL(String userPersona, Platform forPlatform) {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = userPersona;
this.currentPlatform = forPlatform;
Runner.setCurrentDriverForUser(userPersona, forPlatform, context);
}

public ProductListBL() {
long threadId = Thread.currentThread().getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public ProductLandingPageBL userSelectsProduct(int productPosition) {
ProductListPageScreen.get().selectProduct(productPosition);
return new ProductLandingPageBL();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.znsio.sample.e2e.businessLayer.bookMyShow;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.bookMyShow.BOOKMYSHOW_SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.bookMyShow.BookMyShowLoginPageScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;
import static org.assertj.core.api.Assertions.assertThat;

public class BookMyShowHomePageBL {
private final TestExecutionContext context;
private final SoftAssertions softly;
private final String currentUserPersona;
private final Platform currentPlatform;

public BookMyShowHomePageBL(String userPersona, Platform forPlatform) {
long threadId = Thread.currentThread()
.getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = userPersona;
this.currentPlatform = forPlatform;
Runner.setCurrentDriverForUser(userPersona, forPlatform, context);
}

public BookMyShowHomePageBL() {
long threadId = Thread.currentThread()
.getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = BOOKMYSHOW_SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public BookMyShowHomePageBL launchBookMyShowHomePage() {
boolean isBookMyShowHomepageLaunched = BookMyShowLoginPageScreen.get().isBookMyShowHomepageLaunched();
assertThat(isBookMyShowHomepageLaunched).as(String.format("BookMyShow Home Page Not Launched")).isTrue();
return this;
}

public BookMyShowHomePageBL setLocationAsDelhi(String cityName) {
boolean locationAsDelhi = BookMyShowLoginPageScreen.get().isLocationDelhi(cityName);
softly.assertThat(locationAsDelhi).as(String.format("Location is not set as: "+cityName)).isTrue();
boolean isValidLogin = (boolean) BookMyShowLoginPageScreen.get().isValidLogin();
assertThat(isValidLogin).as(String.format("Not a valid Login")).isTrue();
return this;
}

public MoviePageBL goToMoviesPage() {
BookMyShowLoginPageScreen.get().moviesPage();
return new MoviePageBL();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.znsio.sample.e2e.businessLayer.bookMyShow;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.bookMyShow.BOOKMYSHOW_SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.bookMyShow.BookingPageScreen;
import com.znsio.sample.e2e.screen.bookMyShow.SelectedDateScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

public class BookingPageBL {
private final TestExecutionContext context;
private final SoftAssertions softly;
private final String currentUserPersona;
private final Platform currentPlatform;

public BookingPageBL() {
long threadId = Thread.currentThread()
.getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = BOOKMYSHOW_SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public SelectedMovieBL selectDateAfterTomorrow(String secondMovieTitle) {
boolean onCorrectBookingPage = BookingPageScreen.get().bookingForSelectedMovie(secondMovieTitle);
softly.assertThat(onCorrectBookingPage).as(String.format("Mismatch in Movie Details on Movie Landing Page")).isTrue();
SelectedDateScreen.get().selectExpectedDate();
return new SelectedMovieBL();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.znsio.sample.e2e.businessLayer.bookMyShow;

import com.context.TestExecutionContext;
import com.znsio.sample.e2e.entities.bookMyShow.BOOKMYSHOW_SAMPLE_TEST_CONTEXT;
import com.znsio.sample.e2e.screen.bookMyShow.CinemaHallScreen;
import com.znsio.teswiz.entities.Platform;
import com.znsio.teswiz.runner.Runner;
import org.assertj.core.api.SoftAssertions;

public class CinemaHallBL {
private final TestExecutionContext context;
private final SoftAssertions softly;
private final String currentUserPersona;
private final Platform currentPlatform;

public CinemaHallBL() {
long threadId = Thread.currentThread()
.getId();
this.context = Runner.getTestExecutionContext(threadId);
softly = Runner.getSoftAssertion(threadId);
this.currentUserPersona = BOOKMYSHOW_SAMPLE_TEST_CONTEXT.ME;
this.currentPlatform = Runner.getPlatform();
}

public CinemaHallBL userSelectsSecondSlot(String cinemaHallTitle) {
CinemaHallScreen.get().selectSecondSlot(cinemaHallTitle);
return new CinemaHallBL();
}

public SeatSelectionBL userSelectsNumberOfPeople(int numberOfSeats) {
CinemaHallScreen.get().selectNumberOfPeople(numberOfSeats);
return new SeatSelectionBL();
}
}
Loading