Skip to content

Instantly share code, notes, and snippets.

@photizzo
Created June 23, 2021 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save photizzo/f4a858bf6d92536e0fe40895f0a81843 to your computer and use it in GitHub Desktop.
Save photizzo/f4a858bf6d92536e0fe40895f0a81843 to your computer and use it in GitHub Desktop.
Quote test classes
package com.idealabs.Playground;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import org.junit.jupiter.api.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.concurrent.TimeUnit;
public class AcceptAQuote implements ExceptionsReporter {
public WebDriver driver;
public String ApplicationURL = "https://broker.aktuarial.com/";
@BeforeEach
void setup() throws Exception {
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
}
@AfterEach
public void tearDown() {
driver.quit();
}
@DisplayName("Accept a quote")
@Test
public void execute() throws Exception {
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Disapprove a quote step
GeneratedUtils.sleep(500);
ApprovingQuote approvingQuote = new ApprovingQuote();
approvingQuote.ApplicationURL = ApplicationURL;
approvingQuote.driver = driver;
approvingQuote.execute();
// 2. Logout a User
GeneratedUtils.sleep(1000);
LogoutUser logoutuser = new LogoutUser();
logoutuser.ApplicationURL = ApplicationURL;
logoutuser.execute(driver);
// 3. Navigate to '{{ApplicationURL}}'
GeneratedUtils.sleep(1000);
driver.navigate().to(ApplicationURL);
// 3. Type 'aktuarialtesting@mailinator.com' in 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).sendKeys("aktuarialtesting@mailinator.com");
// 4. Type '@Aktuarial4' in 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).sendKeys("@Aktuarial4");
// 5. Click 'Login2'
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Login']");
driver.findElement(by).click();
// 6. Click 'DIV24'
GeneratedUtils.sleep(7000);
by = By.xpath("//body/div/div[2]/div[2]/div[1]/div/div");
driver.findElement(by).click();
// 7. Click 'DIV25'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div[3]/div[1]");
driver.findElement(by).click();
// 8. Click 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).click();
// 9. Type 'Accepting a quote test' in 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).sendKeys("Accepting a quote test");
// 10. Click 'status1'
GeneratedUtils.sleep(500);
by = By.cssSelector("#acceptedId");
driver.findElement(by).click();
// 11. Click 'commissionType'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='commissionType']");
driver.findElement(by).click();
// 12. Click 'commissionRate'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='commissionRate']");
driver.findElement(by).click();
// 13. Type 'Percentage' in 'commissionType'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='commissionType']");
driver.findElement(by).sendKeys("Percentage");
// 14. Click 'commissionRate'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='commissionRate']");
driver.findElement(by).click();
// 15. Type '10' in 'commissionRate'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='commissionRate']");
driver.findElement(by).sendKeys("10");
// 16. Click 'Accept Quote1'
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Accept Quote']");
driver.findElement(by).click();
// 17. Is 'Pop Up' present?
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[1]/div/div");
driver.findElement(by);
// 18. Click 'Cancel'
GeneratedUtils.sleep(500);
by = By.xpath("//div[3]/div//span[. = 'Cancel']");
driver.findElement(by).click();
// 19. Does 'Accepted' contain 'Accepted'?
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Accepted']");
Assertions.assertTrue(driver.findElement(by).getText().contains("Accepted"));
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
}
package com.idealabs.Playground;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import org.junit.jupiter.api.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.concurrent.TimeUnit;
public class ApprovingQuote implements ExceptionsReporter {
public WebDriver driver;
public String ApplicationURL = "https://broker.aktuarial.com/";
@BeforeEach
void setup() throws Exception {
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
}
@AfterEach
public void tearDown() {
driver.quit();
}
@DisplayName("Approve a new quote")
@Test
public void execute() throws Exception {
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Generate a quote step
GeneratedUtils.sleep(500);
GenerateQuote generateanewquote = new GenerateQuote();
generateanewquote.ApplicationURL = ApplicationURL;
generateanewquote.driver = driver;
generateanewquote.test();
// 2. Logout a User
GeneratedUtils.sleep(1000);
LogoutUser logoutuser = new LogoutUser();
logoutuser.ApplicationURL = ApplicationURL;
logoutuser.execute(driver);
// 3. Navigate to '{{ApplicationURL}}'
GeneratedUtils.sleep(1000);
driver.navigate().to(ApplicationURL);
// 4. Click 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).click();
// 5. Type 'williamsohworuka@hotmail.com' in 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).sendKeys("williamsohworuka@hotmail.com");
// 6. Click 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).click();
// 7. Type 'ohwill949' in 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).sendKeys("ohwill949");
// 8. Click 'Login'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Login']");
driver.findElement(by).click();
// 9. Is 'Home' present?
GeneratedUtils.sleep(8000);
by = By.xpath("//a[. = 'Home']");
driver.findElement(by);
// 10. Does 'OVERVIEW' contain 'OVERVIEW'?
GeneratedUtils.sleep(500);
by = By.xpath("//div[. = 'OVERVIEW']");
Assertions.assertTrue(driver.findElement(by).getText().contains("OVERVIEW"));
// 11. Click 'DIV24'
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[2]/div[2]/div[1]/div/div");
driver.findElement(by).click();
// 12. Click 'DIV25'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div[3]/div[1]");
driver.findElement(by).click();
// 13. Click 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).click();
// 14. Type 'Approving quote test' in 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).sendKeys("Approving quote test");
// 15. Click 'approvalStatus'
GeneratedUtils.sleep(500);
by = By.cssSelector("#approvalId");
driver.findElement(by).click();
// 16. Click 'Approve Quote'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Approve Quote']");
driver.findElement(by).click();
// 17. Is 'Pop Up' present?
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[1]/div/div");
driver.findElement(by);
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
}
package com.idealabs.Playground;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import org.junit.jupiter.api.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.concurrent.TimeUnit;
public class DisapprovingQuote implements ExceptionsReporter {
public WebDriver driver;
public String ApplicationURL = "https://broker.aktuarial.com/";
@BeforeEach
void setup() throws Exception {
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
}
@AfterEach
public void tearDown() {
driver.quit();
}
@DisplayName("Disapprove a new quote")
@Test
public void execute() throws Exception {
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Generate a quote step
GeneratedUtils.sleep(500);
GenerateQuote generateanewquote = new GenerateQuote();
generateanewquote.ApplicationURL = ApplicationURL;
generateanewquote.driver = driver;
generateanewquote.test();
// 2. Logout a User
GeneratedUtils.sleep(1000);
LogoutUser logoutuser = new LogoutUser();
logoutuser.ApplicationURL = ApplicationURL;
logoutuser.execute(driver);
// 3. Navigate to '{{ApplicationURL}}'
GeneratedUtils.sleep(1000);
driver.navigate().to(ApplicationURL);
// 4. Click 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).click();
// 5. Type 'williamsohworuka@hotmail.com' in 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).sendKeys("williamsohworuka@hotmail.com");
// 6. Click 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).click();
// 7. Type 'ohwill949' in 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).sendKeys("ohwill949");
// 8. Click 'Login'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Login']");
driver.findElement(by).click();
// 9. Is 'Home' present?
GeneratedUtils.sleep(8000);
by = By.xpath("//a[. = 'Home']");
driver.findElement(by);
// 10. Does 'OVERVIEW' contain 'OVERVIEW'?
GeneratedUtils.sleep(500);
by = By.xpath("//div[. = 'OVERVIEW']");
Assertions.assertTrue(driver.findElement(by).getText().contains("OVERVIEW"));
// 11. Click 'DIV24'
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[2]/div[2]/div[1]/div/div");
driver.findElement(by).click();
// 12. Click 'DIV27'
GeneratedUtils.sleep(500);
by = By.xpath("//div/div[3]/div[3]/div[1]");
driver.findElement(by).click();
// 13. Type 'Rejecting this quote from testing' in 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).sendKeys("Rejecting this quote from testing");
// 14. Click 'status'
GeneratedUtils.sleep(500);
by = By.cssSelector("#rejectedId");
driver.findElement(by).click();
// 15. Click 'Disapprove Quote'
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Disapprove Quote']");
driver.findElement(by).click();
// 16. Is 'Pop Up' present?
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[1]/div/div");
driver.findElement(by);
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
}
package com.idealabs.Playground;
import com.idealabs.Playground.addon.FileUpload;
import com.idealabs.Playground.addon.JavaWebExampleAddon;
import com.idealabs.Playground.addon.RandomDataGenerator;
import com.idealabs.Playground.addon.RandomLoginCredentials;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.Select;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
public class GenerateQuote implements ExceptionsReporter {
public WebDriver driver;
public String ApplicationURL = "https://broker.aktuarial.com/";
@BeforeEach
void setup() throws Exception {
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
}
// @BeforeEach
public void setUp() throws Exception{
// Optional. If not specified, WebDriver searches the PATH for chromedriver.
// System.setProperty("webdriver.chrome.driver", "/Users/emem/AutomationProjects/chromedriver");
// driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
// driver = new ChromeDriver();
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
driver.manage().window().maximize();
// mainPage = new MainPage(driver);
}
@AfterEach
public void tearDown() {
driver.quit();
}
@DisplayName("generate a new quote")
@Test
public void test() throws Exception {
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Navigate to '{{ApplicationURL}}'
// Navigates the specified URL (Auto-generated)
GeneratedUtils.sleep(500);
driver.navigate().to(ApplicationURL);
// 2. Click 'identity'
GeneratedUtils.sleep(1000);
by = By.cssSelector("[name='identity']");
driver.findElement(by).click();
// 3. Type 'aktuarialtesting@mailinator.com' in 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).sendKeys("aktuarialtesting@mailinator.com");
// 4. Click 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).click();
// 5. Type '@Aktuarial4' in 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).sendKeys("@Aktuarial4");
// 6. Click 'Login'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Login']");
driver.findElement(by).click();
// 7. Is 'Home' present?
GeneratedUtils.sleep(500);
by = By.xpath("//a[. = 'Home']");
driver.findElement(by);
// 8. Does 'OVERVIEW' contain 'OVERVIEW'?
GeneratedUtils.sleep(500);
by = By.xpath("//div[. = 'OVERVIEW']");
Assertions.assertTrue(driver.findElement(by).getText().contains("OVERVIEW"));
// 9. Click 'Request Quote'
GeneratedUtils.sleep(500);
by = By.xpath("//a[. = 'Request Quote']");
driver.findElement(by).click();
// 10. Type 'General' in 'lineOfBusinessId'
GeneratedUtils.sleep(1000);
by = By.cssSelector("[name='lineOfBusinessId']");
driver.findElement(by).sendKeys("General");
// 11. Type 'Individual' in 'clientType'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='clientType']");
driver.findElement(by).sendKeys("Individual");
// 12. Type 'sol' in 'react-select-2-input'
GeneratedUtils.sleep(500);
by = By.cssSelector("#react-select-2-input");
driver.findElement(by).sendKeys("sol");
// 13. Click 'react-select-2-option-0'
GeneratedUtils.sleep(500);
by = By.cssSelector("#react-select-2-option-0");
driver.findElement(by).click();
// 14. Click 'categoryId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='categoryId']");
driver.findElement(by).click();
// 15. Select the '5' option in 'categoryId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='categoryId']");
(new Select(driver.findElement(by))).selectByValue("5");
// 16. Click 'categoryId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='categoryId']");
driver.findElement(by).click();
// 17. Click 'providerId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='providerId']");
driver.findElement(by).click();
// 18. Select the '1' option in 'providerId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='providerId']");
(new Select(driver.findElement(by))).selectByValue("1");
// 19. Click 'providerId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='providerId']");
driver.findElement(by).click();
// 20. Click 'insuranceProduct'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='insuranceProduct']");
driver.findElement(by).click();
// 21. Select the 'AIICO third party' option in 'insuranceProduct'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='insuranceProduct']");
(new Select(driver.findElement(by))).selectByValue("AIICO third party");
// 22. Click 'insuranceProduct'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='insuranceProduct']");
driver.findElement(by).click();
// 23. Type 'WE' in 'quoteNumberPrefix'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='quoteNumberPrefix']");
driver.findElement(by).sendKeys("WE");
// 24. Click 'vehicleTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='vehicleTypeId']");
driver.findElement(by).click();
// 25. Select the '1' option in 'vehicleTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='vehicleTypeId']");
(new Select(driver.findElement(by))).selectByValue("1");
// 26. Click 'vehicleTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='vehicleTypeId']");
driver.findElement(by).click();
// 27. Click 'policyHolderTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='policyHolderTypeId']");
driver.findElement(by).click();
// 28. Select the '2' option in 'policyHolderTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='policyHolderTypeId']");
(new Select(driver.findElement(by))).selectByValue("2");
// 29. Click 'policyHolderTypeId'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='policyHolderTypeId']");
driver.findElement(by).click();
// 30. Click 'DIV20'
GeneratedUtils.sleep(500);
by = By.xpath("//section/div[2]/div[2]/div[2]/div/div/div");
driver.findElement(by).click();
// 31. Click 'Start Date (required)'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='Start Date (required)']");
driver.findElement(by).click();
// 32. Click 'Next Month1'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Next Month']");
driver.findElement(by).click();
// 33. Click '12'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div[4]");
driver.findElement(by).click();
// 34. Click 'DIV21'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div/div/div");
driver.findElement(by).click();
// // 35. Click 'End Date (required)'
// GeneratedUtils.sleep(500);
// by = By.cssSelector("[name='End Date (required)']");
// driver.findElement(by).click();
// 36. Click 'Next Month1'
GeneratedUtils.sleep(500);
by = By.xpath("//button[2]");
driver.findElement(by).click();
// 37. Click 'Next Month1'
GeneratedUtils.sleep(500);
by = By.xpath("//button[2]");
driver.findElement(by).click();
// 38. Click '13'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div[4]");
driver.findElement(by).click();
// 39. Click 'Preview Quote'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Preview Quote']");
driver.findElement(by).click();
// 40. Click 'Save Quote'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Save Quote']");
driver.findElement(by).click();
// 41. Is 'Quote has been sent for approval' present?
GeneratedUtils.sleep(500);
by = By.xpath("//h4[. = 'Quote has been sent for approval']");
driver.findElement(by);
// 42. Click 'Close'
GeneratedUtils.sleep(500);
by = By.xpath("//button[. = 'Close']");
driver.findElement(by).click();
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
private static Stream provideParameters() throws Exception {
return Stream.of(Arguments.of("https://broker.aktuarial.com/","","","",""));
}
}
package com.idealabs.Playground;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import java.lang.Exception;
import java.lang.Override;
import java.lang.String;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
/**
* This class was automatically generated by TestProject
* Project: Aktuarial Website
* Test: Logout User
* Generated by: Olaoye Christiana (olaoyechristy97@gmail.com)
* Generated on Tue Jun 22 18:59:44 GMT 2021.
*/
public class LogoutUser implements ExceptionsReporter {
public static WebDriver driver;
/**
* ApplicationURL test parameter
*/
public String ApplicationURL = "https://broker.aktuarial.com/";
public void execute(WebDriver parentDriver) throws Exception {
driver = parentDriver;
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Navigate to '{{ApplicationURL}}'
// Navigates the specified URL (Auto-generated)
GeneratedUtils.sleep(500);
driver.navigate().to(ApplicationURL);
// 2. Click 'Home'
GeneratedUtils.sleep(500);
by = By.xpath("//a[. = 'Home']");
driver.findElement(by).click();
// 3. Click 'IMG1'
GeneratedUtils.sleep(500);
by = By.xpath("//body/div/div[2]/div[2]/div[1]//img");
driver.findElement(by).click();
// 4. Click 'Logout'
GeneratedUtils.sleep(500);
by = By.xpath("//p[2][. = 'Logout']");
driver.findElement(by).click();
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
}
package com.idealabs.Playground;
import io.testproject.sdk.drivers.ReportingDriver;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import io.testproject.sdk.interfaces.junit5.ExceptionsReporter;
import org.junit.jupiter.api.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import java.util.concurrent.TimeUnit;
public class RejectAQuote implements ExceptionsReporter {
public WebDriver driver;
public String ApplicationURL = "https://broker.aktuarial.com/";
@BeforeEach
void setup() throws Exception {
driver = new RemoteWebDriver("i5cYWbo3M94yqPIb-ckmD0w09Ep0MS8qPoFY6AbJfcY", new ChromeOptions(), "");
}
@AfterEach
public void tearDown() {
driver.quit();
}
@DisplayName("Reject a quote")
@Test
public void execute() throws Exception {
// set timeout for driver actions (similar to step timeout)
driver.manage().timeouts().implicitlyWait(15000, TimeUnit.MILLISECONDS);
By by;
boolean booleanResult;
// 1. Disapprove a quote step
GeneratedUtils.sleep(500);
DisapprovingQuote disapprovingQuote = new DisapprovingQuote();
disapprovingQuote.ApplicationURL = ApplicationURL;
disapprovingQuote.driver = driver;
disapprovingQuote.execute();
// 2. Logout a User
GeneratedUtils.sleep(1000);
LogoutUser logoutuser = new LogoutUser();
logoutuser.ApplicationURL = ApplicationURL;
logoutuser.execute(driver);
// 3. Navigate to '{{ApplicationURL}}'
GeneratedUtils.sleep(1000);
driver.navigate().to(ApplicationURL);
// 3. Type 'aktuarialtesting@mailinator.com' in 'identity'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='identity']");
driver.findElement(by).sendKeys("aktuarialtesting@mailinator.com");
// 4. Type '@Aktuarial4' in 'password'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='password']");
driver.findElement(by).sendKeys("@Aktuarial4");
// 5. Click 'Login2'
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Login']");
driver.findElement(by).click();
// 6. Click 'DIV24'
GeneratedUtils.sleep(5000);
by = By.xpath("//body/div/div[2]/div[2]/div[1]/div/div");
driver.findElement(by).click();
// 7. Click 'DIV25'
GeneratedUtils.sleep(500);
by = By.xpath("//div[2]/div[3]/div[3]/div[1]");
driver.findElement(by).click();
// 8. Click 'status'
GeneratedUtils.sleep(500);
by = By.cssSelector("#rejectedId");
driver.findElement(by).click();
// 9. Click 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).click();
// 10. Type 'Rejecting Quote' in 'remark'
GeneratedUtils.sleep(500);
by = By.cssSelector("[name='remark']");
driver.findElement(by).sendKeys("Rejecting Quote");
// 11. Click 'Reject Quote1'
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Reject Quote']");
driver.findElement(by).click();
// 12. Does 'Rejected' contain 'Rejected'?
GeneratedUtils.sleep(500);
by = By.xpath("//span[. = 'Rejected']");
Assertions.assertTrue(driver.findElement(by).getText().contains("Rejected"));
}
@Override
public ReportingDriver getDriver() {
return (ReportingDriver) driver;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment