Skip to content
This repository was archived by the owner on Oct 18, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Practice of automation school 2016

See all info in repo [autoschool/autoschool.github.io](https://github.com/autoschool/autoschool.github.io)

HERE link for my repo with copy of Dockerfile

https://github.com/theBaldSoprano/ubuntuWithCurlGit
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,26 @@ public void initSteps() {
}

@Test
@Title("Должны видеть виджет на главной странице")
@Title("Widget on main page must be seen")
public void shouldSeeWidgetOnMainPage() {
defaultSteps.openMainPageWithCity(MOSCOW);
defaultSteps.shouldSee(onMainPage().getWeatherWidget().get(0));
defaultSteps.shouldSeeWidget(onMainPage().getWeatherWidgetList().get(0));
}

@Test
@Title("City from widget must match city from URL")
public void shouldWidgetCityBeLinkCity() {
defaultSteps.openMainPageWithCity(MOSCOW);
defaultSteps.shouldBeWeatherOfLinkCity(MOSCOW, onMainPage().getWeatherWidgetList().get(0).getWidgetTitle().getWidgetCity());
}

@Test
@Title("Widget must be added after pushing \"add new widget\" button")
public void shouldWidgetBeAdded() {
defaultSteps.openMainPageWithCity(MOSCOW);
int buttonTimesPushed = 5;
defaultSteps.pushNewWeatherButtonNTimes(buttonTimesPushed);
defaultSteps.shouldSeeNumWidgets(buttonTimesPushed + 1, onMainPage().getWeatherWidgetList());
}

private MainPage onMainPage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package ru.qatools.school.webtests;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import ru.qatools.school.pages.MainPage;
import ru.qatools.school.rules.WebDriverRule;
import ru.qatools.school.steps.websteps.DefaultSteps;
import ru.qatools.school.tp.TPInformerRule;
import ru.yandex.qatools.allure.annotations.Title;
import ru.yandex.qatools.allure.annotations.TestCaseId;



public class WeatherWidgetSmokeTest {

public static final String CITY = "Winnipeg";

private MainPage onMainPage() {
return new MainPage(webDriverRule.getDriver());
}

private DefaultSteps defaultSteps;

@Rule
public TPInformerRule tms = new TPInformerRule("thebaldsoprano");

@Rule
public WebDriverRule webDriverRule = new WebDriverRule();

@Before
public void initSteps() { defaultSteps = new DefaultSteps(webDriverRule.getDriver());}

@Test
@Title("Should open main page with widget")
@TestCaseId("2")
public void shouldOpenMainPageWithWidget(){
defaultSteps.openMainPageWithCity(CITY);
defaultSteps.shouldSeeWidget(onMainPage().getWeatherWidgetList().get(0));
}

@Test
@Title("Should see \"add new widget\" button")
@TestCaseId("3")
public void shouldSeeAddWidgetButton(){
defaultSteps.openMainPageWithCity(CITY);
defaultSteps.shouldSeeAddWidgetButton(onMainPage().getNewWeatherWidgetCard().get(0));
}

@Test
@Title("Should see \"remove widget\" button")
@TestCaseId("4")
public void shouldSeeRemoveWidgetButton(){
defaultSteps.openMainPageWithCity(CITY);
defaultSteps.shouldSeeRemoveWidgetButton(onMainPage().getWeatherWidgetList().get(0).getWidgetActions().getRemoveWidgetButton());
}

@Test
@Title("\"Add new widget\" button should add widget")
@TestCaseId("5")
public void shouldAddNewWidget(){
defaultSteps.openMainPageWithCity(CITY);
int buttonPushes = 3;
defaultSteps.pushNewWeatherButtonNTimes(buttonPushes);
defaultSteps.shouldSeeNumWidgets(buttonPushes + 1, onMainPage().getWeatherWidgetList());
}

@Test
@Title("Should remove all widgets")
@TestCaseId("6")
public void shouldRemoveWidgets(){
defaultSteps.openMainPageWithCity(CITY);
int buttonPushes = 1; //why not work on bigger clicks
defaultSteps.pushNewWeatherButtonNTimes(buttonPushes);
defaultSteps.removeNWidgets(buttonPushes+1);
defaultSteps.shouldBeNoWidgets(onMainPage().getWeatherWidgetList());
}
}
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
<aspectj.version>1.8.5</aspectj.version>
</properties>

<dependencyManagement>
<dependencies>
<!--https://github.com/jayway/rest-assured/wiki/GettingStarted-->
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -43,7 +56,7 @@
<artifactId>rest-assured</artifactId>
<version>2.9.0</version>
</dependency>

<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
Expand Down
17 changes: 13 additions & 4 deletions steps-module/src/main/java/ru/qatools/school/pages/MainPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import ru.qatools.school.pages.blocks.WeatherWidget;
import ru.qatools.school.pages.blocks.NewWeatherWidgetCard;
import ru.yandex.qatools.htmlelements.annotations.Name;
import ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementDecorator;
import ru.yandex.qatools.htmlelements.loader.decorator.HtmlElementLocatorFactory;
Expand All @@ -19,12 +20,20 @@ public MainPage(WebDriver driver) {
PageFactory.initElements(new HtmlElementDecorator(new HtmlElementLocatorFactory(driver)), this);
}

@Name("Список виджетов")
@Name("Widgets list")
@FindBy(css = ".card.card_md")
private List<WeatherWidget> weatherWidget;
private List<WeatherWidget> weatherWidgetList;

public List<WeatherWidget> getWeatherWidget() {
return weatherWidget;
@Name("New weather widget card")
@FindBy(css = ".new-card")
private List<NewWeatherWidgetCard> newWeatherWidgetCard;

public List<NewWeatherWidgetCard> getNewWeatherWidgetCard() {
return newWeatherWidgetCard;
}

public List<WeatherWidget> getWeatherWidgetList() {
return weatherWidgetList;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ru.qatools.school.pages.blocks;

import org.openqa.selenium.Rectangle;
import org.openqa.selenium.support.FindBy;
import ru.yandex.qatools.htmlelements.annotations.Name;
import ru.yandex.qatools.htmlelements.element.Button;
import ru.yandex.qatools.htmlelements.element.HtmlElement;

/**
* Created by Gregory on 4/15/2016.
*/


public class NewWeatherWidgetCard extends HtmlElement {

@Name("Add widget button")
@FindBy(css = ".new-card__symbol")
private Button addWidgetButton;

public Button getAddWidgetButton() {
return addWidgetButton;
}


public Rectangle getRect() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import ru.qatools.school.pages.blocks.widgetblocks.WidgetActions;
import ru.qatools.school.pages.blocks.widgetblocks.WidgetText;
import ru.qatools.school.pages.blocks.widgetblocks.WidgetTitle;
import ru.yandex.qatools.htmlelements.annotations.Name;
Expand All @@ -13,17 +14,17 @@
*/
public class WeatherWidget extends HtmlElement {

@Name("Заголовок виджета")
@Name("Widget title")
@FindBy(css = ".card-title")
private WidgetTitle widgetTitle;

@Name("Текст виджета")
@Name("Widget text")
@FindBy(css = ".card-text")
private WidgetText widgetText;

@Name("Панель управления виджетом")
@Name("Widget actions")
@FindBy(css = ".card-actions")
private WebElement actions;
private WidgetActions widgetActions;

public WidgetText getWidgetText() {
return widgetText;
Expand All @@ -33,8 +34,8 @@ public WidgetTitle getWidgetTitle() {
return widgetTitle;
}

public WebElement getActions() {
return actions;
public WidgetActions getWidgetActions() {
return widgetActions;
}

public Rectangle getRect() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package ru.qatools.school.pages.blocks.widgetblocks;

import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import ru.yandex.qatools.htmlelements.annotations.Name;
import ru.yandex.qatools.htmlelements.element.Button;
import ru.yandex.qatools.htmlelements.element.HtmlElement;

public class WidgetActions extends HtmlElement {

@Name("Remove widget button")
@FindBy(css = ".remove-card.btn.btn-default")
private WebElement removeWidgetButton;

public WebElement getRemoveWidgetButton() {
return removeWidgetButton;
}

public Rectangle getRect() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class WidgetText extends HtmlElement {

@Name("Картинка текущей погоды")
@Name("Current weather image")
@FindBy(css = ".weather-image")
private WebElement weatherImage;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package ru.qatools.school.pages.blocks.widgetblocks;

import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import ru.yandex.qatools.htmlelements.annotations.Name;
import ru.yandex.qatools.htmlelements.element.HtmlElement;

/**
* Created by kurau.
*/
public class WidgetTitle extends HtmlElement {

@Name("Название города")
@FindBy(css = ".card-title__primary")
private WebElement widgetCity;

public WebElement getWidgetCity() {return widgetCity;}

public Rectangle getRect() {
return null;
}
Expand Down
Loading