-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
еÑtest: add two tests to check the title on the reviews page (#2)
- Loading branch information
1 parent
57f07df
commit 0b6f57f
Showing
7 changed files
with
115 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
# justeLeStudioTests | ||
# !простоSтудия |Java 11 | Selenium | TestNG | Maven | POM Project | ||
|
||
Всех приветствую)) | ||
|
||
Этот репозиторий содержит автотесты для открытого проекта **!простоSтудия**, который | ||
разрабатывается в рамках практики от [PINEAPPLE PRACTICE](https://pnpl.site) | ||
|
||
Пока сайт тестируетс локально 🤫🤷♀️. Но скоро состоится деплой 💪✊🤩 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
package practice.pineapple.model; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import practice.pineapple.model.base.BasePage; | ||
|
||
public class FeedbackPage extends BasePage { | ||
|
||
private final By HEDER_REVIEWS = By.xpath("//h1"); | ||
|
||
public FeedbackPage(WebDriver driver) { | ||
|
||
super(driver); | ||
} | ||
|
||
public WebElement getHederReviews() { | ||
|
||
return getDriver().findElement(HEDER_REVIEWS); | ||
} | ||
|
||
public String getTextHederReviews() { | ||
|
||
return getText(getHederReviews()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package practice.pineapple.model; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import practice.pineapple.model.base.BasePage; | ||
|
||
public class MainPage extends BasePage { | ||
|
||
private final By MENU_REVIEWS = By.xpath("//nav/ul/li/a[@href='/reviews']"); | ||
|
||
public MainPage(WebDriver driver) { | ||
|
||
super(driver); | ||
} | ||
|
||
public WebElement getMenuReviews() { | ||
|
||
return getDriver().findElement(MENU_REVIEWS); | ||
} | ||
|
||
public FeedbackPage clickMenuReviews() { | ||
|
||
getMenuReviews().click(); | ||
|
||
return new FeedbackPage(getDriver()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package practice.pineapple.tests; | ||
|
||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
import practice.pineapple.model.HomePage; | ||
import practice.pineapple.model.MainPage; | ||
import practice.pineapple.runner.order.BaseTest; | ||
|
||
public class FeedbackTests extends BaseTest { | ||
|
||
final String headerExpectedResult = "Отзывы"; | ||
|
||
@Test | ||
public void testHederReviewsAfterNavigatingFromHomePage() throws InterruptedException { | ||
|
||
openBaseURL(); | ||
String headerActualResult = new HomePage(getDriver()) | ||
.clickLinkToReviews() | ||
.getTextHederReviews(); | ||
|
||
Assert.assertEquals(headerActualResult, headerExpectedResult); | ||
} | ||
|
||
@Test | ||
|
||
public void testHederReviewsAfterNavigatingFromMenu() { | ||
|
||
openBaseURL(); | ||
String headerActualResult = new MainPage(getDriver()) | ||
.clickMenuReviews() | ||
.getTextHederReviews(); | ||
|
||
Assert.assertEquals(headerActualResult, headerExpectedResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/test/java/practice/pineapple/tests/main/MainHeaderTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package practice.pineapple.tests.main; | ||
|
||
import practice.pineapple.runner.order.BaseTest; | ||
|
||
public class MainHeaderTests extends BaseTest { | ||
|
||
|
||
} |