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

push #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

push #26

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
Binary file not shown.
Binary file added hyperexecute.exe
Binary file not shown.
141 changes: 73 additions & 68 deletions src/test/java/Test1.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void testSetUp(String browser, String version, String platform, String re

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("build", "[HyperExecute - 1] Demonstration of the TestNG Framework");
capabilities.setCapability("build", "HyperExecute -Demonstration of the TestNG Framework");
capabilities.setCapability("name", "[HyperExecute - 1] Demonstration of the TestNG Framework");
capabilities.setCapability("platform", System.getenv("HYPEREXECUTE_PLATFORM"));
capabilities.setCapability("browserName", browser);
Expand All @@ -55,114 +55,119 @@ public void testSetUp(String browser, String version, String platform, String re
@Test(description="To Do App on React App")
public void test1_element_addition_1() throws InterruptedException
{
long startTime = System.currentTimeMillis();
long duration = 600000;
ExtentReports extent = new ExtentReports("target/surefire-reports/html/extentReport.html");
ExtentTest test1 = extent.startTest("demo application test 1-1", "To Do App test 1");
while (System.currentTimeMillis() - startTime < duration) {
driver.get(testURL);
Thread.sleep(5000);

driver.get(testURL);
Thread.sleep(5000);
test1.log(LogStatus.PASS, "URL is opened");
WebDriverWait wait = new WebDriverWait(driver, 5);
test1.log(LogStatus.PASS, "Wait created");

test1.log(LogStatus.PASS, "URL is opened");
WebDriverWait wait = new WebDriverWait(driver, 5);
test1.log(LogStatus.PASS, "Wait created");
By textField = By.id("sampletodotext");

By textField = By.id("sampletodotext");
WebElement addText = driver.findElement(textField);

WebElement addText = driver.findElement(textField);
int item_count = 5;

int item_count = 5;
for (int i = 1; i <= item_count; i++) {
addText.click();
addText.sendKeys("Adding a new item " + i + Keys.ENTER);
test1.log(LogStatus.PASS, "New item No. " + i + " is added");
Thread.sleep(2000);
}

for (int i = 1; i <= item_count; i++) {
addText.click();
addText.sendKeys("Adding a new item " + i + Keys.ENTER);
test1.log(LogStatus.PASS, "New item No. " + i + " is added");
Thread.sleep(2000);
}
WebElement temp_element;

WebElement temp_element;
int totalCount = item_count+5;
int remaining = totalCount-1;

int totalCount = item_count+5;
int remaining = totalCount-1;
for (int i = 1; i <= totalCount; i++, remaining--) {

for (int i = 1; i <= totalCount; i++, remaining--) {
String xpath = "(//input[@type='checkbox'])["+i+"]";

String xpath = "(//input[@type='checkbox'])["+i+"]";
driver.findElement(By.xpath(xpath)).click();
Thread.sleep(500);
test1.log(LogStatus.PASS, "Item No. " + i + " marked completed");
By remainingItem = By.className("ng-binding");
String actualText = driver.findElement(remainingItem).getText();
String expectedText = remaining+" of "+totalCount+" remaining";

driver.findElement(By.xpath(xpath)).click();
Thread.sleep(500);
test1.log(LogStatus.PASS, "Item No. " + i + " marked completed");
By remainingItem = By.className("ng-binding");
String actualText = driver.findElement(remainingItem).getText();
String expectedText = remaining+" of "+totalCount+" remaining";
if (!expectedText.equals(actualText)) {
test1.log(LogStatus.FAIL, "Wrong Text Description");
status = "failed";
}
Thread.sleep(500);

if (!expectedText.equals(actualText)) {
test1.log(LogStatus.FAIL, "Wrong Text Description");
status = "failed";
test1.log(LogStatus.PASS, "Item No. " + i + " completed");
}
Thread.sleep(500);

test1.log(LogStatus.PASS, "Item No. " + i + " completed");
extent.endTest(test1);
extent.flush();
}

extent.endTest(test1);
extent.flush();

/* Once you are outside this code, the list would be empty */
}

@Test(description="To Do App on React App")
public void test1_element_addition_2() throws InterruptedException
{
long startTime = System.currentTimeMillis();
long duration = 600000;
ExtentReports extent = new ExtentReports("target/surefire-reports/html/extentReport.html");
ExtentTest test2 = extent.startTest("demo application test 1-2", "To Do App test 2");
while (System.currentTimeMillis() - startTime < duration) {
driver.get(testURL);
Thread.sleep(5000);

driver.get(testURL);
Thread.sleep(5000);
test2.log(LogStatus.PASS, "URL is opened");
WebDriverWait wait = new WebDriverWait(driver, 5);
test2.log(LogStatus.PASS, "Wait created");

test2.log(LogStatus.PASS, "URL is opened");
WebDriverWait wait = new WebDriverWait(driver, 5);
test2.log(LogStatus.PASS, "Wait created");
By textField = By.id("sampletodotext");

By textField = By.id("sampletodotext");
WebElement addText = driver.findElement(textField);

WebElement addText = driver.findElement(textField);
int item_count = 5;

int item_count = 5;
for (int i = 1; i <= item_count; i++) {
addText.click();
addText.sendKeys("Adding a new item " + i + Keys.ENTER);
test2.log(LogStatus.PASS, "New item No. " + i + " is added");
Thread.sleep(2000);
}

for (int i = 1; i <= item_count; i++) {
addText.click();
addText.sendKeys("Adding a new item " + i + Keys.ENTER);
test2.log(LogStatus.PASS, "New item No. " + i + " is added");
Thread.sleep(2000);
}
WebElement temp_element;

WebElement temp_element;
int totalCount = item_count+5;
int remaining = totalCount-1;

int totalCount = item_count+5;
int remaining = totalCount-1;
for (int i = 1; i <= totalCount; i++, remaining--) {

for (int i = 1; i <= totalCount; i++, remaining--) {
String xpath = "(//input[@type='checkbox'])["+i+"]";

String xpath = "(//input[@type='checkbox'])["+i+"]";
driver.findElement(By.xpath(xpath)).click();
Thread.sleep(500);
test2.log(LogStatus.PASS, "Item No. " + i + " marked completed");
By remainingItem = By.className("ng-binding");
String actualText = driver.findElement(remainingItem).getText();
String expectedText = remaining+" of "+totalCount+" remaining";

driver.findElement(By.xpath(xpath)).click();
Thread.sleep(500);
test2.log(LogStatus.PASS, "Item No. " + i + " marked completed");
By remainingItem = By.className("ng-binding");
String actualText = driver.findElement(remainingItem).getText();
String expectedText = remaining+" of "+totalCount+" remaining";
if (!expectedText.equals(actualText)) {
test2.log(LogStatus.FAIL, "Wrong Text Description");
status = "failed";
}
Thread.sleep(500);

if (!expectedText.equals(actualText)) {
test2.log(LogStatus.FAIL, "Wrong Text Description");
status = "failed";
test2.log(LogStatus.PASS, "Item No. " + i + " completed");
}
Thread.sleep(500);

test2.log(LogStatus.PASS, "Item No. " + i + " completed");
extent.endTest(test2);
extent.flush();
}

extent.endTest(test2);
extent.flush();

/* Once you are outside this code, the list would be empty */
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/Test2.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void testSetUp(String browser, String version, String platform, String re
String platformName = System.getenv("HYPEREXECUTE_PLATFORM") != null ? System.getenv("HYPEREXECUTE_PLATFORM") : platform;

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "[HyperExecute - 2] Demonstration of the TestNG Framework");
capabilities.setCapability("build", "HyperExecute -Demonstration of the TestNG Framework");
capabilities.setCapability("name", "[HyperExecute - 2] Demonstration of the TestNG Framework");

capabilities.setCapability("platform", System.getenv("HYPEREXECUTE_PLATFORM"));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/Test3.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testSetUp(String browser, String version, String platform, String re
String platformName = System.getenv("HYPEREXECUTE_PLATFORM") != null ? System.getenv("HYPEREXECUTE_PLATFORM") : platform;

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "[HyperExecute - 3] Demonstration of the TestNG Framework");
capabilities.setCapability("build", "HyperExecute -Demonstration of the TestNG Framework");
capabilities.setCapability("name", "[HyperExecute - 3] Demonstration of the TestNG Framework");

capabilities.setCapability("platform", System.getenv("HYPEREXECUTE_PLATFORM"));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/Test4.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testSetUp(String browser, String version, String platform, String re
String platformName = System.getenv("HYPEREXECUTE_PLATFORM") != null ? System.getenv("HYPEREXECUTE_PLATFORM") : platform;

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "[HyperExecute - 4] Demonstration of the TestNG Framework");
capabilities.setCapability("build", "HyperExecute -Demonstration of the TestNG Framework");
capabilities.setCapability("name", "[HyperExecute - 4] Demonstration of the TestNG Framework");

capabilities.setCapability("platform", System.getenv("HYPEREXECUTE_PLATFORM"));
Expand Down
Binary file modified target/test-classes/Test1.class
Binary file not shown.
Binary file modified target/test-classes/Test2.class
Binary file not shown.
Binary file modified target/test-classes/Test3.class
Binary file not shown.
Binary file modified target/test-classes/Test4.class
Binary file not shown.