Skip to content

Commit

Permalink
Merge pull request #2128 from zebrunner/develop
Browse files Browse the repository at this point in the history
8.0.9
  • Loading branch information
vdelendik authored Mar 31, 2023
2 parents 4bea786 + 9909ac0 commit 1e5f55c
Show file tree
Hide file tree
Showing 68 changed files with 948 additions and 2,735 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@
<directory>src/test/resources</directory>
<includes>
<include>**/*.schema</include>
<include>**/*.xlsx</include>
<include>**/*.json</include>
<include>**/*.feature</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>src/test/resources/data_source</directory>
<includes>
<include>**/*.xlsx</include>
<include>**/*.csv</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>.settings</directory>
<includes>
Expand Down
2 changes: 1 addition & 1 deletion archetype/src/main/resources/archetype-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Install and configure [Apache Maven 3.6.0+](http://maven.apache.org/)
* Download and start the latest [Selenium standalone server](http://www.seleniumhq.org/download/)
* Download the latest version of [Eclipse](http://www.eclipse.org/downloads/) and install [TestNG plugin](http://testng.org/doc/download.html)
* [Read Carina documentation](http://zebrunner.github.io/carina)
* [Read Carina documentation](https://zebrunner.github.io/carina/)

### Import to Eclipse
If generation is successfully complete, you would see a new project folder with a name equal to the artifactId attribute specified during generation, so navigate to that folder (where pom.xml is located) and execute the following Maven task:
Expand Down
8 changes: 7 additions & 1 deletion archetype/src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<carina-core_version>8.0.8</carina-core_version>
<carina-core_version>8.0.9</carina-core_version>
<carina-dataprovider.version>1.0.0</carina-dataprovider.version>
<carina-api.version>1.0.0</carina-api.version>
<carina-aws-s3.version>1.0.1</carina-aws-s3.version>
<java.version>11</java.version>
Expand Down Expand Up @@ -42,6 +43,11 @@
<artifactId>carina-core</artifactId>
<version>${carina-core_version}</version>
</dependency>
<dependency>
<groupId>com.zebrunner</groupId>
<artifactId>carina-dataprovider</artifactId>
<version>${carina-dataprovider.version}</version>
</dependency>
<dependency>
<groupId>com.zebrunner</groupId>
<artifactId>carina-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

public class NewsItem extends AbstractUIObject {

@FindBy(xpath = ".//a/*[name()='h3' or name()='h2']")
@FindBy(xpath="./a")
public ExtendedWebElement titleLink;

public NewsItem(WebDriver driver, SearchContext sc) {
super(driver, sc);
}

public String readTitle() {
return titleLink.getElement().getText();
return titleLink.getText();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ public HomePage openHomePage() {
}

public CompareModelsPage openComparePage() {
compareLink.scrollTo();
compareLink.hover();
compareLink.click();
return new CompareModelsPage(driver);
}

public NewsPage openNewsPage() {
newsLink.scrollTo();
newsLink.hover();
newsLink.click();
return new NewsPage(driver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = CompareModelsPageBase.class)
public class CompareModelsPage extends CompareModelsPageBase {

@FindBy(xpath = "//h1[@class='section nobor']")
private ExtendedWebElement compareBlock;

@FindBy(xpath = "//div[contains(@class, 'candidate-search')]")
private List<CandidateBlock> candidateBlocks;

public CompareModelsPage(WebDriver driver) {
super(driver);
setUiLoadedMarker(compareBlock);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import ${package}.carina.demo.gui.pages.common.HomePageBase;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;
import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy;

@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = HomePageBase.class)
public class HomePage extends HomePageBase {
Expand Down Expand Up @@ -43,7 +42,6 @@ public class HomePage extends HomePageBase {

public HomePage(WebDriver driver) {
super(driver);
setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT);
setUiLoadedMarker(newsColumn);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@

import ${package}.carina.demo.gui.components.NewsItem;
import ${package}.carina.demo.gui.pages.common.NewsPageBase;
import com.zebrunner.carina.webdriver.locator.Context;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;
import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy;

@DeviceType(pageType = DeviceType.Type.ANDROID_PHONE, parentClass = NewsPageBase.class)
public class NewsPage extends NewsPageBase {

@FindBy(xpath = "//div[@class='search-field']//input[@type='search']")
@FindBy(xpath = "//div[@class='search-field']")
private ExtendedWebElement searchComp;

@Context(dependsOn = "searchComp")
@FindBy(tagName = "input")
private ExtendedWebElement searchField;

@FindBy(xpath = "//div[@class='search-field']//button")
@Context(dependsOn = "searchComp")
@FindBy(tagName = "button")
private ExtendedWebElement searchButton;

@FindBy(xpath = "//div[@class='news-item']")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public abstract class CompareModelsPageBase extends AbstractPage {

public CompareModelsPageBase(WebDriver driver) {
super(driver);
this.setPageURL("/compare.php3");
}

public abstract List<ModelSpecs> compareModels(String... models);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.openqa.selenium.support.FindBy;

import ${package}.carina.demo.gui.components.footer.FooterMenuBase;
import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;
import com.zebrunner.carina.webdriver.gui.AbstractPage;

Expand All @@ -17,6 +18,7 @@ public abstract class HomePageBase extends AbstractPage {

public HomePageBase(WebDriver driver) {
super(driver);
setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT);
}

public abstract BrandModelsPageBase selectBrand(String brandName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
@DeviceType(pageType = DeviceType.Type.DESKTOP, parentClass = CompareModelsPageBase.class)
public class CompareModelsPage extends CompareModelsPageBase {

private final String comparePageUrl = "https://www.gsmarena.com/compare.php3";

@FindBy(xpath = "//div[contains(@class, 'candidate-search')]")
private List<CandidateBlock> candidateBlocks;

Expand All @@ -32,8 +30,6 @@ public class CompareModelsPage extends CompareModelsPageBase {
public CompareModelsPage(WebDriver driver) {
super(driver);
setUiLoadedMarker(compareMenu);
setPageAbsoluteURL(comparePageUrl);
//setPageURL("/compare.php3");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import ${package}.carina.demo.gui.pages.common.BrandModelsPageBase;
import ${package}.carina.demo.gui.pages.common.CompareModelsPageBase;
import ${package}.carina.demo.gui.pages.common.HomePageBase;
import com.zebrunner.carina.utils.Configuration;
import com.zebrunner.carina.utils.R;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;

Expand All @@ -45,7 +43,6 @@ public class HomePage extends HomePageBase {
public HomePage(WebDriver driver) {
super(driver);
setUiLoadedMarker(newsColumn);
setPageAbsoluteURL(R.CONFIG.get(Configuration.Parameter.URL.getKey()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@

import ${package}.carina.demo.gui.components.NewsItem;
import ${package}.carina.demo.gui.pages.common.NewsPageBase;
import com.zebrunner.carina.webdriver.locator.Context;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;

@DeviceType(pageType = DeviceType.Type.DESKTOP, parentClass = NewsPageBase.class)
public class NewsPage extends NewsPageBase {

@FindBy(className="searchFor")

@FindBy(xpath = "//div[@class='search-band']")
private ExtendedWebElement searchDiv;

@Context(dependsOn = "searchDiv")
@FindBy(xpath = ".//input[@type='text']")
private ExtendedWebElement searchTextField;

@FindBy(xpath="//input[@value='Search']/parent::label")

@Context(dependsOn = "searchDiv")
@FindBy(xpath = ".//input[@type='submit']")
private ExtendedWebElement searchButton;
@FindBy(xpath="//div[@class='news-item']")

@FindBy(xpath = "//div[@class='news-item']")
private List<NewsItem> news;

public NewsPage(WebDriver driver) {
super(driver);
setPageURL("/news.php3");
Expand All @@ -36,5 +42,5 @@ public List<NewsItem> searchNews(String q) {
searchButton.click();
return news;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
@DeviceType(pageType = DeviceType.Type.IOS_PHONE, parentClass = CompareModelsPageBase.class)
public class CompareModelsPage extends CompareModelsPageBase {

@FindBy(xpath = "//h1[@class='section nobor']")
private ExtendedWebElement compareBlock;

@FindBy(xpath = "//div[contains(@class, 'candidate-search')]")
private List<CandidateBlock> candidateBlocks;

public CompareModelsPage(WebDriver driver) {
super(driver);
setUiLoadedMarker(compareBlock);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import ${package}.carina.demo.gui.pages.common.HomePageBase;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;
import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy;

@DeviceType(pageType = DeviceType.Type.IOS_PHONE, parentClass = HomePageBase.class)
public class HomePage extends HomePageBase {
Expand Down Expand Up @@ -43,7 +42,6 @@ public class HomePage extends HomePageBase {

public HomePage(WebDriver driver) {
super(driver);
setPageOpeningStrategy(PageOpeningStrategy.BY_ELEMENT);
setUiLoadedMarker(newsColumn);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@

import ${package}.carina.demo.gui.components.NewsItem;
import ${package}.carina.demo.gui.pages.common.NewsPageBase;
import com.zebrunner.carina.webdriver.locator.Context;
import com.zebrunner.carina.utils.factory.DeviceType;
import com.zebrunner.carina.webdriver.decorator.ExtendedWebElement;
import com.zebrunner.carina.webdriver.decorator.PageOpeningStrategy;

@DeviceType(pageType = DeviceType.Type.IOS_PHONE, parentClass = NewsPageBase.class)
public class NewsPage extends NewsPageBase {

@FindBy(xpath = "//div[@class='search-field']//input[@type='search']")
@FindBy(xpath = "//div[@class='search-field']")
private ExtendedWebElement searchComp;

@Context(dependsOn = "searchComp")
@FindBy(tagName = "input")
private ExtendedWebElement searchField;

@FindBy(xpath = "//div[@class='search-field']//button")
@Context(dependsOn = "searchComp")
@FindBy(tagName = "button")
private ExtendedWebElement searchButton;

@FindBy(xpath = "//div[@class='news-item']")
Expand All @@ -36,6 +42,7 @@ public NewsPage(WebDriver driver) {
public List<NewsItem> searchNews(String searchInput) {
searchField.type(searchInput);
searchButton.click();

return news;
}

Expand Down
Loading

0 comments on commit 1e5f55c

Please sign in to comment.