Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Signed-off-by: Ismail Elshafeiy
<ismail.elshafeiy@gmailcom>
  • Loading branch information
ismail-elshafeiy committed Jan 5, 2024
1 parent d367e93 commit 71703f4
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 45 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2eTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- name: Set up Native Selenium Grid
if: runner.os == 'Linux'
run: docker-compose -f src/main/resources/docker-compose/selenium4.yml up --scale chrome=4 --scale edge=0 --scale firefox=0 -d

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<properties>
<!-- Make sure you point to the latest release version: https://github.com/ShaftHQ/SHAFT_ENGINE/releases -->
<shaft_engine.version>7.4.20231015</shaft_engine.version>
<shaft_engine.version>8.1.20240102</shaft_engine.version>
<aspectjweaver.version>1.9.20.1</aspectjweaver.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/properties/ExecutionPlatform.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ executionAddress=local
# Windows , Linux , Mac , Android , iOS
targetOperatingSystem=Mac
com.SHAFT.proxySettings=
driverProxySettings=true
jvmProxySettings=true
###################################################
##### END of Properties File
###################################################
1 change: 0 additions & 1 deletion src/main/resources/properties/Performance.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
###################################################
lightHouseExecution=true
lightHouseExecution.port=8888
openLighthouseReportWhileExecution=true
###################################################
##### END of Properties File
###################################################
6 changes: 6 additions & 0 deletions src/main/resources/properties/PlatformFlags.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ retryMaximumNumberOfAttempts=0
# 0 = disabled , 1 = Without Headless Execution , 2 =With Headless Execution
maximumPerformanceMode=0
skipTestsWithLinkedIssues=false
disableCache=false
enableTrueNativeMode=false
handleNonSelectDropDown=true
validateSwipeToElement=true
# Automatic Behaviors
autoMaximizeBrowserWindow=true
automaticallyAssertResponseStatusCode=true
Expand All @@ -17,7 +21,9 @@ forceCheckForElementVisibility=true
forceCheckElementLocatorIsUnique=false
forceCheckTextWasTypedCorrectly=true
forceCheckNavigationWasSuccessful=true
forceCheckStatusOfRemoteServer=false
attemptClearBeforeTypingUsingBackspace=false
attemptClearBeforeTyping=true
respectBuiltInWaitsInNativeMode=true
###################################################
##### END of Properties File
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/properties/Reporting.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
captureElementName=true
captureWebDriverLogs=false
debugMode=false
disableLogging=true
alwaysLogDiscreetly=false
# Allure report properties
openAllureReportAfterExecution=true
cleanAllureResultsDirectoryBeforeExecution=true
generateAllureReportArchive=false
# extent report properties
openExtentReportAfterExecution=false
generateExtentReports=true
cleanExtentReportsDirectoryBeforeExecution=true
attachExtentReportToAllureReport=false
# summary report
cleanSummaryReportsDirectoryBeforeExecution=true
openExecutionSummaryReportAfterExecution=false
## lighthouse report
#openLighthouseReportWhileExecution=true
openLighthouseReportWhileExecution=true
###################################################
##### END of Properties File
###################################################
1 change: 1 addition & 0 deletions src/main/resources/properties/TestNG.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ setVerbose=1
setPreserveOrder=true
setGroupByInstances=true
setDataProviderThreadCount=1
testSuiteTimeout=1440
###################################################
##### END of Properties File
###################################################
6 changes: 5 additions & 1 deletion src/main/resources/properties/Timeouts.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###################################################
##### SHAFT_Engine: Timeouts.properties
###################################################
waitForLazyLoading=false
waitForLazyLoading=true
lazyLoadingTimeout=30
browserNavigationTimeout=30
pageLoadTimeout=30
Expand All @@ -15,6 +15,10 @@ dockerCommandTimeout=30
databaseLoginTimeout=30
databaseNetworkTimeout=30
databaseQueryTimeout=30
waitForRemoteServerToBeUp=false
timeoutForRemoteServerToBeUp=10
remoteServerInstanceCreationTimeout=10
waitUntilTimeout=60
###################################################
##### END of Properties File
###################################################
7 changes: 4 additions & 3 deletions src/main/resources/properties/VisualValidations.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
###################################################
#### VisualValidations.properties
###################################################
screenshotParams_scalingFactor=1
visualMatchingThreshold=0.90
screenshotParams_scalingFactor=1.0
# Always, Never , FailuresOnly, ValidationPointsOnly
screenshotParams_whenToTakeAScreenshot=ValidationPointsOnly
# Always, Never , FailuresOnly, ValidationPointsOnly
whenToTakePageSourceSnapshot=ValidationPointsOnly
# Element, Regular, FullPage,
screenshotParams_screenshotType=Regular
screenshotParams_highlightElements=true
screenshotParams_highlightElements=ture
# JavaScript, AI
screenshotParams_highlightMethod=AI
screenshotParams_skippedElementsFromScreenshot=
Expand All @@ -18,7 +19,7 @@ screenshotParams_watermarkOpacity=0.0
createAnimatedGif=true
animatedGif_frameDelay=500
# Video
videoParams_recordVideo=true
videoParams_recordVideo=false
# DriverSession, testMethod
videoParams_scope=DriverSession
###################################################
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/properties/WebCapabilities.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
###################################################
##### SHAFT_Engine: WebCapabilities.properties
###################################################
# GoogleChrome , MozillaFirefox, InternetExplorer, Safari,
targetBrowserName=GoogleChrome
# chrome , MozillaFirefox, InternetExplorer, Safari,edge
targetBrowserName=chrome
headlessExecution=false
browserWindowWidth=1920
browserWindowHeight=1080
isMobileEmulation=false
mobileEmulation.isCustomDevice=false
# blackberryZ30, BlackberryPlayBook, galaxyNote3, galaxyNoteII, galaxySIII, galaxyS5, galaxyS8, samsungGalaxyS8+, galaxyS9+, galaxyTabS4, galaxyFold, samsungGalaxyS20Ultra, samsungGalaxyA51/71, kindleFireHDX, lgOptimusL70, microsoftLumia550, microsoftLumia950, motoG4, nexus10, nexus4, nexus5, nexus5X, nexus6, nexus6P, nexus7, nokiaLumia520, nokiaN9, nestHub, nestHubMax, pixel2, pixel2XL, pixel3, pixel3XL, pixel4, pixel5, jioPhone2, iPhone4, iPhone5/SE, iPhone6/7/8, iPhone6/7/8Plus, iPhoneSE, iPhoneX, iPhoneXR, iPhone12Pro, iPad, iPadPro, iPadAir, iPadMini, surfacePro7, surfaceDuo
mobileEmulation.deviceName=
mobileEmulation.width=
mobileEmulation.height=
mobileEmulation.pixelRatio=
mobileEmulation.pixelRatio=1.0
mobileEmulation.userAgent=
baseURL=
lightHouseExecution=true
lightHouseExecution.port=8080
###################################################
##### END of Properties File
###################################################
5 changes: 3 additions & 2 deletions src/main/resources/properties/browserStack.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ browserStack.platformVersion=
browserStack.deviceName=
#Use appUrl to test a previously uploaded app file
browserStack.appUrl=
browserStack.customID=
#Use appName and appRelativeFilePath to upload a new app file and test it
browserStack.appName=
browserStack.appRelativeFilePath=
Expand All @@ -25,8 +26,8 @@ browserStack.osVersion=
browserStack.browserVersion=
#Do not change these unless you know what you're doing
browserStack.local=false
browserStack.seleniumVersion=4.1.2
browserStack.appiumVersion=1.22.0
browserStack.seleniumVersion=4.15.2
browserStack.appiumVersion=2.0.1
browserStack.acceptInsecureCerts=true
browserStack.debug=true
browserStack.networkLogs=true
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/properties/default/TestNG.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ setVerbose=1
setPreserveOrder=true
setGroupByInstances=true
setDataProviderThreadCount=1
#Test Suite Timeout in minutes
testSuiteTimeout=1440
###################################################
##### END of PropertiesHelper File
###################################################
4 changes: 3 additions & 1 deletion src/main/resources/properties/path.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ propertiesFolderPath_CI=
propertiesFolderPath=src/main/resources/properties/
dynamicObjectRepositoryPath=src/main/resources/dynamicObjectRepository/
testDataFolderPath=src/test/resources/testDataFiles/
downloadsFolderPath=target/downloadedFiles/
downloadsFolderPath=src/test/resources/downloadFiles/
allureResultsFolderPath=allure-results
extentReportsFolderPath=extent-reports/
executionSummaryReportFolderPath=execution-summary/
video.folder=allure-results/videos
servicesFolderPath=src/test/resources/META-INF/services/
applitoolsApiKey=
########################## Environment ########################
homeUrl=https://demo.nopcommerce.com/
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/Test2/test.java

This file was deleted.

39 changes: 19 additions & 20 deletions src/test/java/examples/gui/web/Test_NewValidationHelper.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package examples.gui.web;

import com.shaft.driver.DriverFactory;
import com.shaft.driver.SHAFT;
import com.shaft.gui.browser.BrowserActions;
import com.shaft.validation.Validations;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import org.testng.annotations.*;

public class Test_NewValidationHelper {
WebDriver driver;
SHAFT.GUI.WebDriver driver;
double elementIdentificationTimeout = SHAFT.Properties.timeouts.defaultElementIdentificationTimeout();

@Test
Expand Down Expand Up @@ -105,13 +104,13 @@ public void f7() {

@Test(groups = {"browserBasedTests"})
public void f8() {
Validations.assertThat().element(driver, By.tagName("h1")).exists().perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).exists().perform();
}

@Test(groups = {"browserBasedTests"})
public void f9() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h3")).exists().perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h3")).exists().perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -121,7 +120,7 @@ public void f9() throws Exception {
@Test(groups = {"browserBasedTests"})
public void f10() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("div")).exists().perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("div")).exists().perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -130,14 +129,14 @@ public void f10() throws Exception {

@Test(groups = {"browserBasedTests"})
public void f11() {
Validations.assertThat().element(driver, By.tagName("h3")).doesNotExist()
Validations.assertThat().element(driver.getDriver(), By.tagName("h3")).doesNotExist()
.withCustomReportMessage("Checking that false tag doesn't exist").perform();
}

@Test(groups = {"browserBasedTests"})
public void f12() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h1")).doesNotExist().perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).doesNotExist().perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -147,7 +146,7 @@ public void f12() throws Exception {
@Test(groups = {"browserBasedTests"})
public void f13() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("div")).doesNotExist().perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("div")).doesNotExist().perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -156,14 +155,14 @@ public void f13() throws Exception {

@Test(groups = {"browserBasedTests"})
public void f14() {
Validations.assertThat().element(driver, By.tagName("h1")).text().isEqualTo("Welcome to the-internet")
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).text().isEqualTo("Welcome to the-internet")
.withCustomReportMessage("Asserting that the header text is correct").perform();
}

@Test(groups = {"browserBasedTests"})
public void f15() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h1")).text().doesNotContain("Welcome").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).text().doesNotContain("Welcome").perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -173,7 +172,7 @@ public void f15() throws Exception {
@Test(groups = {"browserBasedTests"})
public void f16() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h3")).text().doesNotContain("Welcome").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h3")).text().doesNotContain("Welcome").perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -182,23 +181,23 @@ public void f16() throws Exception {

@Test(groups = {"browserBasedTests"})
public void f17() {
Validations.assertThat().element(driver, By.tagName("h1")).attribute("text2").doesNotContain("Welcome").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).attribute("text2").doesNotContain("Welcome").perform();
}

@Test(groups = {"browserBasedTests"})
public void f18() {
Validations.assertThat().element(driver, By.tagName("h1")).attribute("text").doesNotContain("no").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).attribute("text").doesNotContain("no").perform();
}

@Test(groups = {"browserBasedTests"})
public void f20() {
Validations.assertThat().element(driver, By.tagName("h1")).attribute("size").doesNotContain("a").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).attribute("size").doesNotContain("a").perform();
}

@Test(groups = {"browserBasedTests"})
public void f21() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h3")).attribute("text").contains("Welcome").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h3")).attribute("text").contains("Welcome").perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand All @@ -208,7 +207,7 @@ public void f21() throws Exception {
@Test(groups = {"browserBasedTests"})
public void f22() throws Exception {
try {
Validations.assertThat().element(driver, By.tagName("h1")).attribute("text").contains("yyy").perform();
Validations.assertThat().element(driver.getDriver(), By.tagName("h1")).attribute("text").contains("yyy").perform();
throw new Exception("Expected to fail but passed.");
} catch (AssertionError e) {
// pass
Expand Down Expand Up @@ -312,13 +311,13 @@ public void f37() throws Exception {

@BeforeMethod(onlyForGroups = {"browserBasedTests"})
public void openBrowser() {
driver = DriverFactory.getDriver();
BrowserActions.getInstance().navigateToURL("https://the-internet.herokuapp.com/");
driver = new SHAFT.GUI.WebDriver();
driver.browser().navigateToURL("https://the-internet.herokuapp.com/");
}

@AfterMethod(onlyForGroups = {"browserBasedTests"}, alwaysRun = true)
public void closeBrowser() {
DriverFactory.closeAllDrivers();
driver.quit();
}

@BeforeClass
Expand Down
Loading

0 comments on commit 71703f4

Please sign in to comment.