Skip to content

Commit

Permalink
renamed packages from yml to ct and added playwright and parallel exe…
Browse files Browse the repository at this point in the history
…cution support
  • Loading branch information
deepaktiwari committed Dec 17, 2024
1 parent 049be61 commit 794039c
Show file tree
Hide file tree
Showing 60 changed files with 420 additions and 1,629 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<junit.version>4.13.2</junit.version>
<webdrivermanager.version>5.9.2</webdrivermanager.version>
<lombok.version>1.18.26</lombok.version>
<microsoft.playwright.version>1.49.0</microsoft.playwright.version>
<rest-assured.version>5.4.0</rest-assured.version>
<rest-assured-schemavalidator.version>4.3.1</rest-assured-schemavalidator.version>
<box-jsonpatch.version>1.16</box-jsonpatch.version>
Expand Down Expand Up @@ -280,6 +281,11 @@
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>${microsoft.playwright.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.browserstack</groupId>-->
<!-- <artifactId>browserstack-java-sdk</artifactId>-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.commons;
package com.ct.framework.aut.commons;

public enum AppUiObjectNames {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.commons;
package com.ct.framework.aut.commons;

public class ApplicationConstants {
public static final long const_timeout_extra_small=3;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.commons;
package com.ct.framework.aut.commons;

public enum HomePageBottomTabs {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.pojo;
package com.ct.framework.aut.pojo;

import org.openqa.selenium.WebElement;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.pojo;
package com.ct.framework.aut.pojo;

public class User {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.rest;
package com.ct.framework.aut.rest;

public class ApiEndPoints {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.rest;
package com.ct.framework.aut.rest;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.yml.framework.aut.screens;
package com.ct.framework.aut.screens;

import com.aventstack.extentreports.ExtentTest;
import com.google.inject.Inject;
import com.yml.framework.contracts.adapters.MobileDriverActionAdapter;
import com.yml.framework.common.Platform;
import com.ct.framework.contracts.adapters.MobileDriverActionAdapter;
import com.ct.framework.common.Platform;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
Expand Down Expand Up @@ -54,6 +55,11 @@ public void setCurrentTestCase(ExtentTest currentTestCase) {
@iOSXCUITFindBy(id = "searchText")
public WebElement screenTitle;

public WebElement findElementInsideShadowRoot(WebElement shadowHost, String cssSelector){
JavascriptExecutor js = (JavascriptExecutor) driver;
return (WebElement) js.executeScript(
"return arguments[0].shadowRoot.querySelector(arguments[1])", shadowHost, cssSelector);
}



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.aut.screens;
package com.ct.framework.aut.screens;

import com.google.inject.Inject;
import io.appium.java_client.pagefactory.AndroidFindBy;
Expand Down Expand Up @@ -51,5 +51,8 @@ public WelcomeScreen(WebDriver driver, Logger logger) {

@AndroidFindBy(id = "com.saloncentric.app:id/tv_register_discription")
@iOSXCUITFindBy(id = "registerNowButton")
public WebElement registerNowButton;
@FindBy(xpath = "//a[contains(@href,'health.c')]")
public WebElement healthLink;


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yml.framework.aut.screens.login;
package com.ct.framework.aut.screens.login;

import com.google.inject.Inject;
import com.yml.framework.aut.screens.BaseScreen;
import com.ct.framework.aut.screens.BaseScreen;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -64,12 +64,43 @@ public LoginScreen(WebDriver driver,Logger logger) {
@iOSXCUITFindBy(id = "Forgot Password?")
public WebElement noInternetErrorToastMsg;


@AndroidFindBy(xpath = "//android.widget.Toast[1]")
@iOSXCUITFindBy(id = "Forgot Password?")
@FindBy(xpath = "//a[text()='Sign in']")
public WebElement signInLink;

@AndroidFindBy(xpath = "//android.widget.Toast[1]")
@iOSXCUITFindBy(id = "Forgot Password?")
@FindBy(xpath = "(//ymlwebcl-textfield[@textfieldid='email'])[1]")
public WebElement emailShadowRoot;

@AndroidFindBy(xpath = "//android.widget.Toast[1]")
@iOSXCUITFindBy(id = "Forgot Password?")
@FindBy(xpath = "//ymlwebcl-textfield[@textfieldid='password']")
public WebElement passwordShadowRoot;

@AndroidFindBy(xpath = "//android.widget.Toast[1]")
@iOSXCUITFindBy(id = "Forgot Password?")
@FindBy(css = "#email")
public WebElement emailtextBox;

@AndroidFindBy(id = "com.saloncentric.app:id/ivNav")
@iOSXCUITFindBy(id = "product")
@FindBy(xpath = "(//ymlwebcl-button[@partname='button-filled button-fullWidth'])[1]")
public WebElement signinButtonShadowRoot;





public WebElement getInvalidEmailErrorToastMsg() {
return invalidEmailErrorToastMsg;
}




public boolean loginAction(String username, String password) throws Exception {

logger.info("Starting login Action");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.common;
package com.ct.framework.common;


import com.aventstack.extentreports.ExtentTest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.common;
package com.ct.framework.common;

public enum Direction {
UP,DOWN,LEFT,RIGHT;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.common;
package com.ct.framework.common;

public class Platform {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yml.framework.common;
package com.ct.framework.common;

import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.google.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.yml.framework.contracts.adapters;
package com.ct.framework.contracts.adapters;

import com.aventstack.extentreports.ExtentTest;
import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.yml.framework.aut.commons.AppUiObjectNames;
import com.yml.framework.common.Direction;
import com.yml.framework.common.Platform;
import com.ct.framework.aut.commons.AppUiObjectNames;
import com.ct.framework.common.Direction;
import com.ct.framework.common.Platform;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
Expand Down Expand Up @@ -138,6 +138,21 @@ public List<WebElement> getWebElements(String locatorStrategy, String locator) {

}

public WebElement getElementInsideShadowRootById(WebElement parent, String id){

return parent.getShadowRoot().findElement(By.id(id));
}

public WebElement getElementInsideShadowRootByCssSelector(WebElement parent, String cssSelector){

return parent.getShadowRoot().findElement(By.cssSelector(cssSelector));
}

public WebElement getElementInsideShadowRootByXpath(WebElement parent, String xpath){

return parent.getShadowRoot().findElement(By.xpath(xpath));
}

public WebElement getWebElementByLocator(WebElement webElement, String locatorStrategy, String locator) {

WebElement element = null;
Expand Down Expand Up @@ -422,6 +437,7 @@ public void waitAndClickMobileElement(String locatorStrategy, String locator, lo
}



public WebElement waitTillMobileElementClickable(String locatorStrategy, String locator, long timeOutInSeconds) {

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(timeOutInSeconds));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.yml.framework.contracts.impl.android;
package com.ct.framework.contracts.impl.android;

import com.google.common.collect.ImmutableMap;
import com.yml.framework.common.Direction;
import com.yml.framework.contracts.adapters.MobileDriverActionAdapter;
import com.ct.framework.common.Direction;
import com.ct.framework.contracts.adapters.MobileDriverActionAdapter;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.connection.ConnectionStateBuilder;
Expand All @@ -20,7 +20,7 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

import static com.yml.framework.aut.commons.ApplicationConstants.*;
import static com.ct.framework.aut.commons.ApplicationConstants.*;
import static freemarker.template.utility.Collections12.singletonList;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yml.framework.contracts.impl.ios;
package com.ct.framework.contracts.impl.ios;

import com.yml.framework.common.Direction;
import com.yml.framework.contracts.adapters.MobileDriverActionAdapter;
import com.ct.framework.common.Direction;
import com.ct.framework.contracts.adapters.MobileDriverActionAdapter;
import io.appium.java_client.TouchAction;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.touch.WaitOptions;
Expand All @@ -15,8 +15,8 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

import static com.yml.framework.aut.commons.ApplicationConstants.const_timeout_medium;
import static com.yml.framework.aut.commons.ApplicationConstants.const_timeout_small;
import static com.ct.framework.aut.commons.ApplicationConstants.const_timeout_medium;
import static com.ct.framework.aut.commons.ApplicationConstants.const_timeout_small;
import static freemarker.template.utility.Collections12.singletonList;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.yml.framework.contracts.impl.web;
package com.ct.framework.contracts.impl.web;

import com.yml.framework.common.Direction;
import com.yml.framework.contracts.adapters.MobileDriverActionAdapter;
import com.ct.framework.common.Direction;
import com.ct.framework.contracts.adapters.MobileDriverActionAdapter;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
* This class is the main Entry point of the application. It has all the dependency and its
* bindings .It extends Guice AbstractModule class.
*/
package com.yml.framework.prerequisite;
package com.ct.framework.prerequisite;


import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.name.Names;
import com.yml.framework.aut.pojo.User;
import com.yml.framework.common.CommonUtil;
import com.yml.framework.common.Platform;
import com.yml.framework.contracts.adapters.MobileDriverActionAdapter;
import com.yml.framework.prerequisite.providers.PlatformActionProvider;
import com.yml.framework.prerequisite.providers.PlatformDriverProvider;
import com.yml.framework.prerequisite.providers.PlatformProvider;
import com.yml.framework.prerequisite.providers.UserProvider;
import com.yml.framework.reporting.ExtentManager;
import com.ct.framework.aut.pojo.User;
import com.ct.framework.common.CommonUtil;
import com.ct.framework.common.Platform;
import com.ct.framework.contracts.adapters.MobileDriverActionAdapter;
import com.ct.framework.prerequisite.providers.PlatformActionProvider;
import com.ct.framework.prerequisite.providers.PlatformDriverProvider;
import com.ct.framework.prerequisite.providers.PlatformProvider;
import com.ct.framework.prerequisite.providers.UserProvider;
import com.ct.framework.reporting.ExtentManager;
import org.json.JSONObject;
import org.openqa.selenium.WebDriver;

Expand All @@ -42,7 +42,7 @@ public class ConfigurationModule extends AbstractModule {
private ExtentTest test;
private String platformName;
private Map<String, String> testPropertiesMap = new HashMap<String, String>();

private final ThreadLocalScope threadLocalScope = new ThreadLocalScope();
@Inject
private Logger logger = Logger.getAnonymousLogger();

Expand All @@ -52,7 +52,7 @@ public void configure() {
CommonUtil.addFileHandler(logger);
logger.info("Execution Started");
try {

bindScope(ThreadScoped.class, threadLocalScope);
extent = ExtentManager.getInstance();
//requestStaticInjection(ExtentReports.class);
Names.bindProperties(binder(), getConfigProperties());
Expand All @@ -61,9 +61,11 @@ public void configure() {
bind(CommonUtil.class).toInstance(new CommonUtil());
bind(Platform.class).toProvider(PlatformProvider.class);
bind(User.class).toProvider(UserProvider.class);
bind(WebDriver.class).toProvider(PlatformDriverProvider.class).asEagerSingleton();
// bind(WebDriver.class).toProvider(PlatformDriverProvider.class).asEagerSingleton();
bind(WebDriver.class).toProvider(PlatformDriverProvider.class).in(ThreadScoped.class);;
if (!testPropertiesMap.get("platformName").equalsIgnoreCase("api"))
bind(MobileDriverActionAdapter.class).toProvider(PlatformActionProvider.class).asEagerSingleton();
bind(MobileDriverActionAdapter.class).toProvider(PlatformActionProvider.class).in(ThreadScoped.class);
//bind(MobileDriverActionAdapter.class).toProvider(PlatformActionProvider.class).asEagerSingleton();
} catch (Exception e) {
e.printStackTrace();
logger.severe(e.getStackTrace().toString());
Expand Down Expand Up @@ -307,4 +309,6 @@ public String getApplicationUrl(String uiEnv, Properties uiProps) {

return appurl;
}


}
Loading

0 comments on commit 794039c

Please sign in to comment.