-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
13 changed files
with
242 additions
and
18 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
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,17 @@ | ||
package automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class AddressPage extends BasePage { | ||
public AddressPage(){ | ||
PageFactory.initElements(driver,this); | ||
} | ||
@FindBy(xpath = "//*[@id='center_column']/form/p/button") | ||
WebElement proceedToCheckout; | ||
public void setProceedToCheckout(){ | ||
proceedToCheckout.click(); | ||
} | ||
|
||
} |
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,33 @@ | ||
package automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class AuthenticationPage extends BasePage { | ||
public AuthenticationPage(){ | ||
PageFactory.initElements(driver,this); | ||
} | ||
@FindBy(xpath = "//*[@id='center_column']/h1") | ||
WebElement authenticationPageHeader; | ||
@FindBy(id="email") | ||
WebElement email_AlreadyRegistered; | ||
@FindBy(id = "passwd") | ||
WebElement password_AlreadyRegistered; | ||
@FindBy(id="SubmitLogin") | ||
WebElement submitLogin; | ||
public boolean isUserOnAuthenticationPage(){ | ||
return Utils.isElementPresent(authenticationPageHeader); | ||
} | ||
public void setEmail_AlreadyRegistered(String emailAlreadyExisting){ | ||
email_AlreadyRegistered.sendKeys(emailAlreadyExisting); | ||
|
||
} | ||
public void setPassword_AlreadyRegistered(String passwordAlreadyExisting){ | ||
password_AlreadyRegistered.sendKeys(passwordAlreadyExisting); | ||
} | ||
public void setSubmitLogin(){ | ||
submitLogin.click(); | ||
} | ||
|
||
} |
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
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
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 automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class PaymentMethodPage extends BasePage { | ||
public PaymentMethodPage(){PageFactory.initElements(driver,this);} | ||
@FindBy(xpath = "//*[@id='center_column']/h1") | ||
WebElement paymentMethodHeader; | ||
public boolean isUserOnPaymentMethodPage(){ | ||
return Utils.isElementPresent(paymentMethodHeader); | ||
} | ||
} |
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 automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class ProceedToCheckOutPage extends BasePage { | ||
public ProceedToCheckOutPage(){ | ||
PageFactory.initElements(driver,this); | ||
} | ||
@FindBy(linkText = "Proceed to checkout") | ||
WebElement proceedToCheckout; | ||
public void setProceedToCheckout(){ | ||
proceedToCheckout.click(); | ||
} | ||
public void waitForProceedToCheckoutElement(){ | ||
Utils.waitForElementVisible(proceedToCheckout,3000); | ||
} | ||
|
||
} |
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,16 @@ | ||
package automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class ReusableFunctions extends BasePage { | ||
public ReusableFunctions(){ | ||
PageFactory.initElements(driver,this);} | ||
@FindBy(id = "selectProductSort") | ||
WebElement selectProductSort; | ||
public void setSelectProductSort(String text){ | ||
Utils.selectFromList(selectProductSort,text); | ||
} | ||
|
||
} |
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 automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class ShippingPage extends BasePage { | ||
public ShippingPage(){ | ||
PageFactory.initElements(driver,this); | ||
} | ||
@FindBy(id="cgv") | ||
WebElement shippingPageCheckbox; | ||
@FindBy(xpath = "//*[@id='form']/p/button") | ||
WebElement proceedToCheckout; | ||
public void setShippingPageCheckbox(){ shippingPageCheckbox.click();} | ||
public void setProceedToCheckout(){ | ||
proceedToCheckout.click(); | ||
} | ||
|
||
} |
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,24 @@ | ||
package automation.pages; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class SummaryPage extends BasePage { | ||
public SummaryPage(){ | ||
PageFactory.initElements(driver,this); | ||
} | ||
@FindBy(xpath = "//*[@id='cart_title']") | ||
WebElement summaryPageHeader; | ||
@FindBy(linkText = "Proceed to checkout") | ||
WebElement proceedToCheckout; | ||
public void setProceedToCheckout(){ | ||
proceedToCheckout.click(); | ||
} | ||
public boolean isUserOnSummaryPage(){ | ||
return Utils.isElementPresent(summaryPageHeader); | ||
} | ||
public void waitForProceedToCheckOutInSummaryPage(){ | ||
Utils.waitForElementVisible(proceedToCheckout,3000); | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,20 +1,32 @@ | ||
package automation; | ||
|
||
import automation.pages.ContactUsPage; | ||
import automation.pages.HomePage; | ||
import automation.pages.SigninPage; | ||
import automation.pages.*; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
|
||
|
||
public class HomePageTests extends BaseTests { | ||
|
||
//Test Data | ||
String sortByData="Price: Lowest first"; | ||
int timetowait=3000; | ||
String emailExisting="[email protected]"; | ||
String passwordExisting="secret123"; | ||
//Creating objects | ||
HomePage homePage=new HomePage(); | ||
ProceedToCheckOutPage proceedToCheckOutPage=new ProceedToCheckOutPage(); | ||
SummaryPage summaryPage=new SummaryPage(); | ||
AuthenticationPage authenticationPage=new AuthenticationPage(); | ||
AddressPage addressPage=new AddressPage(); | ||
ShippingPage shippingPage=new ShippingPage(); | ||
PaymentMethodPage paymentMethodPage=new PaymentMethodPage(); | ||
@Test | ||
public void verifyContactUs() { | ||
ContactUsPage contactus=PageFactory.initElements(driver,ContactUsPage.class); | ||
HomePage homepage=PageFactory.initElements(driver,HomePage.class); | ||
homepage.contactUsLinkPresence(); | ||
|
||
} | ||
|
||
@Test | ||
|
@@ -28,9 +40,32 @@ public void verifySignIn() throws Exception { | |
homepage.listveiw(); | ||
homepage.sortby("Price: Lowest first"); | ||
homepage.addToCompare(); | ||
} | ||
|
||
|
||
} | ||
|
||
@Test | ||
public void verifyUserCanAddAnItemSuccessfully(){ | ||
homePage.waitForItem(); | ||
homePage.setProduct1(); | ||
homePage.setAddToCartProduct1(); | ||
proceedToCheckOutPage.waitForProceedToCheckoutElement(); | ||
proceedToCheckOutPage.setProceedToCheckout(); | ||
System.out.println(summaryPage.isUserOnSummaryPage()); | ||
Assert.assertTrue(summaryPage.isUserOnSummaryPage()); | ||
summaryPage.waitForProceedToCheckOutInSummaryPage(); | ||
summaryPage.setProceedToCheckout(); | ||
Assert.assertTrue(authenticationPage.isUserOnAuthenticationPage()); | ||
authenticationPage.setEmail_AlreadyRegistered(emailExisting); | ||
authenticationPage.setPassword_AlreadyRegistered(passwordExisting); | ||
authenticationPage.setSubmitLogin(); | ||
Utils.implicitlyWait(timetowait); | ||
addressPage.setProceedToCheckout(); | ||
Utils.implicitlyWait(timetowait); | ||
shippingPage.setShippingPageCheckbox(); | ||
shippingPage.setProceedToCheckout(); | ||
Assert.assertTrue(paymentMethodPage.isUserOnPaymentMethodPage()); | ||
|
||
} | ||
|
||
} | ||
|
||
|
6d14635
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍