-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ui-01] Work with Wheather ui branch #1
base: master
Are you sure you want to change the base?
Changes from 4 commits
0a7b0ef
a85884e
ee48dd5
7bd85a1
9fc39e1
d932da6
bc62e29
44b077f
2454d9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.idea/ | ||
.idea/ | ||
ui-wheatherapi/build/ | ||
ui-wheatherapi/target/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.example</groupId> | ||
<artifactId>WheatherapiProject</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>ui-wheatherapi</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.codeborne</groupId> | ||
<artifactId>selenide</artifactId> | ||
<version>7.6.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>7.10.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>net.datafaker</groupId> | ||
<artifactId>datafaker</artifactId> | ||
<version>2.4.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.36</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>7.10.2</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
Comment on lines
+34
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move in global pom |
||
|
||
</dependencies> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.weatherapi.ui.pages; | ||
|
||
import com.codeborne.selenide.Condition; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.codeborne.selenide.WebDriverRunner; | ||
import org.testng.Assert; | ||
|
||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
public class HistoryPage { | ||
private final SelenideElement historyButton = $("[class=\"p-2\"][title=\"Benidorm weather history\"]"); | ||
private final String historyURL = "https://www.weatherapi.com/history/q/benidorm-699566"; | ||
private final SelenideElement historyElement = $("[class=\"p-2 h4\"][title=\"Benidorm weather history\"]"); | ||
public final String textElementHistory = "History"; | ||
|
||
public HistoryPage goToTomorrowPage(){ | ||
Kofanskih marked this conversation as resolved.
Show resolved
Hide resolved
|
||
historyButton.click(); | ||
return new HistoryPage(); | ||
} | ||
|
||
public HistoryPage checkTomorrowPageURL(){ | ||
Assert.assertEquals(WebDriverRunner.getWebDriver().getCurrentUrl(), historyURL); | ||
return this; | ||
} | ||
|
||
public HistoryPage checkTomorrowPageElements(){ | ||
historyElement.shouldHave(Condition.exactText(textElementHistory)); | ||
return this; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.weatherapi.ui.pages; | ||
|
||
import static com.codeborne.selenide.Selenide.open; | ||
|
||
public class MainPage { | ||
public MainPage(String mainPage){ | ||
open(mainPage); | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.weatherapi.ui.pages; | ||
|
||
import com.codeborne.selenide.Condition; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.codeborne.selenide.WebDriverRunner; | ||
import org.testng.Assert; | ||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
public class TodayPage { | ||
private final SelenideElement todayButton = $("[class=\"p-2 h4\"][title=\"Today weather\"]"); | ||
private final String todayURL = "https://www.weatherapi.com/weather/q/benidorm-699566"; | ||
private final SelenideElement todayElement = $("[href=\"/weather/q/benidorm-699566\"][title=\"Today weather\"]"); | ||
public final String textElementToday = "Today"; | ||
|
||
public TodayPage goToTodayPage(){ | ||
Kofanskih marked this conversation as resolved.
Show resolved
Hide resolved
|
||
todayButton.click(); | ||
return new TodayPage(); | ||
} | ||
|
||
public TodayPage checkTodayPageURL(){ | ||
Assert.assertEquals(WebDriverRunner.getWebDriver().getCurrentUrl(), todayURL); | ||
return this; | ||
} | ||
|
||
public TodayPage checkTodayPageElements(){ | ||
todayElement.shouldHave(Condition.exactText(textElementToday)); | ||
return this; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.weatherapi.ui.pages; | ||
|
||
import com.codeborne.selenide.Condition; | ||
import com.codeborne.selenide.SelenideElement; | ||
import com.codeborne.selenide.WebDriverRunner; | ||
import org.testng.Assert; | ||
|
||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
public class TomorrowPage { | ||
private final SelenideElement tomorrowButton = $("[class=\"p-2\"][title=\"Tomorrow weather\"]"); | ||
private final String tomorrowURL = "https://www.weatherapi.com/weather/q/benidorm-699566?day=1"; | ||
private final SelenideElement tomorrowElement = $("[href=\"/weather/q/benidorm-699566\"][title=\"Tomorrow weather\"]"); | ||
public final String textElementTomorrow = "Tomorrow"; | ||
|
||
public TomorrowPage goToTomorrowPage(){ | ||
Kofanskih marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tomorrowButton.click(); | ||
return new TomorrowPage(); | ||
} | ||
|
||
public TomorrowPage checkTomorrowPageURL(){ | ||
Assert.assertEquals(WebDriverRunner.getWebDriver().getCurrentUrl(), tomorrowURL); | ||
return this; | ||
} | ||
|
||
public TomorrowPage checkTomorrowPageElements(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add parametr |
||
tomorrowElement.shouldHave(Condition.exactText(textElementTomorrow)); | ||
return this; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package utils; | ||
|
||
import com.codeborne.selenide.Configuration; | ||
|
||
public class ConfigurateBrowserSettings { | ||
public void setUp(){ | ||
Configuration.browserSize = "1980x1080"; | ||
Configuration.browser = "chrome"; | ||
Configuration.timeout = 5; | ||
//Configuration.headless = true; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.weatherapi.ui.tests; | ||
|
||
import com.weatherapi.ui.pages.MainPage; | ||
import com.weatherapi.ui.pages.TodayPage; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
import utils.ConfigurateBrowserSettings; | ||
|
||
public class TodaysWeatherForecasTest { | ||
private final String MAIN_PAGE = "https://www.weatherapi.com/weather/"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move in separate class |
||
|
||
@BeforeClass | ||
void preConditionsClass() { | ||
new ConfigurateBrowserSettings().setUp(); | ||
} | ||
@BeforeMethod | ||
void preConditionsMethod(){ | ||
new MainPage(MAIN_PAGE); | ||
} | ||
|
||
@Test | ||
void userGoToTodayPageV1() { | ||
new TodayPage() | ||
.goToTodayPage() | ||
.checkTodayPageURL(); | ||
|
||
} | ||
|
||
@Test | ||
void userGoToTodayPageV2() { | ||
new TodayPage() | ||
.goToTodayPage() | ||
.checkTodayPageElements(); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.wheatherapi.ui.tests; | ||
|
||
import com.wheatherapi.ui.pages.MainPage; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
import utils.ConfigurateBrowserSettings; | ||
|
||
public class TodaysWeatherForecasTest { | ||
private final String MAIN_PAGE = "https://www.weatherapi.com/weather/"; | ||
|
||
@BeforeClass | ||
void preConditions() { | ||
new ConfigurateBrowserSettings().setUp(); | ||
} | ||
|
||
@Test | ||
void userBookShopLogin() { | ||
new MainPage(MAIN_PAGE); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have 2 testng dependencies