diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/CustomCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/CustomCard.java new file mode 100644 index 000000000..3f3cf7b6b --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/CustomCard.java @@ -0,0 +1,28 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.android; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class CustomCard extends AbstractCustomCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement featureTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(xpath = ".//div[@class='card__content-top']//div//p") + private ExtendedWebElement featureDescription; + + public CustomCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + featureDescription.getText(); + featureTitle.getText(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Footer.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Footer.java new file mode 100644 index 000000000..f1a64db91 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Footer.java @@ -0,0 +1,64 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.android; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractFooter; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.FooterItem; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; +import com.zebrunner.carina.webdriver.locator.Context; + +public class Footer extends AbstractFooter implements IMobileUtils { + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//div[@class='copyright']/p") + private ExtendedWebElement copyright; + + @FindBy(xpath = ".//div[@class='mobile-select-country']") + private ExtendedWebElement countryRow; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "p") + @Context(dependsOn = "countryRow") + private ExtendedWebElement mobileLocation; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "a") + @Context(dependsOn = "countryRow") + private ExtendedWebElement locationCountry; + + @FindBy(xpath = ".//div[@class='mobile-newsletter']") + private ExtendedWebElement emailRaw; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "emailRaw") + @FindBy(tagName= "p") + private ExtendedWebElement mobileEmailTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "emailRaw") + @FindBy(tagName = "a") + private ExtendedWebElement signUpButton; + + public Footer(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + @Override + public void interactWithLocalizedElements() { + swipe(copyright); + copyright.hover(); + mobileLocation.hover(); + locationCountry.hover(); + mobileEmailTitle.hover(); + signUpButton.hover(); + } + + public List getFooterItems() { + throw new RuntimeException("There is no footer items for android"); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Header.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Header.java new file mode 100644 index 000000000..3c24dd870 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/Header.java @@ -0,0 +1,46 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.android; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractHeader; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class Header extends AbstractHeader implements IMobileUtils { + + @FindBy(xpath = ".//button[@aria-controls='secondary-nav-sm']") + private ExtendedWebElement navMenuButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//nav[@id='secondary-nav-sm']//li[@role='presentation']/a[not(@target='_blank')]") + private List mobileHeaderTitles; + + @FindBy(xpath = ".//nav[@id='secondary-nav-sm']//a[@class='has-subNavItems']") + private ExtendedWebElement expandAllNavButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(className = "show-mobile") + private ExtendedWebElement promoText; + + public Header(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + @Override + public void interactWithLocalizedElements() { + promoText.hover(); + navMenuButton.click(); + expandAllNavButton.click(); + for (ExtendedWebElement title: mobileHeaderTitles) { + swipe(title); + title.hover(); + } + navMenuButton.click(); + } + +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/LargeCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/LargeCard.java new file mode 100644 index 000000000..f78af9180 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/LargeCard.java @@ -0,0 +1,27 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.android; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class LargeCard extends AbstractLargeCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement popularCardTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(className = "pc-originalprice") + private ExtendedWebElement popularCardPrice; + public LargeCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + popularCardTitle.getText(); + popularCardPrice.getText(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/RegistrationError.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/RegistrationError.java new file mode 100644 index 000000000..53073f23a --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/android/RegistrationError.java @@ -0,0 +1,43 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.android; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractRegistrationError; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class RegistrationError extends AbstractRegistrationError implements IMobileUtils { + @FindBy(xpath = ".//button[@class='modal-close']") + private ExtendedWebElement closeButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//h2//div") + private ExtendedWebElement errorTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//p[contains(@class,'serial-number-error')]") + private ExtendedWebElement serNumberError; + + public RegistrationError(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public String getErrorTitle() { + waitUntil(ExpectedConditions.visibilityOf(errorTitle.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + return errorTitle.getText(); + } + + public String getSerNumberError() { + return serNumberError.getText(); + } + + public void closeModal() { + tap(closeButton); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractCustomCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractCustomCard.java new file mode 100644 index 000000000..b9090e51b --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractCustomCard.java @@ -0,0 +1,14 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractCustomCard extends AbstractUIObject { + public AbstractCustomCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public abstract void interactWithElements(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooter.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooter.java new file mode 100644 index 000000000..52b08ba47 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooter.java @@ -0,0 +1,18 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractFooter extends AbstractUIObject { + public AbstractFooter(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public abstract void interactWithLocalizedElements(); + + public abstract List getFooterItems(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooterItem.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooterItem.java new file mode 100644 index 000000000..89296d9b7 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractFooterItem.java @@ -0,0 +1,15 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractFooterItem extends AbstractUIObject { + + public AbstractFooterItem(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public abstract void hoverElements(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractHeader.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractHeader.java new file mode 100644 index 000000000..e6f73181f --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractHeader.java @@ -0,0 +1,15 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractHeader extends AbstractUIObject { + + public AbstractHeader(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public abstract void interactWithLocalizedElements(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractLargeCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractLargeCard.java new file mode 100644 index 000000000..da1bde261 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractLargeCard.java @@ -0,0 +1,13 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractLargeCard extends AbstractUIObject { + public AbstractLargeCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + public abstract void interactWithElements(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractRegistrationError.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractRegistrationError.java new file mode 100644 index 000000000..57f6d5650 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/common/AbstractRegistrationError.java @@ -0,0 +1,19 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.common; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; + +import com.zebrunner.carina.webdriver.gui.AbstractUIObject; + +public abstract class AbstractRegistrationError extends AbstractUIObject { + + public AbstractRegistrationError(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public abstract String getErrorTitle(); + + public abstract String getSerNumberError(); + + public abstract void closeModal(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/CustomCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/CustomCard.java new file mode 100644 index 000000000..9d68fe7df --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/CustomCard.java @@ -0,0 +1,28 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class CustomCard extends AbstractCustomCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement featureTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(xpath = ".//div[@class='card__content-top']//div//p") + private ExtendedWebElement featureDescription; + + public CustomCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + featureDescription.hover(); + featureTitle.hover(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Footer.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Footer.java new file mode 100644 index 000000000..d0588e946 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Footer.java @@ -0,0 +1,66 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractFooter; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class Footer extends AbstractFooter { + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//div[@class='copyright']/p") + private ExtendedWebElement copyright; + + @FindBy(xpath = ".//div[@class='linksList parbase section']") + private List footerItemList; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(id = "footerBeatsArmy") + private ExtendedWebElement mediaTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE, localeName = "desktopLocationTitle") + @FindBy(className = "footerDirectoryTitle") + private ExtendedWebElement locationTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//span[contains(@class,'country')]") + private ExtendedWebElement locationCountry; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(className = "change-location") + private ExtendedWebElement changeLocationButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//h2[not(@*)]") + private ExtendedWebElement emailTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//li[@class='newsletter-cta']") + private ExtendedWebElement signUpButton; + + public Footer(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithLocalizedElements() { + copyright.scrollTo(); + waitUntil(ExpectedConditions.visibilityOf(copyright.getElement()), 5); + copyright.hover(); + mediaTitle.hover(); + locationTitle.hover(); + locationCountry.hover(); + changeLocationButton.hover(); + emailTitle.hover(); + signUpButton.hover(); + footerItemList.forEach(FooterItem::hoverElements); + } + + public List getFooterItems() { + return footerItemList; + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/FooterItem.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/FooterItem.java new file mode 100644 index 000000000..d2910f267 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/FooterItem.java @@ -0,0 +1,30 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractFooterItem; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class FooterItem extends AbstractFooterItem { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement itemTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH, localeName = "desktopRef") + @FindBy(xpath = ".//nav//li") + private List subTitles; + + public FooterItem(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void hoverElements() { + itemTitle.hover(); + subTitles.forEach(ExtendedWebElement::hover); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Header.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Header.java new file mode 100644 index 000000000..dc78f8e57 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/Header.java @@ -0,0 +1,35 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractHeader; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class Header extends AbstractHeader { + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//div[@class='header-container']//li[@role='presentation']/a") + private List headerTitles; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(className = "show-desktop") + private ExtendedWebElement promoText; + + public Header(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + @Override + public void interactWithLocalizedElements() { + waitUntil(ExpectedConditions.visibilityOf(promoText.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + promoText.hover(); + headerTitles.forEach(ExtendedWebElement::hover); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/LargeCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/LargeCard.java new file mode 100644 index 000000000..1591b12a3 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/LargeCard.java @@ -0,0 +1,27 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class LargeCard extends AbstractLargeCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement popularCardTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(className = "pc-originalprice") + private ExtendedWebElement popularCardPrice; + public LargeCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + popularCardTitle.hover(); + popularCardPrice.hover(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/RegistrationError.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/RegistrationError.java new file mode 100644 index 000000000..1d27b4f79 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/desktop/RegistrationError.java @@ -0,0 +1,42 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.desktop; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractRegistrationError; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class RegistrationError extends AbstractRegistrationError { + @FindBy(xpath = ".//button[@class='modal-close']") + private ExtendedWebElement closeButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//h2//div") + private ExtendedWebElement errorTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//p[contains(@class,'serial-number-error')]") + private ExtendedWebElement serNumberError; + + public RegistrationError(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public String getErrorTitle() { + waitUntil(ExpectedConditions.visibilityOf(errorTitle.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + return errorTitle.getText(); + } + + public String getSerNumberError() { + return serNumberError.getText(); + } + + public void closeModal() { + closeButton.click(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/CustomCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/CustomCard.java new file mode 100644 index 000000000..62dbb95fc --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/CustomCard.java @@ -0,0 +1,28 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.ios; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class CustomCard extends AbstractCustomCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement featureTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(xpath = ".//div[@class='card__content-top']//div//p") + private ExtendedWebElement featureDescription; + + public CustomCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + featureDescription.getText(); + featureTitle.getText(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Footer.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Footer.java new file mode 100644 index 000000000..75c4b7123 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Footer.java @@ -0,0 +1,65 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.ios; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractFooter; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.FooterItem; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; +import com.zebrunner.carina.webdriver.locator.Context; + +public class Footer extends AbstractFooter implements IMobileUtils { + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//div[@class='copyright']/p") + private ExtendedWebElement copyright; + + @FindBy(xpath = ".//div[@class='mobile-select-country']") + private ExtendedWebElement countryRow; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "p") + @Context(dependsOn = "countryRow") + private ExtendedWebElement mobileLocation; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "a") + @Context(dependsOn = "countryRow") + private ExtendedWebElement locationCountry; + + @FindBy(xpath = ".//div[@class='mobile-newsletter']") + private ExtendedWebElement emailRaw; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "emailRaw") + @FindBy(tagName= "p") + private ExtendedWebElement mobileEmailTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "emailRaw") + @FindBy(tagName = "a") + private ExtendedWebElement signUpButton; + + public Footer(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + @Override + public void interactWithLocalizedElements() { + copyright.scrollTo(); + copyright.getText(); + mobileLocation.getText(); + locationCountry.getText(); + mobileEmailTitle.hover(); + signUpButton.getText(); + } + + public List getFooterItems() { + throw new RuntimeException("There is no footer items for ios"); + } + +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Header.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Header.java new file mode 100644 index 000000000..f490cc84b --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/Header.java @@ -0,0 +1,46 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.ios; + +import java.util.List; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractHeader; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class Header extends AbstractHeader implements IMobileUtils { + + @FindBy(xpath = ".//button[@aria-controls='secondary-nav-sm']") + private ExtendedWebElement navMenuButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//nav[@id='secondary-nav-sm']//li[@role='presentation']/a[not(@target='_blank')]") + private List mobileHeaderTitles; + + @FindBy(xpath = ".//nav[@id='secondary-nav-sm']//a[@class='has-subNavItems']") + private ExtendedWebElement expandAllNavButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(className = "show-mobile") + private ExtendedWebElement promoText; + + public Header(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + @Override + public void interactWithLocalizedElements() { + promoText.getText(); + navMenuButton.click(); + expandAllNavButton.click(); + for (ExtendedWebElement title: mobileHeaderTitles) { + swipe(title); + title.getText(); + } + navMenuButton.click(); + } + +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/LargeCard.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/LargeCard.java new file mode 100644 index 000000000..75c60938c --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/LargeCard.java @@ -0,0 +1,27 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.ios; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class LargeCard extends AbstractLargeCard { + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(tagName = "h2") + private ExtendedWebElement popularCardTitle; + + @Localized(focus = Localized.NameFocus.FULL_PATH) + @FindBy(className = "pc-originalprice") + private ExtendedWebElement popularCardPrice; + public LargeCard(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public void interactWithElements() { + popularCardTitle.getText(); + popularCardPrice.getText(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/RegistrationError.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/RegistrationError.java new file mode 100644 index 000000000..f8941854c --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/component/ios/RegistrationError.java @@ -0,0 +1,43 @@ +package com.qaprosoft.carina.demo.beatsbydre.component.ios; + +import org.openqa.selenium.SearchContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractRegistrationError; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; + +public class RegistrationError extends AbstractRegistrationError implements IMobileUtils { + @FindBy(xpath = ".//button[@class='modal-close']") + private ExtendedWebElement closeButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//h2//div") + private ExtendedWebElement errorTitle; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = ".//p[contains(@class,'serial-number-error')]") + private ExtendedWebElement serNumberError; + + public RegistrationError(WebDriver driver, SearchContext searchContext) { + super(driver, searchContext); + } + + public String getErrorTitle() { + waitUntil(ExpectedConditions.visibilityOf(errorTitle.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + return errorTitle.getText(); + } + + public String getSerNumberError() { + return serNumberError.getText(); + } + + public void closeModal() { + tap(closeButton); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/HomePage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/HomePage.java new file mode 100644 index 000000000..a0cac0def --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/HomePage.java @@ -0,0 +1,102 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.android; + +import java.util.List; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.android.CustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.android.Footer; +import com.qaprosoft.carina.demo.beatsbydre.component.android.Header; +import com.qaprosoft.carina.demo.beatsbydre.component.android.LargeCard; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.HomePageBase; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.utils.resources.L10N; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = HomePageBase.class) +public class HomePage extends HomePageBase implements IMobileUtils { + + @FindBy(className = "pdp-header-section") + private Header header; + + @FindBy(id = "footercontent") + private Footer footer; + + @FindBy(xpath = "//div[@class='newsletter__section section--collapsed ']//a") + private ExtendedWebElement newsSubCloseButton; + + @FindBy(xpath = "//a[contains(@class,'card--large')]") + private List popularCardList; + + @FindBy(xpath = "//a[contains(@class,'card--custom')]") + private List featureCardList; + + @FindBy(xpath = "//div[@class='bbd-1X-image-text-block']") + private ExtendedWebElement registerBeatsContext; + + @Context(dependsOn = "registerBeatsContext") + @FindBy(xpath = ".//div[@class='beats-button']//span[@tabindex]") + private ExtendedWebElement headphonesRegisterButton; + + @FindBy(xpath = "//button[@class='cookie-btn--accept beats-btn beats-btn--button']") + private ExtendedWebElement acceptCookieButton; + + public HomePage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_URL); + } + + @Override + public Header getHeader() { + return header; + } + + @Override + public Footer getFooter() { + return footer; + } + + public void interactWithHeadphoneRegBtn() { + headphonesRegisterButton.hover(); + swipe(headphonesRegisterButton); + waitUntil(ExpectedConditions.visibilityOf(headphonesRegisterButton.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + L10N.verify(headphonesRegisterButton); + } + + public RegisterBeatsPageBase toRegisterBeatsPage() { + headphonesRegisterButton.hover(); + swipe(headphonesRegisterButton); + waitUntil(ExpectedConditions.visibilityOf(headphonesRegisterButton.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + L10N.verify(headphonesRegisterButton); + headphonesRegisterButton.click(); + return initPage(driver, RegisterBeatsPageBase.class); + } + + @Override + public List getPopularCardsList() { + return popularCardList; + } + + @Override + public List getFeatureCardList() { + return featureCardList; + } + + @Override + public void open() { + super.open(); + acceptCookieButton.clickIfPresent(5); + newsSubCloseButton.clickIfPresent(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/RegisterBeatsPage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/RegisterBeatsPage.java new file mode 100644 index 000000000..edfd6b8fb --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/android/RegisterBeatsPage.java @@ -0,0 +1,97 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.android; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.android.RegistrationError; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = RegisterBeatsPageBase.class) +public class RegisterBeatsPage extends RegisterBeatsPageBase { + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "h1") + private ExtendedWebElement pageTitle; + + @FindBy(id = "serialnum") + private ExtendedWebElement serNumberField; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "serNumberField") + @FindBy(xpath = ".//following-sibling::a") + private ExtendedWebElement howToFindSerNumberLink; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//button[@class='beats-btn beats-btn--button validate-serial-num']") + private ExtendedWebElement verifySerNumberButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-length registration-invalid-input-field')]") + private ExtendedWebElement lengthErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-chars registration-invalid-input-field')]") + private ExtendedWebElement invalidCharsErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-empty-input registration-invalid-input-field')]") + private ExtendedWebElement emptyInputErrMsg; + + @FindBy(xpath = "//div[@class='modal-inner' and @role='dialog']") + private RegistrationError registrationError; + + public RegisterBeatsPage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT); + setUiLoadedMarker(pageTitle); + } + + public String getPageTitle() { + return pageTitle.getText(); + } + + public void typeSerNumberField(String input) { + serNumberField.type(input); + } + + public String getHowToFindSerNumberLink() { + return howToFindSerNumberLink.getText(); + } + + public void verifySerNumber() { + verifySerNumberButton.click(); + } + + public String getLengthErrMsg() { + if (lengthErrMsg.isVisible()) { + return lengthErrMsg.getText(); + } else { + return ""; + } + } + + public String getInvalidCharsErrMsg() { + if (invalidCharsErrMsg.isVisible()) { + return invalidCharsErrMsg.getText(); + } else { + return ""; + } + } + + public String getEmptyInputErrMsg() { + if (emptyInputErrMsg.isVisible()) { + return emptyInputErrMsg.getText(); + } else { + return ""; + } + } + + public RegistrationError getRegistrationError() { + return registrationError; + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/HomePageBase.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/HomePageBase.java new file mode 100644 index 000000000..55dd37bf6 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/HomePageBase.java @@ -0,0 +1,29 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.common; + +import java.util.List; + +import org.openqa.selenium.WebDriver; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractFooter; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractHeader; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.zebrunner.carina.webdriver.gui.AbstractPage; + +public abstract class HomePageBase extends AbstractPage { + public HomePageBase(WebDriver driver) { + super(driver); + } + + public abstract AbstractHeader getHeader(); + + public abstract AbstractFooter getFooter(); + + public abstract void interactWithHeadphoneRegBtn(); + + public abstract RegisterBeatsPageBase toRegisterBeatsPage(); + + public abstract List getPopularCardsList(); + + public abstract List getFeatureCardList(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/RegisterBeatsPageBase.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/RegisterBeatsPageBase.java new file mode 100644 index 000000000..afd0fc270 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/common/RegisterBeatsPageBase.java @@ -0,0 +1,29 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.common; + +import org.openqa.selenium.WebDriver; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractRegistrationError; +import com.zebrunner.carina.webdriver.gui.AbstractPage; + +public abstract class RegisterBeatsPageBase extends AbstractPage { + + public RegisterBeatsPageBase(WebDriver driver) { + super(driver); + } + + public abstract String getPageTitle(); + + public abstract void typeSerNumberField(String input); + + public abstract String getHowToFindSerNumberLink(); + + public abstract void verifySerNumber(); + + public abstract String getLengthErrMsg(); + + public abstract String getInvalidCharsErrMsg(); + + public abstract String getEmptyInputErrMsg(); + + public abstract AbstractRegistrationError getRegistrationError(); +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/HomePage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/HomePage.java new file mode 100644 index 000000000..8797c7b9a --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/HomePage.java @@ -0,0 +1,103 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.desktop; + +import java.util.List; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.ExpectedConditions; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.CustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.Footer; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.Header; +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.LargeCard; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.HomePageBase; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.utils.resources.L10N; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.DESKTOP, parentClass = HomePageBase.class) +public class HomePage extends HomePageBase { + + @FindBy(className = "pdp-header-section") + private Header header; + + @FindBy(id = "footercontent") + private Footer footer; + + @FindBy(xpath = "//div[@class='newsletter__section section--collapsed ']//a") + private ExtendedWebElement newsSubCloseButton; + + @FindBy(xpath = "//a[contains(@class,'card--large')]") + private List popularCardList; + + @FindBy(xpath = "//a[contains(@class,'card--custom')]") + private List featureCardList; + + @FindBy(xpath = "//div[@class='bbd-1X-image-text-block']") + private ExtendedWebElement registerBeatsContext; + + @Context(dependsOn = "registerBeatsContext") + @FindBy(xpath = ".//div[@class='beats-button']//span[@tabindex]") + private ExtendedWebElement headphonesRegisterButton; + + @FindBy(xpath = "//div[@id='cookie-bar']//button") + private ExtendedWebElement cookieAcceptButton; + + + public HomePage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_URL); + } + + @Override + public Header getHeader() { + return header; + } + + @Override + public Footer getFooter() { + footer.getRootExtendedElement().scrollTo(); + newsSubCloseButton.clickIfPresent(); + return footer; + } + + @Override + public void interactWithHeadphoneRegBtn() { + headphonesRegisterButton.scrollTo(); + waitUntil(ExpectedConditions.visibilityOf(headphonesRegisterButton.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + L10N.verify(headphonesRegisterButton); + } + + + public RegisterBeatsPageBase toRegisterBeatsPage() { + headphonesRegisterButton.scrollTo(); + headphonesRegisterButton.scrollTo(); + waitUntil(ExpectedConditions.visibilityOf(headphonesRegisterButton.getElement()), + Configuration.getLong(Configuration.Parameter.EXPLICIT_TIMEOUT)); + L10N.verify(headphonesRegisterButton); + headphonesRegisterButton.click(); + return initPage(driver, RegisterBeatsPageBase.class); + } + + @Override + public List getPopularCardsList() { + return popularCardList; + } + + public List getFeatureCardList() { + return featureCardList; + } + + @Override + public void open() { + super.open(); + cookieAcceptButton.clickIfPresent(4); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/RegisterBeatsPage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/RegisterBeatsPage.java new file mode 100644 index 000000000..54f14ebc4 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/desktop/RegisterBeatsPage.java @@ -0,0 +1,97 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.desktop; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.desktop.RegistrationError; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.DESKTOP, parentClass = RegisterBeatsPageBase.class) +public class RegisterBeatsPage extends RegisterBeatsPageBase { + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "h1") + private ExtendedWebElement pageTitle; + + @FindBy(id = "serialnum") + private ExtendedWebElement serNumberField; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "serNumberField") + @FindBy(xpath = ".//following-sibling::a") + private ExtendedWebElement howToFindSerNumberLink; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//button[@class='beats-btn beats-btn--button validate-serial-num']") + private ExtendedWebElement verifySerNumberButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-length registration-invalid-input-field')]") + private ExtendedWebElement lengthErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-chars registration-invalid-input-field')]") + private ExtendedWebElement invalidCharsErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-empty-input registration-invalid-input-field')]") + private ExtendedWebElement emptyInputErrMsg; + + @FindBy(xpath = "//div[@class='modal-inner' and @role='dialog']") + private RegistrationError registrationError; + + public RegisterBeatsPage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT); + setUiLoadedMarker(pageTitle); + } + + public String getPageTitle() { + return pageTitle.getText(); + } + + public void typeSerNumberField(String input) { + serNumberField.type(input); + } + + public String getHowToFindSerNumberLink() { + return howToFindSerNumberLink.getText(); + } + + public void verifySerNumber() { + verifySerNumberButton.click(); + } + + public String getLengthErrMsg() { + if (lengthErrMsg.isVisible()) { + return lengthErrMsg.getText(); + } else { + return ""; + } + } + + public String getInvalidCharsErrMsg() { + if (invalidCharsErrMsg.isVisible()) { + return invalidCharsErrMsg.getText(); + } else { + return ""; + } + } + + public String getEmptyInputErrMsg() { + if (emptyInputErrMsg.isVisible()) { + return emptyInputErrMsg.getText(); + } else { + return ""; + } + } + + public RegistrationError getRegistrationError() { + return registrationError; + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/HomePage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/HomePage.java new file mode 100644 index 000000000..3714042f3 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/HomePage.java @@ -0,0 +1,104 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.ios; + +import java.util.List; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractCustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.common.AbstractLargeCard; +import com.qaprosoft.carina.demo.beatsbydre.component.ios.CustomCard; +import com.qaprosoft.carina.demo.beatsbydre.component.ios.Footer; +import com.qaprosoft.carina.demo.beatsbydre.component.ios.Header; +import com.qaprosoft.carina.demo.beatsbydre.component.ios.LargeCard; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.HomePageBase; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.utils.mobile.IMobileUtils; +import com.zebrunner.carina.utils.resources.L10N; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.IOS_PHONE, parentClass = HomePageBase.class) +public class HomePage extends HomePageBase implements IMobileUtils { + @FindBy(className = "pdp-header-section") + private Header header; + + @FindBy(id = "footercontent") + private Footer footer; + + @FindBy(xpath = "//div[@class='newsletter__section section--collapsed ']//a") + private ExtendedWebElement newsSubCloseButton; + + @FindBy(xpath = "//a[contains(@class,'card--large')]") + private List popularCardList; + + @FindBy(xpath = "//a[contains(@class,'card--custom')]") + private List featureCardList; + + @FindBy(xpath = "//div[@class='bbd-1X-image-text-block']") + private ExtendedWebElement registerBeatsContext; + + @Context(dependsOn = "registerBeatsContext") + @FindBy(xpath = ".//div[@class='beats-button']//span[@tabindex]") + private ExtendedWebElement headphonesRegisterButton; + + @FindBy(xpath = "//button[@class='cookie-btn--accept beats-btn beats-btn--button']") + private ExtendedWebElement acceptCookieButton; + + public HomePage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_URL); + } + + @Override + public Header getHeader() { + return header; + } + + @Override + public Footer getFooter() { + return footer; + } + + public void interactWithHeadphoneRegBtn() { + while (headphonesRegisterButton.getText().isBlank()) { + swipeUp(DEFAULT_TOUCH_ACTION_DURATION); + } + L10N.verify(headphonesRegisterButton); + } + + private void interactListElements(List elementList) { + for (ExtendedWebElement element : elementList) { + element.scrollTo(); + element.getText(); + } + } + + public RegisterBeatsPageBase toRegisterBeatsPage() { + while (headphonesRegisterButton.getText().isBlank()) { + swipeUp(DEFAULT_TOUCH_ACTION_DURATION); + } + L10N.verify(headphonesRegisterButton); + headphonesRegisterButton.click(); + return initPage(driver, RegisterBeatsPageBase.class); + } + + @Override + public List getPopularCardsList() { + return popularCardList; + } + + @Override + public List getFeatureCardList() { + return featureCardList; + } + + @Override + public void open() { + super.open(); + acceptCookieButton.clickIfPresent(5); + newsSubCloseButton.clickIfPresent(); + } +} diff --git a/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/RegisterBeatsPage.java b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/RegisterBeatsPage.java new file mode 100644 index 000000000..d47f41628 --- /dev/null +++ b/src/main/java/com/qaprosoft/carina/demo/beatsbydre/gui/ios/RegisterBeatsPage.java @@ -0,0 +1,97 @@ +package com.qaprosoft.carina.demo.beatsbydre.gui.ios; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.FindBy; + +import com.qaprosoft.carina.demo.beatsbydre.component.ios.RegistrationError; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.factory.DeviceType; +import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement; +import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy; +import com.zebrunner.carina.webdriver.decorator.annotations.Localized; +import com.zebrunner.carina.webdriver.locator.Context; + +@DeviceType(pageType = DeviceType.Type.IOS_PHONE, parentClass = RegisterBeatsPageBase.class) +public class RegisterBeatsPage extends RegisterBeatsPageBase { + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(tagName = "h1") + private ExtendedWebElement pageTitle; + + @FindBy(id = "serialnum") + private ExtendedWebElement serNumberField; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @Context(dependsOn = "serNumberField") + @FindBy(xpath = ".//following-sibling::a") + private ExtendedWebElement howToFindSerNumberLink; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//button[@class='beats-btn beats-btn--button validate-serial-num']") + private ExtendedWebElement verifySerNumberButton; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-length registration-invalid-input-field')]") + private ExtendedWebElement lengthErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-invalid-chars registration-invalid-input-field')]") + private ExtendedWebElement invalidCharsErrMsg; + + @Localized(focus = Localized.NameFocus.CLASS_DECLARE) + @FindBy(xpath = "//*[contains(@class,'serial-number-empty-input registration-invalid-input-field')]") + private ExtendedWebElement emptyInputErrMsg; + + @FindBy(xpath = "//div[@class='modal-inner' and @role='dialog']") + private RegistrationError registrationError; + + public RegisterBeatsPage(WebDriver driver) { + super(driver); + setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT); + setUiLoadedMarker(pageTitle); + } + + public String getPageTitle() { + return pageTitle.getText(); + } + + public void typeSerNumberField(String input) { + serNumberField.type(input); + } + + public String getHowToFindSerNumberLink() { + return howToFindSerNumberLink.getText(); + } + + public void verifySerNumber() { + verifySerNumberButton.click(); + } + + public String getLengthErrMsg() { + if (lengthErrMsg.isVisible()) { + return lengthErrMsg.getText(); + } else { + return ""; + } + } + + public String getInvalidCharsErrMsg() { + if (invalidCharsErrMsg.isVisible()) { + return invalidCharsErrMsg.getText(); + } else { + return ""; + } + } + + public String getEmptyInputErrMsg() { + if (emptyInputErrMsg.isVisible()) { + return emptyInputErrMsg.getText(); + } else { + return ""; + } + } + + public RegistrationError getRegistrationError() { + return registrationError; + } +} diff --git a/src/main/resources/L10N/locale_de_DE.properties b/src/main/resources/L10N/locale_de_DE.properties index 72de5d996..75ac91217 100644 --- a/src/main/resources/L10N/locale_de_DE.properties +++ b/src/main/resources/L10N/locale_de_DE.properties @@ -6,3 +6,73 @@ WikipediaLocalePage.pageLinks0=Hauptseite WikipediaLocalePage.pageLinks1=Themenportale WikipediaLocalePage.contribElem=Beiträge WikipediaLocalePage.discussionElem=Diskussionsseite +HomePage.LargeCard2.popularCardTitle=Beats Flex +HomePage.CustomCard3.featureTitle=Beats Support +RegisterBeatsPage.lengthErrMsg=Die Seriennummer muss 12-stellig sein +HomePage.Footer.FooterItem2.desktopRef0=ÜBER UNS +HomePage.Footer.FooterItem3.desktopRef2=MARKEN +HomePage.Footer.FooterItem2.desktopRef1=STELLENANGEBOTE +HomePage.Footer.FooterItem3.desktopRef1=DATENSCHUTZ +HomePage.Footer.FooterItem1.desktopRef0=DOWNLOADS +HomePage.Footer.FooterItem3.desktopRef0=NUTZUNGSBEDINGUNGEN +HomePage.Footer.FooterItem2.itemTitle=Unternehmen +HomePage.Footer.FooterItem1.desktopRef2=SERVICE UND GARANTIE +HomePage.Footer.FooterItem1.desktopRef1=PRODUKTSUPPORT +Footer.locationCountry=DEUTSCHLAND +HomePage.Footer.FooterItem1.desktopRef4=BEATS AKTUALISIEREN +HomePage.Footer.FooterItem1.desktopRef3=BEATS REGISTRIEREN +HomePage.Footer.FooterItem0.desktopRef4=POWERBEATS PRO +HomePage.Footer.FooterItem0.desktopRef5=BEATS SOLO3 WIRELESS +Header.headerTitles0=ENTDECKEN +HomePage.Footer.FooterItem0.desktopRef2=BEATS STUDIO BUDS +HomePage.Footer.FooterItem0.desktopRef3=BEATS FLEX +HomePage.Footer.FooterItem0.desktopRef0=ALLE ANZEIGEN +HomePage.Footer.FooterItem0.desktopRef1=BEATS FIT PRO +Footer.signUpButton=ANMELDEN +Footer.emailTitle=Newsletter +headphonesRegisterButton=JETZT REGISTRIEREN +Header.headerTitles1=KAUFEN +Header.headerTitles2=SUPPORT +Footer.copyright=Copyright © 2023 Apple Inc. – Alle Rechte vorbehalten. +RegisterBeatsPage.howToFindSerNumberLink=So findest du die Seriennummer +HomePage.LargeCard1.popularCardPrice=229,95 € +HomePage.LargeCard0.popularCardTitle=Beats Studio Buds +HomePage.Footer.FooterItem0.desktopRef6=BEATS STUDIO3 WIRELESS +HomePage.Footer.FooterItem1.desktopRef6=SUPPORT KONTAKTIEREN +HomePage.Footer.FooterItem1.desktopRef5=AUTORISIERTE HÄNDLER +HomePage.Footer.FooterItem1.desktopRef7=INTERNATIONALE RUFNUMMERN +HomePage.Footer.FooterItem3.desktopRef3=AKTIONSBEDINGUNGEN +RegistrationError.serNumberError=Die eingegebene Seriennummer ist ungültig oder für die Registrierung unzulässig. +HomePage.CustomCard1.featureTitle=Finde deine Beats +RegisterBeatsPage.verifySerNumberButton=MEINE SERIENNUMMER PRÜFEN +HomePage.CustomCard0.featureTitle=Beats App für Android +Footer.changeLocationButton=ÄNDERN +HomePage.CustomCard2.featureTitle=Apple Music kostenlos +RegistrationError.errorTitle=OH NEIN\! +RegisterBeatsPage.invalidCharsErrMsg=Bitte nur alphanumerische Zahlen verwenden\! +HomePage.Footer.FooterItem1.itemTitle=Support +Footer.mediaTitle=Folge uns +RegisterBeatsPage.emptyInputErrMsg=Bitte die Seriennummer eingeben +HomePage.Footer.FooterItem3.itemTitle=Rechtliche Hinweise +HomePage.CustomCard0.featureDescription=Lade die Beats App herunter um zusätzliche Funktionen freizuschalten. +HomePage.LargeCard2.popularCardPrice=89,95 € +Header.promoText=Schnelle und kostenlose Lieferung +HomePage.CustomCard2.featureDescription=6 Monate Apple Music kostenlos mit ausgewählten Beats.2 +HomePage.CustomCard3.featureDescription=Hol dir Hilfe zu deinen Produkten oder verbinde dich mit einem unserer Expert\:innen. +HomePage.CustomCard1.featureDescription=Wenn deine Beats verschwunden sind, kannst du sie mit der „Wo ist?“ App wiederfinden.1 +Footer.locationTitle=Ort +HomePage.LargeCard1.popularCardTitle=Beats Solo3 Wireless +HomePage.LargeCard0.popularCardPrice=189,95 € +RegisterBeatsPage.pageTitle=Registriere deine Beats +HomePage.Footer.FooterItem0.itemTitle=Produkte +Header.mobileHeaderTitles8=Marken +Header.mobileHeaderTitles7=Rechtliche Hinweise +Footer.mobileEmailTitle=Newsletter\nANMELDEN +Header.mobileHeaderTitles4=Downloads +Header.mobileHeaderTitles3=Unternehmen +Header.mobileHeaderTitles6=Beats registrieren +Header.mobileHeaderTitles5=Über uns +Header.mobileHeaderTitles0=Entdecken +Footer.mobileLocation=Ort\nDEUTSCHLAND +Header.mobileHeaderTitles2=Support +Header.mobileHeaderTitles1=Kaufen diff --git a/src/main/resources/L10N/locale_en_US.properties b/src/main/resources/L10N/locale_en_US.properties index c4f023e21..1f02461aa 100644 --- a/src/main/resources/L10N/locale_en_US.properties +++ b/src/main/resources/L10N/locale_en_US.properties @@ -10,3 +10,80 @@ WikipediaLocalePage.pageLinks4=About Wikipedia WikipediaLocalePage.contribElem=Contributions WikipediaLocalePage.pageLinks5=Contact us WikipediaLocalePage.discussionElem=Talk +HomePage.LargeCard2.popularCardTitle=Beats Flex +HomePage.CustomCard3.featureTitle=Find Your Beats +RegisterBeatsPage.lengthErrMsg=Serial Number must be 12 Characters long +HomePage.Footer.FooterItem2.desktopRef0=ABOUT +HomePage.Footer.FooterItem3.desktopRef2=TRADEMARK +HomePage.Footer.FooterItem2.desktopRef1=PRESS +HomePage.Footer.FooterItem3.desktopRef1=PRIVACY +HomePage.Footer.FooterItem1.desktopRef0=DOWNLOADS +HomePage.Footer.FooterItem2.desktopRef2=CAREERS +HomePage.Footer.FooterItem3.desktopRef0=TERMS OF USE +HomePage.Footer.FooterItem2.itemTitle=Company +HomePage.Footer.FooterItem1.desktopRef2=SERVICE & WARRANTY +HomePage.Footer.FooterItem1.desktopRef1=PRODUCT HELP +Footer.locationCountry=UNITED STATES +HomePage.Footer.FooterItem1.desktopRef4=UPDATE YOUR BEATS +HomePage.Footer.FooterItem1.desktopRef3=REGISTER YOUR BEATS +HomePage.Footer.FooterItem0.desktopRef4=BEATS STUDIO BUDS +HomePage.Footer.FooterItem0.desktopRef5=BEATS FLEX +Header.headerTitles0=DISCOVER +HomePage.Footer.FooterItem0.desktopRef2=COLLABORATIONS +HomePage.Footer.FooterItem0.desktopRef3=BEATS FIT PRO +HomePage.Footer.FooterItem0.desktopRef0=VIEW ALL +HomePage.Footer.FooterItem0.desktopRef1=SPECIAL OFFERS +Footer.signUpButton=SIGN UP +Footer.emailTitle=Email +headphonesRegisterButton=REGISTER NOW +Header.headerTitles1=SHOP +Header.headerTitles2=SUPPORT +Footer.copyright=Copyright © 2023 Apple Inc. - All rights reserved. +RegisterBeatsPage.howToFindSerNumberLink=How to find your Serial Number +HomePage.LargeCard1.popularCardPrice=$199.95 +HomePage.LargeCard0.popularCardTitle=Beats Studio Buds +HomePage.Footer.FooterItem0.desktopRef8=BEATS STUDIO3 WIRELESS +HomePage.Footer.FooterItem0.desktopRef6=POWERBEATS PRO +HomePage.Footer.FooterItem0.desktopRef7=BEATS SOLO3 WIRELESS +HomePage.Footer.FooterItem1.desktopRef6=CONTACT SUPPORT +HomePage.Footer.FooterItem1.desktopRef5=AUTHORIZED RETAILERS +HomePage.Footer.FooterItem1.desktopRef7=INTERNATIONAL NUMBERS +HomePage.Footer.FooterItem3.desktopRef3=PROMOTION TERMS +RegistrationError.serNumberError=The serial number entered is either invalid or ineligible for registration. +HomePage.CustomCard1.featureTitle=Beats App for Android +RegisterBeatsPage.verifySerNumberButton=VERIFY MY SERIAL NUMBER +HomePage.CustomCard0.featureTitle=Collaborations +Footer.changeLocationButton=CHANGE +HomePage.CustomCard2.featureTitle=Personalize It +HomePage.CustomCard4.featureTitle=Free Apple Music +RegistrationError.errorTitle=OH NO\! +RegisterBeatsPage.invalidCharsErrMsg=Please enter Alphanumeric Characters only\! +HomePage.Footer.FooterItem1.itemTitle=Support +Footer.mediaTitle=Follow Us +RegisterBeatsPage.emptyInputErrMsg=Please enter Serial Number +HomePage.Footer.FooterItem3.itemTitle=Legal +HomePage.CustomCard0.featureDescription=Explore one-of-a-kind, limited-edition product collabs. +HomePage.LargeCard2.popularCardPrice=$69.99 +Header.promoText=Fast and free delivery +HomePage.CustomCard2.featureDescription=Free engraving for Beats Fit Pro. Only at Apple. +HomePage.CustomCard3.featureDescription=If your Beats are missing, track them down with the ‘Find My’ app.1 +HomePage.CustomCard4.featureDescription=Enjoy 6 months of Apple Music free with select Beats.2 +HomePage.CustomCard1.featureDescription=Download the Beats app to unlock additional features. +Footer.locationTitle=Location +HomePage.LargeCard0.popularCardPrice=$149.99 +HomePage.LargeCard1.popularCardTitle=Beats Solo3 Wireless +RegisterBeatsPage.pageTitle=Register Your Beats +HomePage.Footer.FooterItem0.itemTitle=Products +Header.mobileHeaderTitles8=About Us +Header.mobileHeaderTitles7=Register Your Beats +Header.mobileHeaderTitles9=Legal +Header.mobileHeaderTitles4=Special Offers +Header.mobileHeaderTitles3=Other +Header.mobileHeaderTitles6=Downloads +Header.mobileHeaderTitles5=Collaborations +Header.mobileHeaderTitles0=Discover +Header.mobileHeaderTitles2=Support +Header.mobileHeaderTitles1=Shop +Header.mobileHeaderTitles10=Trademark +Footer.mobileLocation=Location\nUNITED STATES +Footer.mobileEmailTitle=Email\nSIGN UP \ No newline at end of file diff --git a/src/main/resources/L10N/locale_es_ES.properties b/src/main/resources/L10N/locale_es_ES.properties index d8a1ec424..1202e7bfd 100644 --- a/src/main/resources/L10N/locale_es_ES.properties +++ b/src/main/resources/L10N/locale_es_ES.properties @@ -11,3 +11,73 @@ WikipediaLocalePage.pageLinks4=Páginas nuevas WikipediaLocalePage.contribElem=Contribuciones WikipediaLocalePage.pageLinks5=Página aleatoria WikipediaLocalePage.discussionElem=Discusión +HomePage.LargeCard2.popularCardTitle=Beats Flex +HomePage.CustomCard3.featureTitle=Soporte técnico de Beats +RegisterBeatsPage.lengthErrMsg=El número de serie debe tener 12 caracteres +HomePage.Footer.FooterItem2.desktopRef0=ACERCA DE +HomePage.Footer.FooterItem3.desktopRef2=MARCAS COMERCIALES +HomePage.Footer.FooterItem2.desktopRef1=TRABAJO +HomePage.Footer.FooterItem3.desktopRef1=PRIVACIDAD +HomePage.Footer.FooterItem1.desktopRef0=DESCARGAS +HomePage.Footer.FooterItem3.desktopRef0=CONDICIONES DE USO +HomePage.Footer.FooterItem2.itemTitle=Compañía +HomePage.Footer.FooterItem1.desktopRef2=SERVICIO Y GARANTÍA +HomePage.Footer.FooterItem1.desktopRef1=AYUDA DE PRODUCTO +Footer.locationCountry=ESPAÑA +HomePage.Footer.FooterItem1.desktopRef4=ACTUALIZA TUS BEATS +HomePage.Footer.FooterItem1.desktopRef3=REGISTRA TUS BEATS +HomePage.Footer.FooterItem0.desktopRef4=POWERBEATS PRO +HomePage.Footer.FooterItem0.desktopRef5=BEATS SOLO3 WIRELESS +Header.headerTitles0=DESCUBRIR +HomePage.Footer.FooterItem0.desktopRef2=BEATS STUDIO BUDS +HomePage.Footer.FooterItem0.desktopRef3=BEATS FLEX +HomePage.Footer.FooterItem0.desktopRef0=VER TODO +HomePage.Footer.FooterItem0.desktopRef1=BEATS FIT PRO +Footer.signUpButton=INSCRIBIRSE +Footer.emailTitle=Boletín +headphonesRegisterButton=REGÍSTRALOS AHORA +Header.headerTitles1=COMPRAR +Header.headerTitles2=SOPORTE +Footer.copyright=Copyright © 2023 Apple Inc. - Todos los derechos reservados. +RegisterBeatsPage.howToFindSerNumberLink=Cómo encontrar tu número de serie +HomePage.LargeCard1.popularCardPrice=229,95 € +HomePage.LargeCard0.popularCardTitle=Beats Studio Buds +HomePage.Footer.FooterItem0.desktopRef6=BEATS STUDIO3 WIRELESS +HomePage.Footer.FooterItem1.desktopRef6=CONTACTA CON SOPORTE +HomePage.Footer.FooterItem1.desktopRef5=DISTRIBUIDORES AUTORIZADOS +HomePage.Footer.FooterItem1.desktopRef7=NÚMEROS INTERNACIONALES +HomePage.Footer.FooterItem3.desktopRef3=CONDICIONES DE LA PROMOCIÓN +RegistrationError.serNumberError=El número de serie introducido no es válido o no se puede registrar. +HomePage.CustomCard1.featureTitle=Busca tus Beats +RegisterBeatsPage.verifySerNumberButton=VERIFICAR MI NÚMERO DE SERIE +HomePage.CustomCard0.featureTitle=App Beats para Android +Footer.changeLocationButton=CAMBIAR +HomePage.CustomCard2.featureTitle=Apple Music gratis +RegistrationError.errorTitle=¡VAYA\! +RegisterBeatsPage.invalidCharsErrMsg=Introduce solo caracteres alfanuméricos. +HomePage.Footer.FooterItem1.itemTitle=Soporte +Footer.mediaTitle=Síguenos +RegisterBeatsPage.emptyInputErrMsg=Introduce el número de serie +HomePage.Footer.FooterItem3.itemTitle=Avisos legales +HomePage.CustomCard0.featureDescription=Descarga la app Beats y descubre funciones adicionales. +HomePage.LargeCard2.popularCardPrice=89,95 € +Header.promoText=Envío rápido y gratuito. +HomePage.CustomCard2.featureDescription=Disfruta de 6 meses gratis de Apple Music con productos Beats seleccionados.2 +HomePage.CustomCard3.featureDescription=Resuelve todas tus dudas en un mismo lugar o habla con nuestro equipo. +HomePage.CustomCard1.featureDescription=Si has perdido tus Beats, encuéntralos con la app "Buscar".1 +Footer.locationTitle=Localización +HomePage.LargeCard1.popularCardTitle=Beats Solo3 Wireless +HomePage.LargeCard0.popularCardPrice=189,95 € +RegisterBeatsPage.pageTitle=Registra tus Beats +HomePage.Footer.FooterItem0.itemTitle=Productos +Header.mobileHeaderTitles8=Marca comercial +Header.mobileHeaderTitles7=Avisos legales +Footer.mobileEmailTitle=Boletín\nINSCRIBIRSE +Header.mobileHeaderTitles4=Descargas +Header.mobileHeaderTitles3=Compañía +Header.mobileHeaderTitles6=Registra tus Beats +Header.mobileHeaderTitles5=Acerca de nosotros +Header.mobileHeaderTitles0=Descubrir +Footer.mobileLocation=Localización\nESPAÑA +Header.mobileHeaderTitles2=Soporte +Header.mobileHeaderTitles1=Comprar diff --git a/src/main/resources/L10N/locale_ja_JP.properties b/src/main/resources/L10N/locale_ja_JP.properties index a5cbfffe4..14d11d5cd 100644 --- a/src/main/resources/L10N/locale_ja_JP.properties +++ b/src/main/resources/L10N/locale_ja_JP.properties @@ -11,3 +11,73 @@ WikipediaLocalePage.pageLinks4=最近の更新 WikipediaLocalePage.contribElem=投稿記録 WikipediaLocalePage.pageLinks5=おまかせ表示 WikipediaLocalePage.discussionElem=トーク +HomePage.LargeCard2.popularCardTitle=Beats Flex +HomePage.CustomCard3.featureTitle=Apple Musicが無料 +RegisterBeatsPage.lengthErrMsg=シリアル番号は12文字です +HomePage.Footer.FooterItem2.desktopRef0=関連情報 +HomePage.Footer.FooterItem3.desktopRef2=商標 +HomePage.Footer.FooterItem2.desktopRef1=求人情報 +HomePage.Footer.FooterItem3.desktopRef1=プライバシー +HomePage.Footer.FooterItem1.desktopRef0=ダウンロード +HomePage.Footer.FooterItem3.desktopRef0=利用規約 +HomePage.Footer.FooterItem2.itemTitle=企業情報 +HomePage.Footer.FooterItem1.desktopRef2=修理と保証 +HomePage.Footer.FooterItem1.desktopRef1=製品ヘルプ +Footer.locationCountry=日本 +HomePage.Footer.FooterItem1.desktopRef4=BEATS製品をアップデートする +HomePage.Footer.FooterItem1.desktopRef3=BEATS製品を登録する +HomePage.Footer.FooterItem0.desktopRef4=POWERBEATS PRO +HomePage.Footer.FooterItem0.desktopRef5=BEATS SOLO3 WIRELESS +Header.headerTitles0=見つける +HomePage.Footer.FooterItem0.desktopRef2=BEATS STUDIO BUDS +HomePage.Footer.FooterItem0.desktopRef3=BEATS FLEX +HomePage.Footer.FooterItem0.desktopRef0=すべて表示 +HomePage.Footer.FooterItem0.desktopRef1=BEATS FIT PRO +Footer.signUpButton=登録する +Footer.emailTitle=ニュースレター +headphonesRegisterButton=今すぐ登録 +Header.headerTitles1=購入 +Header.headerTitles2=サポート +Footer.copyright=Copyright © 2023 Apple Inc. - All rights reserved. +RegisterBeatsPage.howToFindSerNumberLink=シリアル番号の見つけ方 +HomePage.LargeCard1.popularCardPrice=27,800円(税込) +HomePage.LargeCard0.popularCardTitle=Beats Studio Buds +HomePage.Footer.FooterItem0.desktopRef6=BEATS STUDIO3 WIRELESS +HomePage.Footer.FooterItem1.desktopRef6=サポートに問い合わせる +HomePage.Footer.FooterItem1.desktopRef5=正規販売店 +HomePage.Footer.FooterItem1.desktopRef7=国番号 +HomePage.Footer.FooterItem3.desktopRef3=キャンペーンの利用条件 +RegistrationError.serNumberError=入力されたシリアル番号が無効か、登録の対象外です。 +HomePage.CustomCard1.featureTitle=Androidにも対応 +RegisterBeatsPage.verifySerNumberButton=シリアル番号を確認する +HomePage.CustomCard0.featureTitle=カスタマイズしよう +Footer.changeLocationButton=変更 +HomePage.CustomCard2.featureTitle=Beatsを探す +RegistrationError.errorTitle=エラーが発生しました +RegisterBeatsPage.invalidCharsErrMsg=英数字のみを入力してください! +HomePage.Footer.FooterItem1.itemTitle=サポート +Footer.mediaTitle=フォローする +RegisterBeatsPage.emptyInputErrMsg=シリアル番号を入力してください +HomePage.Footer.FooterItem3.itemTitle=法的情報 +HomePage.CustomCard0.featureDescription=Beats Fit Proの無料の刻印サービス。Apple限定。 +HomePage.LargeCard2.popularCardPrice=9,800円(税込) +Header.promoText=迅速かつ無料でお届けします +HomePage.CustomCard2.featureDescription=Beats製品を紛失した場合は、「探す」アプリで探すことができます。1 +HomePage.CustomCard3.featureDescription=一部のBeats製品を購入すると、Apple Musicを6か月間無料で体験できます。2 +HomePage.CustomCard1.featureDescription=Beatsアプリをダウンロードすると、さらに多くの機能を使えるようになります。 +Footer.locationTitle=場所 +HomePage.LargeCard1.popularCardTitle=Beats Solo3 Wireless +HomePage.LargeCard0.popularCardPrice=21,800円(税込) +RegisterBeatsPage.pageTitle=Beats製品を登録する +HomePage.Footer.FooterItem0.itemTitle=製品 +Header.mobileHeaderTitles8=商標 +Header.mobileHeaderTitles7=法的情報 +Footer.mobileEmailTitle=ニュースレター\n登録する +Header.mobileHeaderTitles4=ダウンロード +Header.mobileHeaderTitles3=企業情報 +Header.mobileHeaderTitles6=Beats製品を登録する +Header.mobileHeaderTitles5=Beats by Dr. Dreについて +Header.mobileHeaderTitles0=見つける +Footer.mobileLocation=場所\n日本 +Header.mobileHeaderTitles2=サポート +Header.mobileHeaderTitles1=購入 diff --git a/src/test/java/com/qaprosoft/carina/demo/beatsbydre/AbstractBeatsByDreTest.java b/src/test/java/com/qaprosoft/carina/demo/beatsbydre/AbstractBeatsByDreTest.java new file mode 100644 index 000000000..d8d121cf4 --- /dev/null +++ b/src/test/java/com/qaprosoft/carina/demo/beatsbydre/AbstractBeatsByDreTest.java @@ -0,0 +1,21 @@ +package com.qaprosoft.carina.demo.beatsbydre; + +import org.testng.annotations.BeforeMethod; + +import com.qaprosoft.carina.core.foundation.IAbstractTest; +import com.zebrunner.carina.utils.Configuration; +import com.zebrunner.carina.utils.R; +import com.zebrunner.carina.utils.resources.L10N; + +public class AbstractBeatsByDreTest implements IAbstractTest { + private static final String SITE_URL = "https://www.beatsbydre.com/"; + + @BeforeMethod + public void configure(){ + String country = L10N.getLocale().getCountry().toLowerCase(); + if (country.equals("us")) { + country = ""; + } + R.CONFIG.put(Configuration.Parameter.URL.getKey(), SITE_URL + country, true); + } +} diff --git a/src/test/java/com/qaprosoft/carina/demo/beatsbydre/LocalizationTest.java b/src/test/java/com/qaprosoft/carina/demo/beatsbydre/LocalizationTest.java new file mode 100644 index 000000000..e9f2231ae --- /dev/null +++ b/src/test/java/com/qaprosoft/carina/demo/beatsbydre/LocalizationTest.java @@ -0,0 +1,97 @@ +package com.qaprosoft.carina.demo.beatsbydre; + +import org.apache.commons.lang3.StringUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; +import org.testng.asserts.SoftAssert; + +import com.qaprosoft.carina.demo.beatsbydre.component.common.*; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.HomePageBase; +import com.qaprosoft.carina.demo.beatsbydre.gui.common.RegisterBeatsPageBase; +import com.zebrunner.carina.utils.resources.L10N; + +public class LocalizationTest extends AbstractBeatsByDreTest { + + @AfterClass + public void addLocales() { + L10N.flush(); + L10N.assertAll(); + } + + @Test() + public void testFooterLocale() { + HomePageBase homePage = initPage(getDriver(), HomePageBase.class); + homePage.open(); + homePage.assertPageOpened(); + + AbstractFooter footer = homePage.getFooter(); + footer.interactWithLocalizedElements(); + } + + @Test() + public void testHeaderLocale() { + HomePageBase homePage = initPage(getDriver(), HomePageBase.class); + homePage.open(); + homePage.assertPageOpened(); + + AbstractHeader header = homePage.getHeader(); + header.interactWithLocalizedElements(); + } + + @Test + public void testDiscoverPage() { + HomePageBase homePage = initPage(getDriver(), HomePageBase.class); + homePage.open(); + homePage.assertPageOpened(); + + homePage.getPopularCardsList().forEach(AbstractLargeCard::interactWithElements); + homePage.getFeatureCardList().forEach(AbstractCustomCard::interactWithElements); + homePage.interactWithHeadphoneRegBtn(); + } + + @Test + public void testRegisterPage() { + HomePageBase homePage = initPage(getDriver(), HomePageBase.class); + homePage.open(); + homePage.assertPageOpened(); + + RegisterBeatsPageBase registerPage = homePage.toRegisterBeatsPage(); + registerPage.assertPageOpened(); + + SoftAssert softAssert = new SoftAssert(); + softAssert.assertFalse(registerPage.getPageTitle().isBlank(), + "Headphones register page title is not visible!"); + softAssert.assertFalse(registerPage.getHowToFindSerNumberLink().isBlank(), + "Headphones how to find ser number info is not visible!"); + + String emptyString = StringUtils.EMPTY; + String invalidCharsInput = "@11111111111"; + String invalidLengthInput = "1"; + String invalidSerNumberInput = "211111111111"; + registerPage.typeSerNumberField(emptyString); + registerPage.verifySerNumber(); + softAssert.assertFalse(registerPage.getEmptyInputErrMsg().isBlank(), + "Empty input error message didn't popped up"); + registerPage.typeSerNumberField(invalidCharsInput); + registerPage.verifySerNumber(); + softAssert.assertFalse(registerPage.getInvalidCharsErrMsg().isBlank(), + "Invalid chars error message didn't popped up"); + registerPage.typeSerNumberField(invalidLengthInput); + registerPage.verifySerNumber(); + softAssert.assertFalse(registerPage.getLengthErrMsg().isBlank(), + "Invalid length error message didn't popped up"); + + registerPage.typeSerNumberField(invalidSerNumberInput); + registerPage.verifySerNumber(); + AbstractRegistrationError registrationError = registerPage.getRegistrationError(); + softAssert.assertTrue(registrationError.isUIObjectPresent(), + "Registration error modal didn't popped up"); + softAssert.assertFalse(registrationError.getErrorTitle().isBlank(), + "Registration error modal should contain title"); + softAssert.assertFalse(registrationError.getSerNumberError().isBlank(), + "Registration error modal should error info"); + registrationError.closeModal(); + softAssert.assertAll(); + } + +} diff --git a/src/test/resources/testng_suites/web-localization-beatsByDre.xml b/src/test/resources/testng_suites/web-localization-beatsByDre.xml new file mode 100644 index 000000000..4eb06a54a --- /dev/null +++ b/src/test/resources/testng_suites/web-localization-beatsByDre.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file