diff --git a/src/test/java/features/EpubLyrasis.feature b/src/test/java/features/EpubLyrasis.feature index edd14dc..3268f75 100644 --- a/src/test/java/features/EpubLyrasis.feature +++ b/src/test/java/features/EpubLyrasis.feature @@ -183,8 +183,9 @@ Feature: Read EPUB in Lyrasis Reads And Click READ action button on Book details screen And Open navigation bar on reader epub screen And Add bookmark on reader epub screen - Then Bookmark is displayed on reader epub screen - When Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen +# And Wait for 3 seconds +# Then Bookmark is displayed on reader epub screen + And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen And Save device time and date as 'deviceTimeDateKey' And Scroll page forward from 7 to 9 times And Add bookmark on reader epub screen @@ -232,6 +233,91 @@ Feature: Read EPUB in Lyrasis Reads | Palace Marketplace | | Axis 360 | + @logout @returnBooks @tier1 + Scenario: Read ebooks: Search: Perform check of the placeholder + When Search for "The Voyages of Doctor Dolittle" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + Then Placeholder contains "Search" text on search epub screen + + @logout @returnBooks @tier1 + Scenario: Read ebooks: Search: Perform check of editing the data + When Search for "The Voyages of Doctor Dolittle" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Enter 'Book' text and save it as 'searchedText' on search epub screen + And Edit data by adding characters in search epub screen and save it as 'newText' + Then Placeholder contains word 'newText' text in search epub screen + + @logout @returnBooks @tier1 + Scenario Outline: Read ebooks: Search: Perform check that search result contain one or more entered latin letters or numeric + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Search for and save word as 'searchedWord' on search epub screen + Then Search results contain word 'searchedWord' on search epub screen + + Scenarios: + | word | + | in | + | F | + | 1 | + + @logout @returnBooks @tier1 + Scenario Outline: Read ebooks: Search: Enter data and get empty search result + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Search for and save word as 'searchedWord' on search epub screen + Then Search result is empty on search epub screen + + Scenarios: + | word | + | рнл | + | Red text | + | | + | @$ | + + @logout @returnBooks @tier1 + Scenario Outline: Read ebooks: Perform check of the input in different font cases + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Search for and save word as 'searchedWord' on search epub screen + Then Search results contain word 'searchedText' on search epub screen + + Scenarios: + | word | + | world | + | WORLD | + | WorLD | + + @logout @returnBooks @tier1 + Scenario: Read ebooks: Search: Perform check of empty field + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Apply search on search epub screen + Then Search result is empty on search epub screen + @smoke @logout @returnBooks Scenario: Read ebooks: Pages: Perform check of reader navigating (swiping left and right) When Search for "The Giants Return" and save bookName as 'bookNameInfo' @@ -296,4 +382,27 @@ Feature: Read EPUB in Lyrasis Reads Then 'bookInfo' book is present on epub reader screen When Tap search icon on epub reader screen And Enter 'try' text and save it as 'searchedText' on search epub screen - Then The field allows to enter characters and contains 'searchedText' on search epub screen \ No newline at end of file + Then The field allows to enter characters and contains 'searchedText' on search epub screen + + @logout @returnBooks @smoke + Scenario: Read ebooks: Search: Perform check of finding an existing word + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Search for but and save word as 'searchedText' on search epub screen + Then Search results contain word 'searchedText' on search epub screen + + @logout @returnBooks @smoke + Scenario: Read ebooks: Search: Perform check of the "Delete" button + When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' + And Click READ action button on Book details screen + Then 'bookInfo' book is present on epub reader screen + When Tap search icon on epub reader screen + And Enter 'Make for the Hills' text and save it as 'searchedText' on search epub screen + And Delete text in search line on search epub screen + Then Placeholder does not contain word 'searchedText' text on search epub screen \ No newline at end of file diff --git a/src/test/java/features/EpubPalace.feature b/src/test/java/features/EpubPalace.feature index 4181721..64c1b16 100644 --- a/src/test/java/features/EpubPalace.feature +++ b/src/test/java/features/EpubPalace.feature @@ -17,7 +17,7 @@ Feature: Read EPUB in Palace Bookshelf And Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click READ action button on Book details screen Then 'bookInfo' book is present on epub reader screen - When Scroll page forward from 3 to 6 times + When Scroll page forward from 3 to 5 times And Open navigation bar on reader epub screen And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen And Tap on right book corner on epub reader screen @@ -33,10 +33,9 @@ Feature: Read EPUB in Palace Bookshelf And Click READ action button on Book details screen And Open navigation bar on reader epub screen And Add bookmark on reader epub screen - Then Bookmark is displayed on reader epub screen - When Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen + And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen And Save device time and date as 'deviceTimeDateKey' - And Scroll page forward from 3 to 6 times + And Scroll page forward from 3 to 5 times And Add bookmark on reader epub screen And Save pageNumber as 'pageNumberKey2' and chapterName as 'chapterNameKey2' on epub reader screen And Save device time and date as 'deviceTimeDateKey2' diff --git a/src/test/java/features/PdfLyrasisAndroid.feature b/src/test/java/features/PdfLyrasisAndroid.feature index 616658c..6e7c657 100644 --- a/src/test/java/features/PdfLyrasisAndroid.feature +++ b/src/test/java/features/PdfLyrasisAndroid.feature @@ -134,7 +134,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Table of contents: Perform check of navigation of TOC button When Open search modal - And Search for "Comprehension and Critical Thinking Grade 6" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -154,7 +154,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Perform check of Settings When Open search modal - And Search for "Comprehension and Critical Thinking Grade 6" and save bookName as 'bookNameInfo' + And Search for "Being Plumville" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -166,7 +166,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Perform check of scrolling by default (down and up) When Open search modal - And Search for "Comprehension and Critical Thinking Grade 6" and save bookName as 'bookNameInfo' + And Search for "The Art of Three" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -186,7 +186,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Table of contents: Perform check of navigation When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "The Art of Three" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -202,7 +202,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Perform check of back button When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Being Plumville" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -214,7 +214,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Table of contents: Contents with thumbnails: Perform check of navigation When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -230,7 +230,7 @@ Feature: Read PDF in LYRASIS Reads on Android @smoke @logout @returnBooks @exclude_ios Scenario: Android: Read pdfs: Table of contents: Chapter content: Perform check of navigation When Open search modal - And Search for "Comprehension and Critical Thinking Grade 6" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' diff --git a/src/test/java/features/PdfLyrasisIos.feature b/src/test/java/features/PdfLyrasisIos.feature index f6db82a..ba2b606 100644 --- a/src/test/java/features/PdfLyrasisIos.feature +++ b/src/test/java/features/PdfLyrasisIos.feature @@ -155,7 +155,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: IOS: Read pdfs: Pages: Perform check of reader navigating (swiping left and right) When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -171,7 +171,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Search: Perform check that the field allows you to enter characters and delete them When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -186,7 +186,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Search: Perform check of finding a word in the book When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -200,7 +200,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Perform check of navigation When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -216,7 +216,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Perform check of back button When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -228,7 +228,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Contents with thumbnails: Perform check of navigation When Open search modal - And Search for "Race Cars" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -244,7 +244,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Chapter content: Perform check of navigation When Open search modal - And Search for "Comprehension and Critical Thinking Grade 6" and save bookName as 'bookNameInfo' + And Search for "Tell A Thousand Lies" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' diff --git a/src/test/java/features/PdfPalaceIos.feature b/src/test/java/features/PdfPalaceIos.feature index ecaf2a3..4f9fe78 100644 --- a/src/test/java/features/PdfPalaceIos.feature +++ b/src/test/java/features/PdfPalaceIos.feature @@ -45,7 +45,7 @@ Feature: Read PDF in Palace Bookshelf on IOS Scenario: Navigate by Thumbnails When Open TOC on pdf reader screen Then There are content list with thumbnails and chapter content on pdf toc screen - When Open random thumbnail and save the number as 'pageInfo' on pdf toc screen + When Open 2 thumbnail and save the number as 'pageInfo' on pdf toc screen Then Page number is equal to 'pageInfo' on pdf reader screen @tier2 @exclude_android @@ -66,7 +66,7 @@ Feature: Read PDF in Palace Bookshelf on IOS @tier2 @exclude_android Scenario: Navigate by Pdf Search Results When Open search pdf screen - And Enter 'try' text on search pdf screen + And Search for 'try' text on search pdf screen And Open random found text and save page number as 'pageNumber' on search pdf screen Then Page number is equal to 'pageNumber' on pdf reader screen diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index c4490c0..f1f137b 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -19,7 +19,7 @@ public class SortOptionsScreen extends Screen { new AndroidLocator(By.xpath("//android.widget.Button[@index=\"5\"]")), new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnSortByPalace = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout/android.widget.Button[2]")), + new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout/android.widget.Button")), new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnAvailability = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"feedHeaderFacets\")]/android.widget.Button[1]")), diff --git a/src/test/java/screens/epub/BookmarksEpubScreen.java b/src/test/java/screens/epub/BookmarksEpubScreen.java index 6c43fc0..e9ad2a5 100644 --- a/src/test/java/screens/epub/BookmarksEpubScreen.java +++ b/src/test/java/screens/epub/BookmarksEpubScreen.java @@ -28,10 +28,11 @@ public class BookmarksEpubScreen extends Screen { new AndroidLocator(By.id("tocBookmarksList")), new IosLocator(By.xpath("//XCUIElementTypeTable"))), "Bookmarks tab"); private final IButton btnDelete = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.Button[contains(@resource-id,\"button1\")]")), + new AndroidLocator(By.xpath("//android.widget.ImageView[contains(@resource-id,\"bookmarkDelete\")]")), new IosLocator(By.name("Delete"))), "Delete bookmark button"); private static final String BTN_DELETE_LOC_ANDROID = "//android.widget.ImageView[contains(@resource-id,\"bookmarkDelete\")]"; + private static final String BOOKMARK_TITLE_LOC_ANDROID = "//android.widget.TextView[contains(@resource-id, \"bookmarkTitle\")]"; private static final String BOOKMARK_TITLE_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeStaticText[1]"; private static final String BOOKMARK_DATE_TIME_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeStaticText[2]"; @@ -52,20 +53,17 @@ public boolean isBookmarkScreenOpened() { } public boolean isBookmarkPresent(String expectedBookmarkTitle, String bookmarkDateTime) { - LocalDateTime expectedLocalDateTime = ActionProcessorUtils.doForIos(() -> getExpectedLocalDateTimeIos(bookmarkDateTime)); - - if(expectedLocalDateTime == null) { - expectedLocalDateTime = ActionProcessorUtils.doForAndroid(() -> DateUtils.getExpectedLocalDateTime(bookmarkDateTime)); - } + LocalDateTime expectedLocalDateTime = DateUtils.getExpectedLocalDateTime(bookmarkDateTime); AqualityServices.getLogger().info("expected bookmark info: "); AqualityServices.getLogger().info("expected bookmark title-" + expectedBookmarkTitle); - AqualityServices.getLogger().info("actual year-" + expectedLocalDateTime.getYear()); - AqualityServices.getLogger().info("actual month-" + expectedLocalDateTime.getMonthValue()); - AqualityServices.getLogger().info("actual dayNumber-" + expectedLocalDateTime.getDayOfMonth()); - AqualityServices.getLogger().info("actual min-" + expectedLocalDateTime.getMinute()); - AqualityServices.getLogger().info("actual hour-" + expectedLocalDateTime.getHour()); + AqualityServices.getLogger().info("expected year-" + expectedLocalDateTime.getYear()); + AqualityServices.getLogger().info("expected month-" + expectedLocalDateTime.getMonthValue()); + AqualityServices.getLogger().info("expected dayNumber-" + expectedLocalDateTime.getDayOfMonth()); + AqualityServices.getLogger().info("expected min-" + expectedLocalDateTime.getMinute()); + AqualityServices.getLogger().info("expected hour-" + expectedLocalDateTime.getHour()); boolean isBookmarkPresent = false; + for (int i = 0; i < getListOfBookmarkTitles().size(); i++) { String actualBookmarkTitle = getListOfBookmarkTitles().get(i); LocalDateTime actualLocalDateTime = getActualLocalDateTime(getListOfBookmarkTimeDates().get(i)); @@ -89,7 +87,9 @@ public boolean isBookmarkPresent(String expectedBookmarkTitle, String bookmarkDa } public List getListOfBookmarkTitles() { - return getListOfILableOfBookmarkTitles().stream().map(label -> label.getAttribute(IosAttributes.NAME)).collect(Collectors.toList()); + + + return getListOfILabelOfBookmarkTitles().stream().map(label -> label.getAttribute(IosAttributes.NAME)).collect(Collectors.toList()); } public List getListOfBookmarkTimeDates() { @@ -97,7 +97,7 @@ public List getListOfBookmarkTimeDates() { } public void openBookmark(int bookmarkNumber) { - getListOfILableOfBookmarkTitles().get(bookmarkNumber).click(); + getListOfILabelOfBookmarkTitles().get(bookmarkNumber).click(); } public void deleteBookmark(int bookmarkNumber) { @@ -107,7 +107,7 @@ public void deleteBookmark(int bookmarkNumber) { }); ActionProcessorUtils.doForIos(() -> { - ILabel lblBookmark = getListOfILableOfBookmarkTitles().get(bookmarkNumber); + ILabel lblBookmark = getListOfILabelOfBookmarkTitles().get(bookmarkNumber); SwipeElementUtils.swipeElementLeft(lblBookmark); btnDelete.click(); }); @@ -126,8 +126,10 @@ private String deleteSomeCharactersForExpectedDateTime(String stringExpectedDate return stringExpectedDateTime.split("\\+")[0].replace("T", " "); } - private List getListOfILableOfBookmarkTitles() { - return getElementFactory().findElements(By.xpath(BOOKMARK_TITLE_LOC_IOS), ElementType.LABEL); + private List getListOfILabelOfBookmarkTitles() { + return getElementFactory().findElements(LocatorUtils.getLocator( + new AndroidLocator(By.id(BOOKMARK_TITLE_LOC_ANDROID)), + new IosLocator(By.xpath(BOOKMARK_TITLE_LOC_IOS))), ElementType.LABEL); } private LocalDateTime getActualLocalDateTime(String stringActualDateTime) { diff --git a/src/test/java/screens/epub/NavigationBarScreen.java b/src/test/java/screens/epub/NavigationBarScreen.java index 98bb880..c6dc336 100644 --- a/src/test/java/screens/epub/NavigationBarScreen.java +++ b/src/test/java/screens/epub/NavigationBarScreen.java @@ -20,10 +20,10 @@ public class NavigationBarScreen extends Screen { new AndroidLocator(By.id("readerMenuAddBookmark")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"Add Bookmark\"]"))), "Add Bookmark button"); private final IButton btnDeleteBookmark = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.TextView[contains(@content-desc,\"Delete the bookmark\")]")), + new AndroidLocator(By.xpath("//android.widget.Button[contains(@content-desc,\"Delete the bookmark\")]")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"Remove Bookmark\"]"))), "Delete bookmark button"); private final IButton btnFontSettings = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.TextView[contains(@resource-id,\"readerMenuSettings\")]")), + new AndroidLocator(By.xpath("//android.widget.Button[contains(@resource-id,\"readerMenuSettings\")]")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"Reader settings\"]"))), "Font settings"); private final IButton btnSearch = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.id("readerMenuSearch")), diff --git a/src/test/java/screens/epub/ReaderEpubScreen.java b/src/test/java/screens/epub/ReaderEpubScreen.java index 155f40d..5aaef0a 100644 --- a/src/test/java/screens/epub/ReaderEpubScreen.java +++ b/src/test/java/screens/epub/ReaderEpubScreen.java @@ -15,6 +15,7 @@ import io.appium.java_client.touch.offset.PointOption; import models.AndroidLocator; import models.IosLocator; +import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.By; public class ReaderEpubScreen extends Screen { @@ -87,8 +88,7 @@ public void hideNavigationBar() { public String getPageNumber() { String pageNumber = ActionProcessorUtils.doForIos(() -> { String number = lblPageNumber.getAttribute(IosAttributes.NAME); - number = RegExUtil.deleteBracketsFromText(number); - return RegExUtil.getStringFromFirstGroup(number, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); + return StringUtils.substringBetween(number, "Page", "of"); }); if ((pageNumber == null)) { diff --git a/src/test/java/screens/epub/SearchEpubScreen.java b/src/test/java/screens/epub/SearchEpubScreen.java index 13c9394..0d0a166 100644 --- a/src/test/java/screens/epub/SearchEpubScreen.java +++ b/src/test/java/screens/epub/SearchEpubScreen.java @@ -1,17 +1,40 @@ package screens.epub; +import aquality.appium.mobile.elements.ElementType; +import aquality.appium.mobile.elements.interfaces.IButton; +import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.elements.interfaces.ITextBox; import aquality.appium.mobile.screens.Screen; +import constants.appattributes.IosAttributes; +import framework.utilities.ActionProcessorUtils; +import framework.utilities.KeyboardUtils; import framework.utilities.LocatorUtils; +import io.appium.java_client.android.nativekey.AndroidKey; import models.AndroidLocator; import models.IosLocator; import org.openqa.selenium.By; +import java.util.ArrayList; +import java.util.List; + public class SearchEpubScreen extends Screen { private final ITextBox txbSearchField = getElementFactory().getTextBox(LocatorUtils.getLocator( new AndroidLocator(By.id("search_src_text")), new IosLocator(By.xpath("//XCUIElementTypeTextField"))), "Search text box"); + private final IButton btnClear = getElementFactory().getButton(LocatorUtils.getLocator( + new AndroidLocator(By.id("search_close_btn")), + new IosLocator(By.xpath("//XCUIElementTypeButton[@name=\"\tClose\"]"))), "Clear text button"); + private final ILabel lblNoResults = getElementFactory().getLabel(LocatorUtils.getLocator( + new AndroidLocator(By.id("noResultLabel")), + new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"There are no results\"]"))), "No results label"); + private final IButton btnDeleteKeyIos = getElementFactory().getButton(By.xpath("//XCUIElementTypeKey[@name=\"delete\"]"), "Delete button"); + private final IButton btnKIos = getElementFactory().getButton(By.xpath("//XCUIElementTypeKey[@name=\"k\"]"), "K button"); + private final IButton btnSearchIos = getElementFactory().getButton(By.xpath("//XCUIElementTypeKey[@name=\"Return\"]"), "Search button"); + + private static final String FOUND_TEXT_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText"; + + private static final String FOUND_TEXT_LOCATOR_ANDROID = "//androidx.recyclerview.widget.RecyclerView/android.widget.TextView"; public SearchEpubScreen () { super(LocatorUtils.getLocator( @@ -30,4 +53,48 @@ public void enterText(String text) { public String getTextFromSearchTxb() { return txbSearchField.getText(); } + + public void deleteSomeData() { + ActionProcessorUtils.doForAndroid(() -> KeyboardUtils.pressKey(AndroidKey.DEL)); + ActionProcessorUtils.doForIos(btnDeleteKeyIos::click); + } + + public void inputCharacterK() { + ActionProcessorUtils.doForAndroid(() -> KeyboardUtils.pressKey(AndroidKey.K)); + ActionProcessorUtils.doForIos(btnKIos::click); + } + + public void applySearch() { + ActionProcessorUtils.doForAndroid(() -> KeyboardUtils.pressKey(AndroidKey.ENTER)); + ActionProcessorUtils.doForIos(btnSearchIos::click); + } + + public List getListOfFoundTexts() { + List foundTextLabels = getFoundTexts(); + List resultList = new ArrayList<>(); + ActionProcessorUtils.doForAndroid(() -> foundTextLabels.forEach(lblText -> resultList.add(lblText.getText()))); + + if(resultList.isEmpty()){ + ActionProcessorUtils.doForIos(() -> { + foundTextLabels.forEach(lblText -> resultList.add(lblText.getAttribute(IosAttributes.NAME))); + resultList.remove(0); + }); + } + + return resultList; + } + + public void deleteText() { + btnClear.click(); + } + + public boolean isSearchResultEmpty() { + return lblNoResults.state().waitForDisplayed(); + } + + private List getFoundTexts() { + return getElementFactory().findElements(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(FOUND_TEXT_LOCATOR_ANDROID)), + new IosLocator(By.xpath(""))), ElementType.LABEL); + } } diff --git a/src/test/java/screens/epub/TocEpubScreen.java b/src/test/java/screens/epub/TocEpubScreen.java index 963aa48..c611e99 100644 --- a/src/test/java/screens/epub/TocEpubScreen.java +++ b/src/test/java/screens/epub/TocEpubScreen.java @@ -22,7 +22,7 @@ public class TocEpubScreen extends Screen { new AndroidLocator(By.xpath("//androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup[1]/android.widget.TextView[contains(@resource-id, \"chapterTitle\")]")), new IosLocator(By.xpath("//XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeStaticText"))), "First chapter button"); private final IButton btnBack = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("")), + new AndroidLocator(By.xpath("//android.widget.ImageButton[contains(@content-desc, \"Back\")]")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton"))), "Back button"); private static final String TOC_TAB_LOCATOR_ANDROID = "//android.widget.TextView[@text=\"%s\"]"; diff --git a/src/test/java/screens/pdf/ReaderPdfScreen.java b/src/test/java/screens/pdf/ReaderPdfScreen.java index a5ae010..07767f6 100644 --- a/src/test/java/screens/pdf/ReaderPdfScreen.java +++ b/src/test/java/screens/pdf/ReaderPdfScreen.java @@ -52,7 +52,7 @@ public boolean isReaderOpened() { public int getPageNumber() { Integer pageNumber = ActionProcessorUtils.doForIos(() -> { openNavigationBar(); - return Integer.parseInt(StringUtils.substringBetween(lblPageNumber.getAttribute(IosAttributes.NAME), "(", "/")); + return Integer.parseInt(StringUtils.substringBefore(lblPageNumber.getAttribute(IosAttributes.NAME), "/")); }); if(pageNumber == null) { diff --git a/src/test/java/screens/pdf/SearchPdfScreen.java b/src/test/java/screens/pdf/SearchPdfScreen.java index a673d91..7559565 100644 --- a/src/test/java/screens/pdf/SearchPdfScreen.java +++ b/src/test/java/screens/pdf/SearchPdfScreen.java @@ -6,6 +6,9 @@ import aquality.appium.mobile.elements.interfaces.ITextBox; import aquality.appium.mobile.screens.Screen; import constants.appattributes.IosAttributes; +import framework.utilities.ActionProcessorUtils; +import framework.utilities.KeyboardUtils; +import io.appium.java_client.android.nativekey.AndroidKey; import org.openqa.selenium.By; import java.util.List; @@ -15,9 +18,10 @@ public class SearchPdfScreen extends Screen { private final ITextBox txbSearchLine = getElementFactory().getTextBox(By.xpath("//XCUIElementTypeWindow/XCUIElementTypeOther[2]//XCUIElementTypeTextField"), "Search line"); private final IButton btnDone = getElementFactory().getButton(By.xpath("//XCUIElementTypeWindow/XCUIElementTypeOther[2]//XCUIElementTypeButton"), "Apply search"); + private final IButton returnKey = getElementFactory().getButton(By.xpath("//XCUIElementTypeButton[@name=\"Return\"]"), "Return key"); private static final String NUMBER_OF_FOUND_TEXT_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeStaticText[2]"; - private static final String FOUND_TEXT_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeStaticText[@name=\"%d\"]"; + private static final String FOUND_TEXT_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCell[%d]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText[2]"; private static final String FOUND_TEXT_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeStaticText[1]"; public SearchPdfScreen() { @@ -28,6 +32,11 @@ public void enterText(String text) { txbSearchLine.sendKeys(text); } + public void applySearch() { + ActionProcessorUtils.doForIos(returnKey::click); + ActionProcessorUtils.doForAndroid(() -> KeyboardUtils.pressKey(AndroidKey.ENTER)); + } + public String getTextFromSearchTxb() { return txbSearchLine.getText(); } diff --git a/src/test/java/screens/pdf/ThumbnailsPdfScreen.java b/src/test/java/screens/pdf/ThumbnailsPdfScreen.java index d73802b..974a351 100644 --- a/src/test/java/screens/pdf/ThumbnailsPdfScreen.java +++ b/src/test/java/screens/pdf/ThumbnailsPdfScreen.java @@ -18,7 +18,7 @@ public class ThumbnailsPdfScreen extends Screen { private static final String THUMBNAIL_NUMBER_LOCATOR_ANDROID = "//android.view.View[@content-desc=\"Thumbnail of Page %d\"]"; private static final String THUMBNAIL_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell"; - private static final String THUMBNAIL_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeStaticText"; + private static final String THUMBNAIL_NUMBER_LOCATOR_IOS = "//XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeStaticText"; public ThumbnailsPdfScreen() { super(LocatorUtils.getLocator( @@ -44,4 +44,11 @@ public int openRandomThumbnail() { thumbnail.click(); return thumbnailNumber; } + + public void openThumbnail(int thumbnailNumber) { + ILabel thumbnail = getElementFactory().getLabel(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(String.format(THUMBNAIL_NUMBER_LOCATOR_ANDROID, thumbnailNumber))), + new IosLocator(By.xpath(String.format(THUMBNAIL_NUMBER_LOCATOR_IOS, thumbnailNumber)))), "Thumbnail"); + thumbnail.click(); + } } diff --git a/src/test/java/stepdefinitions/ApplicationSteps.java b/src/test/java/stepdefinitions/ApplicationSteps.java index 48c8281..94dd8ab 100644 --- a/src/test/java/stepdefinitions/ApplicationSteps.java +++ b/src/test/java/stepdefinitions/ApplicationSteps.java @@ -68,6 +68,10 @@ public void swipeDown() { @Then("Tutorial screen is opened") public void checkTutorialScreenIsOpened() { + if(alertScreen.state().waitForDisplayed()) { + alertScreen.waitAndPerformAlertActionIfDisplayed(ActionButtonsForBooksAndAlertsKeys.ALLOW); + } + Assert.assertTrue("Tutorial screen is not opened!", tutorialScreen.isTutorialScreenOpened()); } diff --git a/src/test/java/stepdefinitions/PdfSteps.java b/src/test/java/stepdefinitions/PdfSteps.java index 2aa3edd..f113366 100644 --- a/src/test/java/stepdefinitions/PdfSteps.java +++ b/src/test/java/stepdefinitions/PdfSteps.java @@ -120,6 +120,13 @@ public void enterSearchedText(String text) { readerPdfScreen.getSearchPdfScreen().enterText(text); } + @When("Search for {string} text on search pdf screen") + public void searchText(String text) { + readerPdfScreen.getSearchPdfScreen().enterText(text); + readerPdfScreen.getSearchPdfScreen().applySearch(); + + } + @When("Open random found text and save page number as {string} on search pdf screen") public void openRandomTextAndSavePageNumber(String pageNumberKey) { context.add(pageNumberKey, readerPdfScreen.getSearchPdfScreen().openRandomFoundText()); @@ -151,6 +158,12 @@ public void openRandomThumbnail(String pageInfoKey) { context.add(pageInfoKey, tocBookmarksPdfScreen.getThumbnailsPdfScreen().openRandomThumbnail()); } + @When("Open {} thumbnail and save the number as {string} on pdf toc screen") + public void openCurrentThumbnail(int thumbnailNumber, String pageNumberKey) { + context.add(pageNumberKey, thumbnailNumber); + tocBookmarksPdfScreen.getThumbnailsPdfScreen().openThumbnail(thumbnailNumber); + } + @When("Return to pdf reader screen from pdf toc screen") public void returnToReaderFromTOC() { if (tocBookmarksPdfScreen.getThumbnailsPdfScreen().areThumbnailsDisplayed() || tocBookmarksPdfScreen.getChaptersPdfScreen().areChaptersDisplayed()) { diff --git a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java index 3c877f5..4d702fc 100644 --- a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java +++ b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java @@ -3,11 +3,13 @@ import aquality.appium.mobile.application.AqualityServices; import com.google.inject.Inject; import enums.epub.TabsTocAndBookmarksEpub; +import framework.utilities.ActionProcessorUtils; import framework.utilities.ScenarioContext; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import models.CatalogBookModel; import org.apache.commons.lang3.RandomUtils; +import org.assertj.core.api.SoftAssertions; import org.junit.Assert; import screens.epub.FontAndBackgroundSettingsEpubScreen; import screens.epub.ReaderEpubScreen; @@ -204,4 +206,67 @@ public void checkTheEnteredText(String searchedTextKey) { String actualSearchedText = readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb(); Assert.assertEquals("The field is empty!", expectedSearchedText, actualSearchedText); } + + @Then("Placeholder contains {string} text on search epub screen") + public void checkTextInSearchField(String expectedText) { + String actualText = readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb(); + Assert.assertTrue(String.format("The placeholder doesn't contain %s!", expectedText), actualText.contains(expectedText)); + } + + @When("Edit data by adding characters in search epub screen and save it as {string}") + public void editData(String newTextKey){ + readerEpubScreen.getSearchEpubScreen().deleteSomeData(); + readerEpubScreen.getSearchEpubScreen().deleteSomeData(); + readerEpubScreen.getSearchEpubScreen().inputCharacterK(); + readerEpubScreen.getSearchEpubScreen().inputCharacterK(); + readerEpubScreen.getSearchEpubScreen().inputCharacterK(); + context.add(newTextKey, readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb()); + } + + @Then("Placeholder contains word {string} text in search epub screen") + public void checkNewText(String newTextKey) { + String expectedText = context.get(newTextKey); + String actualText = readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb(); + Assert.assertEquals("Field doesn't allow to edit the data!", expectedText, actualText); + } + + @When("Search for {} and save word as {string} on search epub screen") + public void searchAWord(String word, String wordKey) { + context.add(wordKey, word); + readerEpubScreen.getSearchEpubScreen().enterText(word); + readerEpubScreen.getSearchEpubScreen().applySearch(); + } + + @Then("Search results contain word {string} on search epub screen") + public void checkSearchResults(String wordKey) { + String searchedText = context.get(wordKey); + SoftAssertions softAssertions = new SoftAssertions(); + readerEpubScreen.getSearchEpubScreen().getListOfFoundTexts().forEach(text -> softAssertions.assertThat(text.toLowerCase().contains(searchedText.toLowerCase())). + as(String.format("Found text doesn't contain word %s", searchedText)).isTrue()); + softAssertions.assertAll(); + } + + @When("Delete text in search line on search epub screen") + public void deleteTextInSearchLine() { + readerEpubScreen.getSearchEpubScreen().deleteText(); + } + + @Then("Placeholder does not contain word {string} text on search epub screen") + public void checkThatWordDoesNotExist(String searchedTextKey) { + String searchedText = context.get(searchedTextKey); + Assert.assertFalse(String.format("Searched text %s exists in search field", searchedText), readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb().contains(searchedText)); + } + + @Then("Search result is empty on search epub screen") + public void isSearchResultEmpty() { + ActionProcessorUtils.doForAndroid(() -> Assert.assertTrue("Results are not empty!", readerEpubScreen.getSearchEpubScreen().isSearchResultEmpty())); + ActionProcessorUtils.doForIos(() -> { + Assert.assertTrue("Results are not empty!", !readerEpubScreen.getSearchEpubScreen().isSearchResultEmpty() || readerEpubScreen.getSearchEpubScreen().getListOfFoundTexts().isEmpty()); + }); + } + + @When("Apply search on search epub screen") + public void apllySearch() { + readerEpubScreen.getSearchEpubScreen().applySearch(); + } } \ No newline at end of file