-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49968cd
Showing
25 changed files
with
497 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>desktop-app-automation</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 | ||
org.eclipse.jdt.core.compiler.compliance=1.7 | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
################################################################################################### | ||
# This automation usages 'Cucumber' & 'Winium' Framework to automate the Windows Calculator. # | ||
# # | ||
# How to use? # | ||
# 1: This is Java Maven project # | ||
# 2: Open the 'Runner.java' file # | ||
# 3: Right click and click on 'Run As' -> 'Unit Test' # | ||
# Remark: Use 100% Display Setting instead of 125% for better result. # | ||
################################################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>desktop-app-automation</groupId> | ||
<artifactId>desktop-app-automation</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<name>desktop-app-automation</name> | ||
<!-- FIXME change it to the project's website --> | ||
<url>http://www.example.com</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.7</maven.compiler.source> | ||
<maven.compiler.target>1.7</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.2gis.winium</groupId> | ||
<artifactId>winium-webdriver</artifactId> | ||
<version>0.1.0-1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>6.2.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-junit</artifactId> | ||
<version>6.2.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.10</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
Binary file not shown.
13 changes: 13 additions & 0 deletions
13
src/main/java/desktop_app_automation/desktop_app_automation/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package desktop_app_automation.desktop_app_automation; | ||
|
||
/** | ||
* Hello world! | ||
* | ||
*/ | ||
public class App | ||
{ | ||
public static void main( String[] args ) | ||
{ | ||
System.out.println( "Hello World!" ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#Author: [email protected] | ||
#Keywords Summary : | ||
#Feature: List of scenarios. | ||
#Scenario: Business rule through list of steps with arguments. | ||
#Given: Some precondition step | ||
#When: Some key actions | ||
#Then: To observe outcomes or validation | ||
#And,But: To enumerate more Given,When,Then steps | ||
#Scenario Outline: List of steps for data-driven as an Examples and <placeholder> | ||
#Examples: Container for s table | ||
#Background: List of steps run before each of the scenarios | ||
#""" (Doc Strings) | ||
#| (Data Tables) | ||
#@ (Tags/Labels):To group Scenarios | ||
#<> (placeholder) | ||
#"" | ||
## (Comments) | ||
#Sample Feature Definition Template | ||
@tag | ||
Feature: This feature file will automate the Windows Calculator | ||
I want to use this template for my feature file | ||
|
||
@tag1 | ||
Scenario: Launch Winium Desktop Driver Exe | ||
When Launch Winium Desktop Driver | ||
Then Validate Winium Desktop Driver Launch | ||
|
||
@tag2 | ||
Scenario: Launch Windows Calculator Exe | ||
When Launch Windows Calculator | ||
Then Validate Windows Calculator Launch | ||
|
||
@tag3 | ||
Scenario: Perform Addition For Example 1, 2, 3 | ||
When Perform Addition of 1+2+3 | ||
Then Validate Addition of 1+2+3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package runner; | ||
|
||
import org.junit.runner.RunWith; | ||
import io.cucumber.junit.Cucumber; | ||
import io.cucumber.junit.CucumberOptions; | ||
|
||
@RunWith(Cucumber.class) | ||
@CucumberOptions( | ||
features={"src/main/java/features/calculator.feature"}, | ||
glue="stepdefinitions") | ||
|
||
public class Runner { | ||
/* Nothing to do here */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package stepdefinitions; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.winium.DesktopOptions; | ||
import org.openqa.selenium.winium.WiniumDriver; | ||
|
||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
public class CalculatorSteps { | ||
|
||
private String path = "C:\\Windows\\System32\\calc.exe"; | ||
private String driverURL = "http://localhost:9999"; | ||
static private WiniumDriver driver; | ||
static private String result; | ||
|
||
@When("Launch Windows Calculator") | ||
public void LaunchWindowsCalculator() { | ||
System.out.println("Launching Windows Calculator"); | ||
|
||
URL url = null; | ||
try { | ||
url = new URL(driverURL); | ||
} catch (MalformedURLException e) { | ||
e.printStackTrace(); | ||
System.exit(0); | ||
} | ||
DesktopOptions option = new DesktopOptions(); | ||
option.setApplicationPath(path); | ||
option.setLaunchDelay(1000); | ||
driver = new WiniumDriver(url, option); | ||
} | ||
|
||
@Then("Validate Windows Calculator Launch") | ||
public void ValidateLaunchWindowsCalculator() { | ||
System.out.println("Windows Calculator Launched Successfully"); | ||
} | ||
|
||
@When("Perform Addition of 1+2+3") | ||
public void PerformAddition() throws InterruptedException { | ||
System.out.println("Perform Addition of 1+2+3"); | ||
|
||
Thread.sleep(2000); //Wait for application to launch | ||
|
||
WebElement winelement = driver.findElement(By.name("Calculator")); | ||
winelement.click(); //bring the calculator in front | ||
|
||
driver.findElement(By.name("One")).click(); | ||
driver.findElement(By.name("Plus")).click(); | ||
driver.findElement(By.name("Two")).click(); | ||
driver.findElement(By.name("Plus")).click(); | ||
driver.findElement(By.name("Three")).click(); | ||
driver.findElement(By.name("Equals")).click(); | ||
|
||
result = driver.findElement(By.id("CalculatorResults")).getAttribute("Name"); | ||
} | ||
|
||
@Then("Validate Addition of 1+2+3") | ||
public void ValidateAdditionResult( ) { | ||
System.out.println("Validate Addition of 1+2+3"); | ||
if (result.compareTo("6") != 0) { | ||
System.out.println("Result of 1+2+3 is correct: " + result); | ||
} else { | ||
System.out.println("Result of 1+2+3 is not correct: " + result); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/stepdefinitions/WiniumDesktopDriverSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package stepdefinitions; | ||
|
||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
|
||
public class WiniumDesktopDriverSteps { | ||
|
||
private String path = System.getProperty("user.dir") + "\\src\\main\\java\\winium\\Winium.Desktop.Driver\\Winium.Desktop.Driver.exe"; | ||
|
||
@When("Launch Winium Desktop Driver") | ||
public void LaunchWiniumDesktopDriver() { | ||
System.out.println("Launching Winium Desktop Driver"); | ||
|
||
try { | ||
Runtime.getRuntime().exec(path); | ||
Thread.sleep(2000); //wait to start the exe | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
System.exit(0); | ||
} | ||
} | ||
|
||
@Then("Validate Winium Desktop Driver Launch") | ||
public void ValidateLaunchWiniumDesktopDriver() { | ||
System.out.println("Winium Desktop Driver Launched Successfully"); | ||
} | ||
} |
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
src/test/java/desktop_app_automation/desktop_app_automation/AppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package desktop_app_automation.desktop_app_automation; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* Unit test for simple App. | ||
*/ | ||
public class AppTest | ||
{ | ||
/** | ||
* Rigorous Test :-) | ||
*/ | ||
@Test | ||
public void shouldAnswerWithTrue() | ||
{ | ||
assertTrue( true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Manifest-Version: 1.0 | ||
Built-By: SSrivastava1 | ||
Build-Jdk: 1.8.0_261 | ||
Created-By: Maven Integration for Eclipse | ||
|
7 changes: 7 additions & 0 deletions
7
target/classes/META-INF/maven/desktop-app-automation/desktop-app-automation/pom.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#Generated by Maven Integration for Eclipse | ||
#Sun Aug 16 09:25:03 IST 2020 | ||
version=0.0.1-SNAPSHOT | ||
groupId=desktop-app-automation | ||
m2e.projectName=desktop-app-automation | ||
m2e.projectLocation=C\:\\Users\\ssrivastava1\\eclipse-workspace\\desktop-app-automation | ||
artifactId=desktop-app-automation |
Oops, something went wrong.