diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..919ce1f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..4991768
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..ec4bc82
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Configuration.properties b/Configuration.properties
index e69de29..51f5638 100644
--- a/Configuration.properties
+++ b/Configuration.properties
@@ -0,0 +1,2 @@
+browser = chrome
+url=https://www.automationexercise.com
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6d5c3b8
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# UIProjectJUnit
diff --git a/pom.xml b/pom.xml
index 65d8d15..55ee4ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,8 +55,8 @@ https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
maven-compiler-plugin
3.8.1
- 12
- 12
+ 11
+ 11
diff --git a/src/test/java/pages/CartPage.java b/src/test/java/pages/CartPage.java
new file mode 100644
index 0000000..916461b
--- /dev/null
+++ b/src/test/java/pages/CartPage.java
@@ -0,0 +1,75 @@
+package pages;
+
+import org.junit.Assert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+public class CartPage {
+ public CartPage(){
+ PageFactory.initElements(Driver.getDriver(),this);
+ }
+ @FindBy(xpath ="//*[text()='Shopping Cart'] " )
+ public WebElement cartPage ;
+
+ @FindBy(xpath ="//*[text()='Proceed To Checkout']" )
+ public WebElement proceedToCheckout ;
+
+ @FindBy(xpath = "(//li[@class='address_address1 address_address2'])[2]" )
+ public WebElement deliveryAddress;
+
+ @FindBy(xpath = "(//li[@class='address_address1 address_address2'])[5]" )
+ public WebElement billingAddress;
+
+ @FindBy(xpath = "(//h2)[1]")
+ public WebElement addressDetails;
+
+ @FindBy(xpath = "(//h2)[2]")
+ public WebElement reviewOrder;
+
+ @FindBy(xpath ="(//a[@href='/login'])[2]" )
+ public WebElement registerLogin;
+
+ @FindBy(name ="message")
+ public WebElement commentText;
+
+ @FindBy(xpath = "//*[@href='/payment']")
+ public WebElement placeOrder;
+
+ @FindBy(name = "name_on_card")
+ public WebElement nameOnCard;
+
+ @FindBy(name ="card_number")
+ public WebElement cardNumber;
+
+ @FindBy(xpath = "//*[@name='cvc']")
+ public WebElement cvs;
+
+ @FindBy(name ="expiry_month")
+ public WebElement expiryMonth;
+
+ @FindBy(name ="expiry_year")
+ public WebElement expiryYear;
+
+ @FindBy(id ="submit")
+ public WebElement payAndConfirmOrder;
+
+ @FindBy(xpath ="//*[contains(text(),'Your order has been')]")
+ public WebElement successMessage;
+
+ @FindBy(xpath = "//a[@href='/download_invoice/500']")
+
+ public WebElement downlandInvoiceButton;
+
+ @FindBy (xpath = "//a[@data-qa='continue-button']" )
+ public WebElement continueButton;
+
+
+ @FindBy (xpath = "//a[@class='cart_quantity_delete']" )
+ public WebElement deleteButton;
+
+ @FindBy(xpath = "//*[text()='Cart is empty!']")
+ public WebElement cartEmptyText;
+}
diff --git a/src/test/java/pages/ContactUsPage.java b/src/test/java/pages/ContactUsPage.java
new file mode 100644
index 0000000..70e7216
--- /dev/null
+++ b/src/test/java/pages/ContactUsPage.java
@@ -0,0 +1,49 @@
+package pages;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+
+public class ContactUsPage {
+ public ContactUsPage() {
+ PageFactory.initElements(Driver.getDriver(), this);
+ }
+
+ @FindBy(xpath = "(//h2)[2]")
+ public WebElement getInTouchText ;
+
+ @FindBy(name = "name")
+ public WebElement nameText;
+
+ @ FindBy(name="email")
+ public WebElement email;
+
+ @ FindBy(name="subject")
+ public WebElement subject;
+
+ @ FindBy(name="message")
+ public WebElement message;
+
+ @ FindBy(name="upload_file")
+ public WebElement uploadFile;
+
+ @ FindBy(name="submit")
+ public WebElement submit;
+
+ @ FindBy(xpath= "//*[text()='Success! Your details have been submitted successfully.']")
+ public WebElement successMessage;
+
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/pages/DeletePage.java b/src/test/java/pages/DeletePage.java
new file mode 100644
index 0000000..0d6cf10
--- /dev/null
+++ b/src/test/java/pages/DeletePage.java
@@ -0,0 +1,11 @@
+package pages;
+
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+public class DeletePage {
+ public DeletePage(){
+ PageFactory.initElements(Driver.getDriver(),this);
+ }
+
+}
diff --git a/src/test/java/pages/HomePage.java b/src/test/java/pages/HomePage.java
new file mode 100644
index 0000000..58e52bc
--- /dev/null
+++ b/src/test/java/pages/HomePage.java
@@ -0,0 +1,47 @@
+package pages;
+
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+public class HomePage {
+ public HomePage(){
+ PageFactory.initElements(Driver.getDriver(),this);
+ }
+
+ @FindBy(xpath="//a[@href='/login']")
+ public WebElement signUpLogin;
+
+ @FindBy(xpath ="//a[@href='/contact_us']")
+ public WebElement contactUsButton ;
+
+ @FindBy(xpath = "//a[@href='/test_cases']")
+ public WebElement testCasesButton;
+
+ @FindBy(xpath = "(//a)[10]")
+ public WebElement loggedUsername;
+
+ @FindBy(xpath = "(//a[@href='/view_cart'])[1]")
+ public WebElement cartButton;
+
+ @FindBy(xpath = "(//h2)[1]")
+ public WebElement assertMessage;
+
+ @FindBy(xpath = "//*[text()='Blue Top']")
+ public WebElement productBlueTop;
+
+ @FindBy(xpath ="(//a[@data-product-id='1'])[2]" )
+ public WebElement addToCartProductBlueTop;
+
+ @FindBy(xpath = "//button[@class='btn btn-success close-modal btn-block']")
+ public WebElement continueShopping;
+
+ @FindBy(xpath = "//a[@href='/delete_account']")
+ public WebElement deleteButton;
+
+ @FindBy(xpath ="//a[@href='/view_cart']")
+ public WebElement viewButton;
+
+}
diff --git a/src/test/java/pages/SignInPage.java b/src/test/java/pages/SignInPage.java
new file mode 100644
index 0000000..f0427ae
--- /dev/null
+++ b/src/test/java/pages/SignInPage.java
@@ -0,0 +1,84 @@
+package pages;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+public class SignInPage {
+ public SignInPage() {
+ PageFactory.initElements(Driver.getDriver(), this);
+ }
+
+ //Verify that 'ENTER ACCOUNT INFORMATION' is visible
+ @FindBy(xpath = "(//b)[1]")
+ public WebElement enterAccount;
+
+ // Fill details: Title, Name, Email, Password, Date of birth
+ @FindBy(id = "uniform-id_gender2")
+ public WebElement genderCheckBox;
+
+ @FindBy(id = "name")
+ public WebElement name;
+
+ @FindBy(xpath = "//*[@disabled='disabled']")
+ public WebElement email;
+
+ @FindBy(id = "password")
+ public WebElement password;
+
+ // Selecting birth day
+ @FindBy(id = "days")
+ public WebElement day;
+
+ @FindBy(id = "months")
+ public WebElement month;
+
+ @FindBy(id = "years")
+ public WebElement year;
+
+ @FindBy(id = "newsletter")
+ public WebElement newsletter;
+
+ @FindBy(id = "optin")
+ public WebElement receiveOffers;
+
+ @FindBy(id = "first_name")
+ public WebElement firstname;
+
+ @FindBy(id = "last_name")
+ public WebElement lastname;
+
+ @FindBy(id = "company")
+ public WebElement company;
+
+ @FindBy(id = "address1")
+ public WebElement address1;
+
+ @FindBy(id = "address2")
+ public WebElement address2;
+
+ @FindBy(id = "country")
+ public WebElement country;
+
+ @FindBy(id = "city")
+ public WebElement city;
+
+ @FindBy(id = "state")
+ public WebElement state;
+
+ @FindBy(id = "zipcode")
+ public WebElement zipcode;
+
+ @FindBy(id = "mobile_number")
+ public WebElement mobileNumber;
+
+ @FindBy(xpath = "//button[@data-qa='create-account']")
+ public WebElement createAccount;
+
+ @FindBy(xpath = "//b")
+ public WebElement accountCrated;
+
+ @FindBy(xpath = "//*[@data-qa='continue-button']")
+ public WebElement continue1;
+}
\ No newline at end of file
diff --git a/src/test/java/pages/SignUpLoginPage.java b/src/test/java/pages/SignUpLoginPage.java
new file mode 100644
index 0000000..964ac4e
--- /dev/null
+++ b/src/test/java/pages/SignUpLoginPage.java
@@ -0,0 +1,39 @@
+package pages;
+
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import utilities.Driver;
+
+public class SignUpLoginPage {
+ public SignUpLoginPage() {
+ PageFactory.initElements(Driver.getDriver(), this);
+ }
+
+ @FindBy(xpath = "(//h2)[3]")
+ public WebElement newUserSignUpText;
+
+ @FindBy(name = "name")
+ public WebElement signUpName;
+
+ @FindBy(xpath = "(//input[@name='email'])[2]")
+ public WebElement signUpEmail;
+
+ @FindBy(xpath = "//button[@data-qa='signup-button']")
+ public WebElement signInButton;
+
+ @FindBy(xpath = "(//input[@name= 'email'])[1]")
+ public WebElement loginEmail;
+
+ @FindBy(xpath = "//input[@name= 'password']")
+ public WebElement loginPassword;
+
+ @FindBy(xpath = "//button[text()= 'Login']")
+ public WebElement loginButton;
+
+ @FindBy(xpath = "//*[text()='Your email or password is incorrect!']")
+ public WebElement incorrectEmail;
+
+}
+
diff --git a/src/test/java/pages/TC001_page.java b/src/test/java/pages/TC001_page.java
deleted file mode 100644
index 60fb071..0000000
--- a/src/test/java/pages/TC001_page.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package pages;
-
-public class TC001_page {
-}
diff --git a/src/test/java/tests/TC001_tests.java b/src/test/java/tests/TC001_tests.java
deleted file mode 100644
index 996c45c..0000000
--- a/src/test/java/tests/TC001_tests.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package tests;
-
-public class TC001_tests {
-}
diff --git a/src/test/java/tests/TC23_UmmuhanK.java b/src/test/java/tests/TC23_UmmuhanK.java
new file mode 100644
index 0000000..d18fd01
--- /dev/null
+++ b/src/test/java/tests/TC23_UmmuhanK.java
@@ -0,0 +1,116 @@
+package tests;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.Select;
+import pages.*;
+import utilities.ConfigurationReader;
+import utilities.Driver;
+import utilities.ReusableMethods;
+
+
+public class TC23_UmmuhanK {
+ HomePage homePage;
+ SignUpLoginPage signUpLoginPage;
+ CartPage cartPage;
+ SignInPage signInPage;
+
+ @Test
+ public void test1() {
+// 1. Launch browser
+// 2. Navigate to url 'http://automationexercise.com'
+ Driver.getDriver().get(ConfigurationReader.getProperty("url"));
+
+// 3. Verify that home page is visible successfully
+ homePage = new HomePage();
+ ReusableMethods.verifyElementDisplayed(homePage.signUpLogin);
+
+// 4. Click 'Signup / Login' button
+ homePage.signUpLogin.click();
+
+// 5. Fill all details in Signup and create account
+ signUpLoginPage =new SignUpLoginPage();
+ signUpLoginPage.signUpName.sendKeys("Ali");
+ signUpLoginPage.signUpEmail.sendKeys("john80@gmail.com");
+ signUpLoginPage.signInButton.click();
+
+ signInPage =new SignInPage();
+ signInPage.genderCheckBox.click();
+
+ ReusableMethods.verifyElementDisplayed(signInPage.enterAccount);
+ signInPage.genderCheckBox.click();
+
+ signInPage.name.clear();
+ signInPage.name.sendKeys("Ali");
+ //signInPage.email.clear();
+ //signInPage.email.sendKeys("john80@gmail.com");
+ signInPage.password.sendKeys("1234");
+
+ Select daySelect = new Select(signInPage.day);
+ daySelect.selectByIndex(2);
+
+ Select monthSelect = new Select(signInPage.month);
+ daySelect.selectByIndex(3);
+
+ Select yearSelect = new Select(signInPage.year);
+ yearSelect.selectByValue("2000");
+
+ signInPage.newsletter.click();
+ signInPage.receiveOffers.click();
+
+ signInPage.firstname.sendKeys("Alp");
+ signInPage.lastname.sendKeys("Moore");
+ signInPage.company.sendKeys("Apple");
+
+ signInPage.address1.sendKeys("567 Strawberry Street");
+ String address1 = signInPage.address1.getText();
+ signInPage.address2.sendKeys("Suite 2");
+
+ Select countrySelect = new Select(signInPage.country);
+ countrySelect.selectByVisibleText("United States");
+
+ signInPage.city.sendKeys("Santa Ana");
+ signInPage.state.sendKeys("California");
+ signInPage.zipcode.sendKeys("90000");
+ signInPage.mobileNumber.sendKeys("9006782345");
+ signInPage.createAccount.click();
+
+// 6. Verify 'ACCOUNT CREATED!' and click 'Continue' button
+ ReusableMethods.verifyElementDisplayed(signInPage.accountCrated);
+ signInPage.continue1.click();
+
+// 7. Verify ' Logged in as username' at top
+ ReusableMethods.verifyElementDisplayed(homePage.loggedUsername);
+
+// 8. Add products to cart
+ ReusableMethods.doubleClick(homePage.productBlueTop);
+ homePage.productBlueTop.click();
+ ReusableMethods.waitFor(1);
+ homePage.addToCartProductBlueTop.click();
+ homePage.continueShopping.click();
+
+// 9. Click 'Cart' button
+ homePage.cartButton.click();
+
+// 10. Verify that cart page is displayed
+ cartPage = new CartPage();
+ ReusableMethods.verifyElementDisplayed(cartPage.cartPage);
+
+// 11. Click Proceed To Checkout
+ cartPage.proceedToCheckout.click();
+
+// 12. Verify that the delivery address is same address filled at the time registration of account
+ ReusableMethods.verifyElementDisplayed(cartPage.deliveryAddress);
+
+// 13. Verify that the billing address is same address filled at the time registration of account
+ ReusableMethods.verifyElementDisplayed(cartPage.billingAddress);
+
+// 14. Click 'Delete Account' button
+ homePage.deleteButton.click();
+// 15. Verify 'ACCOUNT DELETED!' and click 'Continue' button
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/tests/TC24_UmmuhanK.java b/src/test/java/tests/TC24_UmmuhanK.java
new file mode 100644
index 0000000..508f3c9
--- /dev/null
+++ b/src/test/java/tests/TC24_UmmuhanK.java
@@ -0,0 +1,166 @@
+package tests;
+
+import com.github.javafaker.Faker;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.support.ui.Select;
+
+import pages.CartPage;
+import pages.HomePage;
+import pages.SignInPage;
+import pages.SignUpLoginPage;
+import utilities.ConfigurationReader;
+import utilities.Driver;
+import utilities.ReusableMethods;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+
+public class TC24_UmmuhanK {
+ Faker faker = new Faker();
+ HomePage homePage;
+ SignUpLoginPage signUpLoginPage;
+ CartPage cartPage;
+ SignInPage signInPage;
+
+
+
+ @Test
+ public void test1() {
+// 1. Launch browser
+// 2. Navigate to url 'http://automationexercise.com'
+ Driver.getDriver().get(ConfigurationReader.getProperty("url"));
+
+// 3. Verify that home page is visible successfully
+ homePage = new HomePage();
+ ReusableMethods.verifyElementDisplayed(homePage.signUpLogin);
+
+// 4. Add products to cart
+ ReusableMethods.doubleClick(homePage.productBlueTop);
+ homePage.productBlueTop.click();
+ ReusableMethods.waitFor(1);
+ homePage.addToCartProductBlueTop.click();
+ homePage.continueShopping.click();
+
+// 5. Click 'Cart' button
+ homePage.cartButton.click();
+
+// 6. Verify that cart page is displayed
+ cartPage = new CartPage();
+ ReusableMethods.verifyElementDisplayed(cartPage.cartPage);
+
+// 7. Click Proceed To Checkout
+ cartPage.proceedToCheckout.click();
+
+// 8. Click 'Register / Login' button
+ cartPage.registerLogin.click();
+
+// 9. Fill all details in Signup and create account
+ homePage.signUpLogin.click();
+ signUpLoginPage = new SignUpLoginPage();
+ signUpLoginPage.signUpName.sendKeys("Jane");
+ signUpLoginPage.signUpEmail.sendKeys("jane_1@gmail.com");
+ signUpLoginPage.signInButton.click();
+
+// 10. Verify 'ACCOUNT CREATED!' and click 'Continue' button
+
+ signInPage =new SignInPage();
+ ReusableMethods.verifyElementDisplayed(signInPage.accountCrated);
+
+ signInPage.genderCheckBox.click();
+ signInPage.name.clear();
+ signInPage.name.sendKeys("Jane");
+// signInPage.email.clear();
+// signInPage.email.sendKeys("jane_1@gmail.com");
+ signInPage.password.sendKeys("1234");
+
+ Select daySelect = new Select(signInPage.day);
+ daySelect.selectByIndex(2);
+
+ Select monthSelect = new Select(signInPage.month);
+ daySelect.selectByIndex(3);
+
+ Select yearSelect = new Select(signInPage.year);
+ yearSelect.selectByValue("2000");
+
+ signInPage.newsletter.click();
+ signInPage.receiveOffers.click();
+
+ signInPage.firstname.sendKeys("Jane");
+ signInPage.lastname.sendKeys("Moore");
+ signInPage.company.sendKeys("Apple");
+
+ signInPage.address1.sendKeys("567 Strawberry Street");
+ String address1 = signInPage.address1.getText();
+ signInPage.address2.sendKeys("Suite 2");
+
+ Select countrySelect = new Select(signInPage.country);
+ countrySelect.selectByVisibleText("United States");
+
+ signInPage.city.sendKeys("Santa Ana");
+ signInPage.state.sendKeys("California");
+ signInPage.zipcode.sendKeys("90000");
+ signInPage.mobileNumber.sendKeys("9006782345");
+ signInPage.createAccount.click();
+ signInPage.continue1.click();
+
+// 11. Verify ' Logged in as username' at top
+ String loggedUsername =homePage.loggedUsername.getText();
+ Assert.assertEquals("Logged in as Jane", loggedUsername);
+
+// 12.Click 'Cart' button
+ homePage.cartButton.click();
+
+// 13. Click 'Proceed To Checkout' button
+ cartPage.proceedToCheckout.click();
+
+// 14. Verify Address Details and Review Your Order
+ ReusableMethods.verifyElementDisplayed(cartPage.addressDetails);
+ ReusableMethods.verifyElementDisplayed(cartPage.reviewOrder);
+
+// 15. Enter description in comment text area and click 'Place Order'
+ cartPage.commentText.sendKeys("hello");
+ cartPage.placeOrder.click();
+
+// 16. Enter payment details: Name on Card, Card Number, CVC, Expiration date
+ cartPage.nameOnCard.sendKeys("John Doe");
+ cartPage.cardNumber.sendKeys(faker.finance().creditCard());
+ cartPage.cvs.sendKeys("234");
+ cartPage.expiryMonth.sendKeys("06");
+ cartPage.expiryYear.sendKeys("2035");
+
+// 17. Click 'Pay and Confirm Order' button
+ cartPage.payAndConfirmOrder.click();
+
+// 18. Verify success message 'Your order has been placed successfully!'
+ ReusableMethods.verifyElementDisplayed(cartPage.successMessage);
+
+// 19. Click 'Download Invoice' button and verify invoice is downloaded successfully.
+ cartPage.downlandInvoiceButton.click();
+ String homeDirectory = System.getProperty("user.home");
+ String pathOfImage = homeDirectory +"/Downloads/invoice.txt";
+ boolean isExist = Files.exists(Paths.get(pathOfImage)) ;
+ Assert.assertTrue(isExist);
+
+//20. Click 'Continue' button
+ cartPage.continueButton.click();
+
+//21. Click 'Delete Account' button
+ homePage.deleteButton.click();
+
+//22. Verify 'ACCOUNT DELETED!' and click 'Continue' button
+
+
+
+
+
+
+
+
+
+
+
+ }
+
+}
diff --git a/src/test/java/utilities/ReusableMethods.java b/src/test/java/utilities/ReusableMethods.java
index f5c0699..2cfb55a 100644
--- a/src/test/java/utilities/ReusableMethods.java
+++ b/src/test/java/utilities/ReusableMethods.java
@@ -78,11 +78,17 @@ public static void verifyElementNotDisplayed(By by) {
}
-
public static void clickWithJS(WebElement element) {
((JavascriptExecutor) Driver.getDriver()).executeScript("arguments[0].scrollIntoView(true);", element);
((JavascriptExecutor) Driver.getDriver()).executeScript("arguments[0].click();", element);
}
+
+
+ public static void clickElementByJS(WebElement element) {
+ JavascriptExecutor jsexecutor = ((JavascriptExecutor) Driver.getDriver());
+ jsexecutor.executeScript("arguments[0].click();", element);
+ }
+
public static void scrollToElement(WebElement element) {
((JavascriptExecutor) Driver.getDriver()).executeScript("arguments[0].scrollIntoView(true);", element);
}
@@ -91,8 +97,6 @@ public static void doubleClick(WebElement element) {
}
-
-
public static void waitFor(int seconds) {
try {
Thread.sleep(seconds * 1000);