diff --git a/pom.xml b/pom.xml index 2bb8612..35f6cde 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ org.apache.maven.plugins maven-compiler-plugin + 2.3.2 8 8 @@ -22,9 +23,37 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + 2.22.2 - true + false + + -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" + + + ${project.build.directory}/allure-results + + + + listener + io.qameta.allure.junit4.AllureJunit4 + + + + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + + + + io.qameta.allure + allure-maven + 2.10.0 + + 2.6.0 @@ -34,6 +63,8 @@ 11 11 UTF-8 + 1.9.5 + 2.13.6 @@ -48,6 +79,27 @@ 7.0.0 test + + io.qameta.allure + allure-junit4 + ${allure.version} + test + + + org.aspectj + aspectjweaver + ${aspectj.version} + + + org.slf4j + slf4j-api + 1.7.30 + + + org.slf4j + slf4j-log4j12 + 1.7.30 + \ No newline at end of file diff --git a/src/test/java/lib/CoreTestCase.java b/src/test/java/lib/CoreTestCase.java index a8e1afa..d433a7e 100644 --- a/src/test/java/lib/CoreTestCase.java +++ b/src/test/java/lib/CoreTestCase.java @@ -1,30 +1,36 @@ package lib; import io.appium.java_client.AppiumDriver; +import io.qameta.allure.Step; import junit.framework.TestCase; import lib.UI.MainPageObject; import lib.UI.WelcomePageObject; +import org.junit.After; +import org.junit.Before; import org.openqa.selenium.ScreenOrientation; import org.openqa.selenium.remote.RemoteWebDriver; -public class CoreTestCase extends TestCase { +import java.io.FileOutputStream; +import java.util.Properties; + +public class CoreTestCase { protected RemoteWebDriver driver; private static String AppiumURL = "http://127.0.0.1:4723/"; - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + @Step("Run driver and session") + public void setUp() throws Exception { driver = Platform.getInstance().getDriver(); + this.createAllurePropertyFile(); this.rotateScreenPortrait(); this.skipWelcomePageForApp(); this.openWikiWebPageForMobileWeb(); } - @Override - protected void tearDown() throws Exception { + @After + @Step("Remove driver and session") + public void tearDown() { driver.quit(); - - super.tearDown(); } protected void rotateScreenPortrait() { @@ -36,6 +42,7 @@ protected void rotateScreenPortrait() { } } + @Step("Rotate screen to LANDSCAPE mode") protected void rotateScreenLandscape() { if (driver instanceof AppiumDriver) { AppiumDriver driver = (AppiumDriver) this.driver; @@ -45,6 +52,7 @@ protected void rotateScreenLandscape() { } } + @Step("Skip welcome screen for iOS/Android") private void skipWelcomePageForApp() { if (Platform.getInstance().isiOS()) { @@ -56,6 +64,7 @@ private void skipWelcomePageForApp() } } + @Step("Open wikipedia URL for Mobile Web (this method does nothing for Android and iOS)") protected void openWikiWebPageForMobileWeb() { if (Platform.getInstance().isMW()) { @@ -64,4 +73,18 @@ protected void openWikiWebPageForMobileWeb() System.out.println("Method openWikiWebPageForMobileWeb() do nothing for platform " + Platform.getInstance().getPlatformVar()); } } + private void createAllurePropertyFile() + { + String path = System.getProperty("allure.results.directory"); + try { + Properties props = new Properties(); + FileOutputStream fos = new FileOutputStream(path + "/environment.properties"); + props.setProperty("Environment", Platform.getInstance().getPlatformVar()); + props.store(fos,"See https://github.com/allure-framework/allure-app/wiki/Environment"); + fos.close(); + } catch (Exception e) { + System.err.println("IO problem when writing allure properties file"); + e.printStackTrace(); + } + } } diff --git a/src/test/java/lib/UI/ArticlePageObject.java b/src/test/java/lib/UI/ArticlePageObject.java index 4b84617..b1f2d18 100644 --- a/src/test/java/lib/UI/ArticlePageObject.java +++ b/src/test/java/lib/UI/ArticlePageObject.java @@ -1,5 +1,6 @@ package lib.UI; +import io.qameta.allure.Step; import lib.Platform; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; @@ -26,24 +27,32 @@ private static String getSubTitleElement(String substring) } /*TEMPLATES METHODS */ + @Step("Waiting for title '{substring}' in the folder") public WebElement waitForTitleElementInFolder(String substring) { String element_result_present_xpath = getTitleElement(substring); return this.waitForElementPresent(element_result_present_xpath,"Cannot find " + substring + " article in folder",7); } + @Step("Waiting for subtitle '{substring}' on the article page") public WebElement waitForSubTitleElement(String substring) { String element_result_present_xpath = getSubTitleElement(substring); return this.waitForElementPresent(element_result_present_xpath,"Cannot find " + substring + " article in folder",7); } + @Step("Getting for title on the article in folder (for mobile web)") public String getArticleTitleInFolderMW() { + screenshot(this.takeScreenshot("article_title_in_folder")); return this.waitForElementPresent(TITLE_IN_FOLDER_TPL,"Can",3).getText(); } + @Step("Getting for title '{substring}' on the article in folder (for iOS/Android)") public String getArticleTitleInFolder(String substring) { WebElement title_element_in_folder = waitForTitleElementInFolder(substring); + + screenshot(this.takeScreenshot("article_title_in_folder")); + String element=null; if (Platform.getInstance().isiOS()) { element = title_element_in_folder.getAttribute("value"); @@ -55,6 +64,7 @@ public String getArticleTitleInFolder(String substring) return element; } + @Step("Getting for subtitle '{substring}' on the article") public String getArticleSubTitle(String substring) { WebElement subtitle_element_in_folder = waitForSubTitleElement(substring); @@ -64,17 +74,21 @@ public String getArticleSubTitle(String substring) } else if (Platform.getInstance().isiOS()) { element = "value"; } + screenshot(this.takeScreenshot("article_subtitle")); return subtitle_element_in_folder.getAttribute(element); } + @Step("Waiting for title in the article") public WebElement waitForTitleElementInArticle() { return this.waitForElementPresent(TITLE_IN_ARTICLE,"Cannot find title in article",10); } + @Step("Waiting for title in the article without waiting for the title to appear") public void waitForTitleElementInArticleWithoutTimeout() { this.assertElementPresent(TITLE_IN_ARTICLE,"Cannot find title in article"); } + @Step("Getting for title on the article (for iOS/Android)") public String getTitleInArticle() { WebElement title_element = waitForTitleElementInArticle(); @@ -84,12 +98,16 @@ public String getTitleInArticle() } else { element = title_element.getAttribute("value"); } + screenshot(this.takeScreenshot("title_in_article")); return element; } + @Step("Getting for title on the article (for mobile web)") public String getTitleInArticleMW () { + screenshot(this.takeScreenshot("title_in_article")); return this.waitForElementPresent(TITLE_IN_ARTICLE,"Can2",3).getText(); } + @Step("Swiping article '{substring}' for delete") public void swipeElementDelete(String substring) { this.waitForArticleToAppearByTitle(substring); @@ -100,6 +118,7 @@ public void swipeElementDelete(String substring) } } + @Step("Waiting for article by '{substring}'") public void waitForArticleToAppearByTitle(String substring) { String article_xpath = getTitleElement(substring); diff --git a/src/test/java/lib/UI/BottomToolbarArticleUI.java b/src/test/java/lib/UI/BottomToolbarArticleUI.java index 9871715..e0dab1c 100644 --- a/src/test/java/lib/UI/BottomToolbarArticleUI.java +++ b/src/test/java/lib/UI/BottomToolbarArticleUI.java @@ -1,5 +1,6 @@ package lib.UI; +import io.qameta.allure.Step; import lib.Platform; import org.openqa.selenium.remote.RemoteWebDriver; @@ -19,7 +20,6 @@ abstract public class BottomToolbarArticleUI extends MainPageObject { INOUT_PASSWORD, BUTTON_SUBMIT, BUTTON_LOG_IN, - BURGER_MENU, BUTTON_WATCHLIST, UNSAVE_BUTTON, UPDATE_SAVED; @@ -35,6 +35,7 @@ private static String getNameOfList(String substring) return NAME_OF_EXIST_LIST_TPL.replace("{SUBSTRING_NAME_OF_LIST}",substring); } /*TEMPLATES METHODS */ + @Step("Adding to favourite list") public void addToList () { this.waitForElementAndClick(BUTTON_PAGE_SAVE, "Cannot find Save button", 3); @@ -46,24 +47,30 @@ public void addToList () } } + @Step("Login for mobile web") public void logIn (String name, String password) { this.waitForElementAndClick(BUTTON_LOG_IN,"Cannot find 'log in' button",5); this.waitForElementAndSendKeys(INPUT_NAME,name,"Cannot find input for name",5); this.waitForElementAndSendKeys(INOUT_PASSWORD,password,"Cannot find input for password",5); this.waitForElementAndClick(BUTTON_SUBMIT,"Cannot find submit button",5); + screenshot(this.takeScreenshot("log_in")); } + @Step("Open watchList for mobile web") public void watchList () { this.waitForElementAndClick(BUTTON_WATCHLIST,"Cannot find watchlist button",5); + screenshot(this.takeScreenshot("watchList")); } + @Step("Delete article from favorites for mobile web") public void deleteArticle () { this.waitForElementAndClick(UNSAVE_BUTTON,"Cannot find unsaved button",5); } + @Step("Create favorite list with name '{name_of_folder}' for iOS/Android") public void createMyList(String name_of_folder) { if (Platform.getInstance().isiOS()) { @@ -71,14 +78,15 @@ public void createMyList(String name_of_folder) } this.waitForElementAndSendKeys(INPUT_NAME_OF_FOLDER, name_of_folder, "Cannot find input for write name of this list", 5); this.waitForElementAndClick(BUTTON_OK, "Cannot find button 'OK'", 5); - } + @Step("Add to exist favorite list with name '{substring}' for iOS/Android") public void addToExistList(String substring) { String name_of_saves_list = getNameOfList(substring); this.waitForElementAndClick(name_of_saves_list, "Cannot find folder " + substring, 5); } + @Step("View exist favorite list for iOS/Android") public void viewExistListAfterSave() { this.waitForElementAndClick(BUTTON_VIEW_LIST, "Cannot click on View list", 5); diff --git a/src/test/java/lib/UI/MainPageObject.java b/src/test/java/lib/UI/MainPageObject.java index 594969c..02ceb4a 100644 --- a/src/test/java/lib/UI/MainPageObject.java +++ b/src/test/java/lib/UI/MainPageObject.java @@ -4,15 +4,21 @@ import io.appium.java_client.TouchAction; import io.appium.java_client.touch.WaitOptions; import io.appium.java_client.touch.offset.PointOption; +import io.qameta.allure.Attachment; +import io.qameta.allure.Step; +import jdk.javadoc.internal.doclets.toolkit.util.DocFinder; import lib.Platform; +import org.apache.commons.io.FileUtils; import org.junit.Assert; -import org.openqa.selenium.By; -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebElement; +import org.openqa.selenium.*; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.Duration; import java.util.List; @@ -29,6 +35,7 @@ public MainPageObject(RemoteWebDriver driver) this.driver = driver; } + @Step("Waiting for element present") public WebElement waitForElementPresent(String locator, String error_message, long timeoutInSeconds) { By by = this.getLocatorByString(locator); WebDriverWait wait = new WebDriverWait(driver, timeoutInSeconds); @@ -37,21 +44,25 @@ public WebElement waitForElementPresent(String locator, String error_message, lo ExpectedConditions.presenceOfElementLocated(by) ); } + @Step("Waiting for element present") public WebElement waitForElementPresent(String locator, String error_message) { return waitForElementPresent(locator,error_message,5); } + @Step("Waiting for element present and click") public WebElement waitForElementAndClick(String locator, String error_message, long timeoutInSeconds) { WebElement element = waitForElementPresent(locator,error_message,timeoutInSeconds); element.click(); return element; } + @Step("Waiting for element present and send keys '{value}'") public WebElement waitForElementAndSendKeys(String locator, String value, String error_message, long timeoutInSeconds) { WebElement element = waitForElementPresent(locator,error_message,timeoutInSeconds); element.sendKeys(value); return element; } + @Step("Waiting for element not present") public boolean waitForElementNotPresent(String locator, String error_message, long timeoutSeconds) { By by = this.getLocatorByString(locator); @@ -61,12 +72,14 @@ public boolean waitForElementNotPresent(String locator, String error_message, lo ExpectedConditions.invisibilityOfElementLocated(by) ); } + @Step("Check that element has text '{expected_result}'") public void assertElementHasText(String locator, String expected_result, String error_message, String assert_error) { WebElement element = waitForElementPresent(locator,error_message); String elementText = element.getAttribute("text"); Assert.assertEquals(error_message,expected_result,elementText); } + @Step("Waiting for element present and clear it") public WebElement waitForElementAndClear(String locator, String error_message, long timeoutInSeconds) { WebElement element = waitForElementPresent(locator,error_message,timeoutInSeconds); @@ -74,6 +87,7 @@ public WebElement waitForElementAndClear(String locator, String error_message, l return element; } + @Step("Waiting for word '{value}' in element") public void waitForWordInElement(String externalLocator, String internalLocator, String error_message, String value) { if (driver instanceof AppiumDriver) { AppiumDriver driver = (AppiumDriver) this.driver; @@ -92,6 +106,7 @@ public void waitForWordInElement(String externalLocator, String internalLocator, Assert.assertTrue(error_message, result); } + @Step("Swipe element to the left") public void swipeElementToLeft(String locator, String error_message) { if (driver instanceof AppiumDriver) { @@ -128,6 +143,7 @@ public void swipeElementToLeft(String locator, String error_message) } } + @Step("Check that element present") public void assertElementPresent (String locator, String error_message) { By by = this.getLocatorByString(locator); @@ -138,6 +154,7 @@ public void assertElementPresent (String locator, String error_message) } } + @Step("Get amount of elements") public int getAmountOfElements(String locator) { By by = this.getLocatorByString(locator); @@ -145,6 +162,7 @@ public int getAmountOfElements(String locator) return elements.size(); } + @Step("Get locator") private By getLocatorByString(String locator_with_type) { String[] exploded_locator = locator_with_type.split(Pattern.quote(":"),2); @@ -162,8 +180,34 @@ private By getLocatorByString(String locator_with_type) } } + @Step("Click skip button") public void clickSkip() { this.waitForElementAndClick(SKIP_ELEMENT, "Cannot find button Skip",5); } + + public String takeScreenshot (String name) + { + TakesScreenshot ts = (TakesScreenshot) this.driver; + File source = ts.getScreenshotAs(OutputType.FILE); + String path = System.getProperty("user.dir") + "/" + name + "_screenshot.png"; + try { + FileUtils.copyFile(source, new File(path)); + System.out.println("This screenshot was taken: " + path); + } catch (Exception e) { + System.out.println("Cannot take screenshot. Error: " + e.getMessage()); + } + return path; + } + + @Attachment + public static byte[] screenshot(String path) { + byte[] bytes = new byte[0]; + try { + bytes = Files.readAllBytes(Paths.get(path)); + } catch (IOException e) { + System.out.println("Cannot get bytes from screenshot. Error: " + e.getMessage()); + } + return bytes; + } } diff --git a/src/test/java/lib/UI/SearchPageObject.java b/src/test/java/lib/UI/SearchPageObject.java index 7479632..4c30a31 100644 --- a/src/test/java/lib/UI/SearchPageObject.java +++ b/src/test/java/lib/UI/SearchPageObject.java @@ -1,5 +1,6 @@ package lib.UI; +import io.qameta.allure.Step; import lib.Platform; import org.openqa.selenium.remote.RemoteWebDriver; @@ -44,33 +45,40 @@ private static String getResultSearchTitleAndDescription(String substring_title, } /*TEMPLATES METHODS */ + @Step("Initializing the search field") public void initSearchInput() { this.waitForElementPresent(SEARCH_INIT_AND_INPUT_ELEMENT, "Cannot find Search Wikipedia input"); this.waitForElementAndClick(SEARCH_INIT_AND_INPUT_ELEMENT, "Cannot find search input after clicking search input element",5); } + @Step("Waiting for button to cancel search result") public void waitForCancelButtonToAppear() { this.waitForElementPresent(SEARCH_CANCEL_BUTTON,"Cannot find Navigate up to cancel",5); } + @Step("Waiting for search cancel button to do disappear") public void waitForCancelButtonToDisappear() { this.waitForElementNotPresent(SEARCH_CANCEL_BUTTON,"Cannot find search cancel button",5); } + @Step("Clicking button to cancel search result") public void clickCancelSearch() { this.waitForElementAndClick(SEARCH_CANCEL_BUTTON,"Cannot find and click search cancel button",5); } + @Step("Clear search phrase in search input") public void clearSearchPhrase() { this.waitForElementAndClear(SEARCH_CLEAR_PHRASE,"Cannot find search field",5); } + @Step("Checking that nothing search result on screen") public void searchNothingResult() { this.waitForElementPresent(SEARCH_BEFORE_INPUT_ELEMENT,"There is a search result on the screen"); } + @Step("Typing '{search_line}' to the search line") public void typeSearchLine(String search_line) { if (Platform.getInstance().isiOS()) @@ -81,8 +89,10 @@ public void typeSearchLine(String search_line) } else { this.waitForElementAndSendKeys(SEARCH_INPUT_ELEMENT,search_line,"Cannot find search Java input",5); } + screenshot(this.takeScreenshot("search_line")); } + @Step("Waiting for search result by '{substring}'") public void waitForSearchResult(String substring) { if (Platform.getInstance().isMW()) { @@ -94,24 +104,28 @@ public void waitForSearchResult(String substring) } } + @Step("Making sure there are no results for the search by '{substring}'") public void waitForSearchNoResult(String substring) { String search_no_result_xpath = getResultSearchElement(substring); this.waitForElementNotPresent(search_no_result_xpath,"Result is still on screen" + substring,15); } + @Step("Waiting for search result and select an article by '{substring}' in article title") public void clickByArticleWithSubstring(String substring) { String search_result_xpath = getResultSearchTitleElement(substring); this.waitForElementAndClick(search_result_xpath,"Cannot find and click search result with substring " + substring,15); } + @Step("Select an article by '{substring}' in article title in favourite list") public void clickBySavedArticleWithSubstring(String substring) { if (Platform.getInstance().isMW()) { this.waitForElementAndClick(TITLE_ARTICLE,"Cannot find and click saved result with substring " + substring,15); } } + @Step("Getting amount of found articles") public int getAmountOfFoundArticles() { this.waitForElementPresent( @@ -121,10 +135,12 @@ public int getAmountOfFoundArticles() ); return this.getAmountOfElements(SEARCH_AMOUNT_RESULT); } + @Step("Making sure there are all results contains search word '{search_line}'") public void findWordInSearchResult(String search_line) { this.waitForWordInElement(SEARCH_RESULT_LIST, SEARCH_ITEM, "Cannot find " + search_line + " in each search result", search_line); } + @Step("Making sure there are search input contains default text - '{expected_text}'") public void searchExpectedText(String expected_text) { if (Platform.getInstance().isiOS()) @@ -136,6 +152,7 @@ public void searchExpectedText(String expected_text) this.assertElementHasText(SEARCH_INPUT_ELEMENT, expected_text, "Element does not exist", "Element does not equal " + expected_text); } } + @Step("Searching for results based on two conditions - '{title}' and '{description}'") public void waitForElementByTitleAndDescription(String title, String description) { String search_result_for_two_condition = getResultSearchTitleAndDescription(title, description); diff --git a/src/test/java/lib/UI/WelcomePageObject.java b/src/test/java/lib/UI/WelcomePageObject.java index 543603a..00862ab 100644 --- a/src/test/java/lib/UI/WelcomePageObject.java +++ b/src/test/java/lib/UI/WelcomePageObject.java @@ -1,5 +1,6 @@ package lib.UI; +import io.qameta.allure.Step; import org.openqa.selenium.remote.RemoteWebDriver; public class WelcomePageObject extends MainPageObject @@ -17,38 +18,52 @@ public WelcomePageObject(RemoteWebDriver driver) super(driver); } + @Step("Waiting for learn more link") public void waitForLearnMoreLink() { + screenshot(this.takeScreenshot("more_link")); this.waitForElementPresent(STEP_LEARN_MORE_LINK,"Cannot find 'Learn more about Wikipedia' link",10); } + @Step("Waiting for new way to explore text") public void waitForNewWayToExploreText() { + screenshot(this.takeScreenshot("new_way_to_explore_text")); this.waitForElementPresent(STEP_NEW_WAYS_TO_EXPLORE_TEXT,"Cannot find 'New ways to explore' link",10); } + @Step("Waiting for add or edit preferred lang text") public void waitForAddOrEditPreferredLangText() { + screenshot(this.takeScreenshot("add_or_edit_preferred_lang_text")); this.waitForElementPresent(STEP_ADD_OR_EDIT_PREFERRED_LANG_LINK,"Cannot find 'Add or edit preferred languages' link",10); } + @Step("Waiting for learn more about date collected text") public void waitForLearnMoreAboutDateCollectedText() { + screenshot(this.takeScreenshot("learn_more_about_date_collected_text")); this.waitForElementPresent(STEP_LEARN_MORE_ABOUT_DATA_COLLECTED_LINK,"Cannot find 'Learn more about data collected' link",10); } + @Step("Click to the next button") public void clickNextButton() { + screenshot(this.takeScreenshot("next_button")); this.waitForElementAndClick(NEXT_LINK,"Cannot find and click 'Next' link",10); } + @Step("Click to get started button") public void clickGetStartedButton() { + screenshot(this.takeScreenshot("get_started_button")); this.waitForElementAndClick(GET_STARTED_BUTTON,"Cannot find and click 'Get started' link",10); } + @Step("Click to skip button") public void clickSkip() { + screenshot(this.takeScreenshot("skip_button")); this.waitForElementAndClick(SKIP_ELEMENT, "Cannot find button Skip",5); } } diff --git a/src/test/java/tests/ArticleTests.java b/src/test/java/tests/ArticleTests.java index 96d91b4..f278cf8 100644 --- a/src/test/java/tests/ArticleTests.java +++ b/src/test/java/tests/ArticleTests.java @@ -1,23 +1,32 @@ package tests; +import io.qameta.allure.*; +import io.qameta.allure.junit4.DisplayName; import lib.CoreTestCase; import lib.Platform; import lib.UI.*; import lib.UI.factory.ArticlePageObjectFactory; import lib.UI.factory.BottomToolbarArticleUIFactory; import lib.UI.factory.SearchPageObjectFactory; +import org.junit.Assert; import org.junit.Test; +@Epic("Tests for articles") public class ArticleTests extends CoreTestCase { @Test + @Features(value = {@Feature(value="Search"),@Feature(value="Article")}) + @DisplayName("Working with list of favorites") + @Description("Test is adding 2 articles in favorite list, then deleting 1 selected article and checking that the correct article was deleted ") + @Step("Starting test testSwipeArticle") + @Severity(value=SeverityLevel.CRITICAL) public void testSwipeArticle() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); SearchPageObject.initSearchInput(); String searchWord = "Appium"; - String nameArticleOne = "AppImage"; + String nameArticleOne = "Appium"; String nameArticleTwo = "Appius Claudius Caecus"; String subArticleTwo ="Roman statesman"; @@ -64,7 +73,7 @@ public void testSwipeArticle() String article_title_in_folder = ArticlePageObject.getArticleTitleInFolder(nameArticleTwo); SearchPageObject.clickByArticleWithSubstring(nameArticleTwo); String article_title_in_article = ArticlePageObject.getTitleInArticle(); - assertEquals( + Assert.assertEquals( "We see unexpected title", article_title_in_article, article_title_in_folder @@ -74,7 +83,7 @@ public void testSwipeArticle() SearchPageObject.clickByArticleWithSubstring(nameArticleTwo); String article_subtitle_in_article = ArticlePageObject.getArticleSubTitle(subArticleTwo); - assertEquals( + Assert.assertEquals( "We see unexpected subtitle", article_subtitle_in_folder, article_subtitle_in_article @@ -83,7 +92,7 @@ public void testSwipeArticle() String article_title_in_folder = ArticlePageObject.getArticleTitleInFolderMW(); SearchPageObject.clickBySavedArticleWithSubstring(nameArticleTwo); String article_title_in_article = ArticlePageObject.getTitleInArticleMW(); - assertEquals( + Assert.assertEquals( "We see unexpected title", article_title_in_article, article_title_in_folder @@ -92,6 +101,11 @@ public void testSwipeArticle() } @Test + @Features(value = {@Feature(value="Search"),@Feature(value="Article")}) + @DisplayName("Finding articles with title") + @Description("Test is searching articles for search word, finding in search result article with the defined header") + @Step("Starting test testFindTitle") + @Severity(value=SeverityLevel.BLOCKER) public void testFindTitle() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); diff --git a/src/test/java/tests/ChangeAppConditionTests.java b/src/test/java/tests/ChangeAppConditionTests.java index 956e0d7..e43ed8e 100644 --- a/src/test/java/tests/ChangeAppConditionTests.java +++ b/src/test/java/tests/ChangeAppConditionTests.java @@ -1,15 +1,24 @@ package tests; +import io.qameta.allure.*; +import io.qameta.allure.junit4.DisplayName; import lib.CoreTestCase; import lib.UI.ArticlePageObject; import lib.UI.SearchPageObject; import lib.UI.factory.ArticlePageObjectFactory; import lib.UI.factory.SearchPageObjectFactory; +import org.junit.Assert; import org.junit.Test; +@Epic("Tests for orientation") public class ChangeAppConditionTests extends CoreTestCase { @Test + @Features(value = {@Feature(value="Orientation"),@Feature(value="Article")}) + @DisplayName("Change orientation on search results") + @Description("Test is opening article, changing orientation and checking that article title haven't been changed after screen rotation") + @Step("Starting test testChangeOrientationOnSearchResults") + @Severity(value=SeverityLevel.CRITICAL) public void testChangeOrientationOnSearchResults() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -28,7 +37,7 @@ public void testChangeOrientationOnSearchResults() String titleAfterRotation = ArticlePageObject.getTitleInArticle(); - assertEquals( + Assert.assertEquals( "Article title have been changed after screen rotation", titleBeforeRotation, titleAfterRotation diff --git a/src/test/java/tests/GetStartedTest.java b/src/test/java/tests/GetStartedTest.java index 8b375fd..82db6d0 100644 --- a/src/test/java/tests/GetStartedTest.java +++ b/src/test/java/tests/GetStartedTest.java @@ -1,13 +1,21 @@ package tests; +import io.qameta.allure.*; +import io.qameta.allure.junit4.DisplayName; import lib.CoreTestCase; import lib.Platform; import lib.UI.WelcomePageObject; import org.junit.Test; +@Epic("Tests for onboarding") public class GetStartedTest extends CoreTestCase { @Test + @Features(value = {@Feature(value="Onboarding")}) + @DisplayName("Welcome test") + @Description("Test scrolls through all the onboarding screens") + @Step("Starting test testPassThroughWelcome") + @Severity(value=SeverityLevel.BLOCKER) public void testPassThroughWelcome() { if (Platform.getInstance().isAndroid()) { diff --git a/src/test/java/tests/SearchTests.java b/src/test/java/tests/SearchTests.java index 3baa2d6..c81a1a3 100644 --- a/src/test/java/tests/SearchTests.java +++ b/src/test/java/tests/SearchTests.java @@ -1,13 +1,22 @@ package tests; +import io.qameta.allure.*; +import io.qameta.allure.junit4.DisplayName; import lib.CoreTestCase; import lib.UI.SearchPageObject; import lib.UI.factory.SearchPageObjectFactory; +import org.junit.Assert; import org.junit.Test; +@Epic("Tests for search") public class SearchTests extends CoreTestCase { @Test + @Features(value = {@Feature(value="Search"),@Feature(value="Article")}) + @DisplayName("Search test") + @Description("Test is searching by word and checking for the presence of the desired article in the search results") + @Step("Starting test testSearch") + @Severity(value=SeverityLevel.BLOCKER) public void testSearch() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -18,6 +27,11 @@ public void testSearch() SearchPageObject.waitForSearchResult(search_expected_text); } @Test + @Features(value = {@Feature(value="Search")}) + @DisplayName("Cancel search") + @Description("Test clicks into the input and cancels the search") + @Step("Starting test testCancelSearch") + @Severity(value=SeverityLevel.BLOCKER) public void testCancelSearch() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -28,6 +42,11 @@ public void testCancelSearch() } @Test + @Features(value = {@Feature(value="Search")}) + @DisplayName("Checking input") + @Description("Test checks that input has default text") + @Step("Starting test testSearchInputHasText") + @Severity(value=SeverityLevel.CRITICAL) public void testSearchInputHasText() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -38,6 +57,11 @@ public void testSearchInputHasText() } @Test + @Features(value = {@Feature(value="Search")}) + @DisplayName("Clear search") + @Description("Test checks that more than 1 result is found and clears the search") + @Step("Starting test testClearSearch") + @Severity(value=SeverityLevel.BLOCKER) public void testClearSearch() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -47,7 +71,7 @@ public void testClearSearch() SearchPageObject.typeSearchLine(search_line); int amount_of_search_results = SearchPageObject.getAmountOfFoundArticles(); - assertTrue( + Assert.assertTrue( "We found some results ", amount_of_search_results>1 ); @@ -56,6 +80,11 @@ public void testClearSearch() } @Test + @Features(value = {@Feature(value="Search")}) + @DisplayName("Find search result") + @Description("Test checks that in all results the search contains search word") + @Step("Starting test testFindSearchResult") + @Severity(value=SeverityLevel.BLOCKER) public void testFindSearchResult() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver); @@ -66,6 +95,11 @@ public void testFindSearchResult() SearchPageObject.findWordInSearchResult(search_line); } @Test + @Features(value = {@Feature(value="Search"),@Feature(value="Article")}) + @DisplayName("Find search result for 2 condition") + @Description("Test performs a search for 2 conditions - title and description") + @Step("Starting test testFindSearchResultForTwoCondition") + @Severity(value=SeverityLevel.BLOCKER) public void testFindSearchResultForTwoCondition() { SearchPageObject SearchPageObject = SearchPageObjectFactory.get(driver);