diff --git a/src/test/java/features/AudiobookOverdrive.feature b/src/test/java/features/AudiobookOverdrive.feature index d57b502..96fa3c1 100644 --- a/src/test/java/features/AudiobookOverdrive.feature +++ b/src/test/java/features/AudiobookOverdrive.feature @@ -17,7 +17,7 @@ Feature: Audiobooks in A1QA library When Open Catalog And Open search modal - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Open the audiobook at the last open chapter and check time code When Search for "Catching Fire" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -56,7 +56,7 @@ Feature: Audiobooks in A1QA library And Chapter name on audio player screen is equal to 'chapterNameKey2' saved chapter name And Play time is the same with 'timeAhead' play time before restart on books detail screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Navigate by Audiobook When Search for "The Hunger Games" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -82,7 +82,7 @@ Feature: Audiobooks in A1QA library Then Play button is present on audio player screen And Playback has been moved behind by 15 seconds from 'timeBehind' and 'chapterTimeKey' seconds on audio player screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Check end of chapter sleep timer When Search for "Waking the Tiger" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -102,7 +102,7 @@ Feature: Audiobooks in A1QA library And Open toc audiobook screen Then Chapter name next to 'chapterNumber' on toc audiobook screen is equal to 'nextChapter' saved chapter name - @logout @returnBooks @tier2 @exclude_android + @logout @returnBooks @palace @exclude_android Scenario: Audiobooks: Check of line for time remaining When Search for "Mockingjay" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -113,7 +113,7 @@ Feature: Audiobooks in A1QA library Then Audio player screen of book 'bookInfo' is opened And Line for time remaining is displayed on audio player screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Check of switching to the next chapter When Search for "The King's Taster" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -128,7 +128,7 @@ Feature: Audiobooks in A1QA library And Listen a chapter on audio player screen Then Next chapter play automatically and chapter name is not 'chapterName' on audio player screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Check closing playback speed and sleep timer When Search for "The Lost Symbol" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -147,7 +147,7 @@ Feature: Audiobooks in A1QA library And Close sleep timer screen Then Play button is present on audio player screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Check time tracking line When Search for "The Art of Racing in the Rain" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -169,7 +169,7 @@ Feature: Audiobooks in A1QA library And Wait for 5 seconds Then Playing time is not equal to 'timeInfo2' on audio playing screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Audiobooks: Check of not rewinding forward and back by tapping on time bar When Search for "Master and Commander" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab @@ -192,7 +192,7 @@ Feature: Audiobooks in A1QA library And Save book play time as 'timeBackward' on audio player screen Then Play times 'timeBehind' and 'timeBackward' are equals - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario Outline: Audiobooks: Playback speed: Check of playback speed When Search for "The Lightning Thief" and save bookName as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab diff --git a/src/test/java/features/BooksTransactions.feature b/src/test/java/features/BooksTransactions.feature index 2f95109..7020b61 100644 --- a/src/test/java/features/BooksTransactions.feature +++ b/src/test/java/features/BooksTransactions.feature @@ -11,40 +11,40 @@ Feature: Books transactions in Palace Bookshelf And Open search modal And Search for 'Flower Fables' and save bookName as 'bookNameInfo' - @tier2 + @palace Scenario: Check of GET button Then Check that book 'bookNameInfo' contains GET action button on catalog book screen When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then Check that book 'bookNameInfo' contains READ action button on catalog book screen And Check that book 'bookNameInfo' contains RETURN action button on catalog book screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Subcategory List View and Return from Subcategory List View (ANDROID) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click RETURN action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with GET action button and 'bookInfo' bookInfo is present on Catalog books screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book Subcategory List View and Return from Subcategory List View (IOS) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click DELETE action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with GET action button and 'bookInfo' bookInfo is present on Catalog books screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Subcategory List View and Read from Subcategory List View (ANDROID) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen And Click READ action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then 'bookInfo' book is present on epub reader screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book from Subcategory List View and Read from Subcategory List View (IOS) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen And Click READ action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then 'bookInfo' book is present on epub reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Subcategory List View and Return from Books (ANDROID) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Open Books @@ -54,7 +54,7 @@ Feature: Books transactions in Palace Bookshelf And Open Books Then EBOOK book with GET action button and 'bookInfo' bookInfo is not present on books screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book from Subcategory List View and Return from Books (IOS) When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Open Books @@ -64,7 +64,7 @@ Feature: Books transactions in Palace Bookshelf And Open Books Then EBOOK book with GET action button and 'bookInfo' bookInfo is not present on books screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Book Detail View and Return from Books (ANDROID) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen @@ -75,7 +75,7 @@ Feature: Books transactions in Palace Bookshelf And Open Books Then EBOOK book with GET action button and 'bookInfo' bookInfo is not present on books screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book from Book Detail View and Return from Books (IOS) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen @@ -86,28 +86,28 @@ Feature: Books transactions in Palace Bookshelf And Open Books Then EBOOK book with GET action button and 'bookInfo' bookInfo is not present on books screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Book Detail View and Return from Book Detail View (ANDROID) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen And Click RETURN action button on Book details screen Then Check that book contains GET action button on Book details screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book from Book Detail View and Return from Book Detail View (IOS) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen And Click DELETE action button on Book details screen Then Check that book contains GET action button on Book details screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Get a book from Book Detail View and Read from Book Detail View (ANDROID) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen And Click READ action button on Book details screen Then 'bookInfo' book is present on epub reader screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Get a book from Book Detail View and Read from Book Detail View (IOS) When Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click GET action button on Book details screen diff --git a/src/test/java/features/Distributors.feature b/src/test/java/features/Distributors.feature index eb62549..6a2cfc8 100644 --- a/src/test/java/features/Distributors.feature +++ b/src/test/java/features/Distributors.feature @@ -65,7 +65,7 @@ Feature: Distributors | Biblioboard | EBOOK | eBooks | READ | | Biblioboard | AUDIOBOOK | Audiobooks | LISTEN | - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Getting and returning a book from Book Detail View for Overdrive Given Close tutorial screen Then Welcome screen is opened @@ -95,7 +95,7 @@ Feature: Distributors And Wait for 3 seconds Then Book 'bookInfo' with EBOOK type is present on epub or pdf or audiobook screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Getting and returning an audiobook from Book Detail View for Overdrive Given Close tutorial screen Then Welcome screen is opened @@ -125,7 +125,7 @@ Feature: Distributors And Wait for 3 seconds Then Book 'bookInfo' with AUDIOBOOK type is present on epub or pdf or audiobook screen - @tier2 + @palace Scenario: Getting and returning a book from Book Detail View for Palace Bookshelf Given Close tutorial screen Then Welcome screen is opened @@ -178,7 +178,7 @@ Feature: Distributors | Biblioboard | EBOOK | eBooks | | Biblioboard | AUDIOBOOK | Audiobooks | - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Check of canceling the downloading from book details view for Overdrive Given Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/EpubOverdrive.feature b/src/test/java/features/EpubOverdrive.feature index 0e9ce76..18a683e 100644 --- a/src/test/java/features/EpubOverdrive.feature +++ b/src/test/java/features/EpubOverdrive.feature @@ -131,7 +131,7 @@ Feature: Read EPUB from Overdrive in A1QA # And Click READ action button on book details screen # Then The WHITE_TEXT_ON_BLACK background is correct - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Epub: Open book to last page read When Search for "Romeo and Juliet" 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' @@ -155,7 +155,7 @@ Feature: Read EPUB from Overdrive in A1QA Then 'bookInfo' book is present on epub reader screen And PageNumber 'pageNumberKey' is correct - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Epub: Navigate by Page When Search for "The Book Thief" 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' @@ -171,7 +171,7 @@ Feature: Read EPUB from Overdrive in A1QA And Click on left book corner on epub reader screen Then Previous page is opened and old page has 'pageNumberKey' pageNumber and 'chapterNameKey' chapterName on epub reader screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Epub: Navigate by bookmarks When Search for "Moby Dick" 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' @@ -193,7 +193,7 @@ Feature: Read EPUB from Overdrive in A1QA When Open random bookmark and save chapter name as 'chapterNameKey3' on bookmarks epub screen Then 'chapterNameKey3' chapter name is displayed on reader epub screen - @logout @returnBooks @tier2 + @logout @returnBooks @palace Scenario: Epub: Delete bookmarks When Search for "Little Women" 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' diff --git a/src/test/java/features/EpubPalace.feature b/src/test/java/features/EpubPalace.feature index 4181721..a4a725a 100644 --- a/src/test/java/features/EpubPalace.feature +++ b/src/test/java/features/EpubPalace.feature @@ -11,7 +11,7 @@ Feature: Read EPUB in Palace Bookshelf And Open search modal And Search for 'Flower Fables' and save bookName as 'bookNameInfo' - @tier2 + @palace Scenario: Navigate by Page When 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' @@ -26,7 +26,7 @@ Feature: Read EPUB in Palace Bookshelf And Click on left book corner on epub reader screen Then Previous page is opened and old page has 'pageNumberKey' pageNumber and 'chapterNameKey' chapterName on epub reader screen - @tier2 + @palace Scenario: Navigate by bookmarks When 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' @@ -47,7 +47,7 @@ Feature: Read EPUB in Palace Bookshelf When Open random bookmark and save chapter name as 'chapterNameKey3' on bookmarks epub screen Then 'chapterNameKey3' chapter name is displayed on reader epub screen - @tier2 + @palace Scenario: Delete bookmarks When 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' @@ -69,14 +69,14 @@ Feature: Read EPUB in Palace Bookshelf Then 'chapterNameKey' chapter name is displayed on reader epub screen And Bookmark is not displayed on reader epub screen - @tier2 + @palace Scenario: Navigate by Table of Contents Menu When 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 Random chapter of epub can be opened from toc epub screen - @tier2 + @palace Scenario: Navigate View options When 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' @@ -200,7 +200,7 @@ Feature: Read EPUB in Palace Bookshelf # And Click READ action button on book details screen # Then The WHITE_TEXT_ON_BLACK background is correct - @tier2 + @palace Scenario: Open book to last page read When 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' diff --git a/src/test/java/features/ManageLibraries.feature b/src/test/java/features/ManageLibraries.feature index 3c6f5b2..a031013 100644 --- a/src/test/java/features/ManageLibraries.feature +++ b/src/test/java/features/ManageLibraries.feature @@ -1,6 +1,6 @@ Feature: Manage Libraries - @tier2 + @palace Scenario: Settings: Add library: general checks When Close tutorial screen Then Welcome screen is opened @@ -15,13 +15,13 @@ Feature: Manage Libraries Then Add library screen is opened And Libraries are sorted in alphabetical order on add account screen - @tier2 + @palace Scenario: Navigate by Tutorial Then Tutorial screen is opened And Each tutorial page can be opened on Tutorial screen and close tutorial screen And Welcome screen is opened - @tier2 + @palace Scenario: Settings: Add library When Close tutorial screen Then Welcome screen is opened @@ -35,7 +35,7 @@ Feature: Manage Libraries Then Category names are loaded on Catalog screen And List of books on screen is not equal to list of books saved as 'nameOfBooks' - @tier2 + @palace Scenario: Settings: Add Library: Check of the added libraries sorting When Close tutorial screen Then Welcome screen is opened @@ -55,7 +55,7 @@ Feature: Manage Libraries When Click to 'Escondido Public Library' and save library name as 'libraryInfo' on libraries screen Then The screen with settings for 'libraryInfo' library is opened - @tier2 + @palace Scenario: Settings: Libraries: Remove library When Close tutorial screen Then Welcome screen is opened @@ -68,7 +68,7 @@ Feature: Manage Libraries And Remove 'Palace Bookshelf' library Then Library 'Palace Bookshelf' is not present on Libraries screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Switch library bookshelf (ANDROID) When Close tutorial screen Then Welcome screen is opened @@ -90,7 +90,7 @@ Feature: Manage Libraries And Open Books Then There are not books on books screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Switch library bookshelf (IOS) When Close tutorial screen Then Welcome screen is opened @@ -156,7 +156,7 @@ Feature: Manage Libraries And Click the log out button on the account screen Then Logout is performed successfully - @tier2 + @palace Scenario: Logo: Add library: Check of adding a library When Close tutorial screen Then Welcome screen is opened @@ -168,7 +168,7 @@ Feature: Manage Libraries And Add 'LYRASIS Reads' account by the logo Then Category names are loaded on Catalog screen - @tier2 + @palace Scenario: Logo: Add Library: Check of sorting libraries When Close tutorial screen Then Welcome screen is opened @@ -189,7 +189,7 @@ Feature: Manage Libraries When Tap cancel button on find your library screen Then Category names are loaded on Catalog screen - @tier2 + @palace Scenario: Logo: Switch library When Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/MyBooks.feature b/src/test/java/features/MyBooks.feature index d6940aa..7e4fc8b 100644 --- a/src/test/java/features/MyBooks.feature +++ b/src/test/java/features/MyBooks.feature @@ -19,7 +19,7 @@ Feature: My books module And Open Books Then Added books from 'listOfBooks' are displayed on books screen - @tier2 + @palace Scenario: Check of sorting in Palace Bookshelf When Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/PdfLyrasisIos.feature b/src/test/java/features/PdfLyrasisIos.feature index b9581c7..d026f2d 100644 --- a/src/test/java/features/PdfLyrasisIos.feature +++ b/src/test/java/features/PdfLyrasisIos.feature @@ -9,7 +9,8 @@ Feature: Read PDF in LYRARIS Reads on IOS Then Library "LYRASIS Reads" is opened on Libraries screen When Enter credentials for 'LYRASIS Reads' library Then Login is performed successfully - When Open Catalog + When Activate sync bookmarks on Sign in screen + And Open Catalog @logout @returnBooks @tier1 @exclude_android Scenario: Open book to last page read Lyrasis @@ -149,4 +150,49 @@ Feature: Read PDF in LYRARIS Reads on IOS | data | | cat | | CAT | - | CaT | \ No newline at end of file + | CaT | + + @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 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' + And Click READ action button on Book details screen + Then Reader pdf screen is opened + When Save page number as 'pageInfo' on pdf reader screen + And Go to next page on reader pdf screen + Then Page number increased by 1 from 'pageInfo' on pdf reader screen + When Save page number as 'pageInfo2' on pdf reader screen + And Go to previous page on reader pdf screen + Then Page number decreased by 1 from 'pageInfo2' on pdf reader screen + + @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 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' + And Click READ action button on Book details screen + Then Reader pdf screen is opened + When Open search pdf screen + And Enter 'try' text and save it as 'searchedText' on search pdf screen + Then The field allows to enter characters and contains 'searchedText' on search pdf screen + When Delete text in search line on search pdf screen + Then Search field is empty on search pdf screen + + @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 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' + And Click READ action button on Book details screen + Then Reader pdf screen is opened + When Open search pdf screen + And Enter '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 \ No newline at end of file diff --git a/src/test/java/features/PdfPalaceAndroid.feature b/src/test/java/features/PdfPalaceAndroid.feature index dd259a5..0222d0b 100644 --- a/src/test/java/features/PdfPalaceAndroid.feature +++ b/src/test/java/features/PdfPalaceAndroid.feature @@ -11,7 +11,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Open search modal And Search for 'Pharo by Example 5.0' and save bookName as 'bookNameInfo' - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Check of book title and back button Palace When 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 @@ -22,7 +22,7 @@ Feature: Read PDF in Palace Bookshelf on Android When Close pdf reader by back button Then Book "bookInfo" is opened on book details screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Check table of contents Palace When 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 @@ -40,7 +40,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Close pdf toc screen by back button Then PDF toc screen is closed - @tier2 @exclude_ios + @palace @exclude_ios Scenario: TOC: Contents with thumbnails: Check of Contents list and navigation Palace When 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 @@ -54,7 +54,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Return to pdf reader screen from pdf toc screen Then Page number is equal to 'pageInfo' on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: TOC: Contents with text: Check of list of chapters and navigation Palace When 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 @@ -68,7 +68,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Return to pdf reader screen from pdf toc screen Then Page number is equal to 'pageInfo' on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Check of settings screen and page navigation Palace When 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 @@ -86,7 +86,7 @@ Feature: Read PDF in Palace Bookshelf on Android When Tap Go to first page button on pdf settings screen Then The first page is opened on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Settings: Check of Vertical scrolling Palace When 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 @@ -106,7 +106,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Scroll page up on pdf reader screen Then Page number is not equal to 'pageInfo2' on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Settings: Check of Horizontal scrolling Palace When 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 @@ -126,7 +126,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Go to previous page on reader pdf screen Then Page number is not equal to 'pageInfo2' on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Settings: Check of Wrapped scrolling Palace When 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 @@ -146,7 +146,7 @@ Feature: Read PDF in Palace Bookshelf on Android And Go to previous page on reader pdf screen Then Page number is not equal to 'pageInfo2' on pdf reader screen - @tier2 @exclude_ios + @palace @exclude_ios Scenario: Open book to last page read Palace When 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 diff --git a/src/test/java/features/PdfPalaceIos.feature b/src/test/java/features/PdfPalaceIos.feature index 7698f1f..14d107c 100644 --- a/src/test/java/features/PdfPalaceIos.feature +++ b/src/test/java/features/PdfPalaceIos.feature @@ -16,7 +16,7 @@ Feature: Read PDF in Palace Bookshelf on IOS And Click READ action button on Book details screen Then Reader pdf screen is opened - @tier2 @exclude_android + @palace @exclude_android Scenario: Navigate by Page Then Save page number as 'pageInfo' on pdf reader screen When Go to next page on reader pdf screen @@ -25,7 +25,7 @@ Feature: Read PDF in Palace Bookshelf on IOS And Go to previous page on reader pdf screen Then Page number decreased by 1 from 'pageInfo2' on pdf reader screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Open book to last page read When Swipe pdf page forward from 4 to 6 times on reader pdf screen And Save page number as 'pageNumber' on pdf reader screen @@ -41,14 +41,14 @@ Feature: Read PDF in Palace Bookshelf on IOS Then Reader pdf screen is opened And Page number is equal to 'pageNumber' on pdf reader screen - @tier2 @exclude_android + @palace @exclude_android 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 Then Page number is equal to 'pageInfo' on pdf reader screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Search Pdf Functionality When Open search pdf screen Then Search pdf screen is opened @@ -63,14 +63,14 @@ Feature: Read PDF in Palace Bookshelf on IOS Then Found lines should contain 'try' in themselves on search pdf screen When Close pdf search screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Navigate by Pdf Search Results When Open search pdf screen And Enter '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 - @tier2 @exclude_android + @palace @exclude_android Scenario: Navigate by Page slider When Save page number as 'pageNumber' on pdf reader screen And Slide page slider RIGHT on reader pdf screen @@ -79,7 +79,7 @@ Feature: Read PDF in Palace Bookshelf on IOS And Slide page slider LEFT on reader pdf screen Then The 'pageNumber' saved page number is greater than the current page number on the reader pdf screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Navigate by pdf bookmarks When Open bookmarks pdf screen Then Bookmarks pdf screen is opened @@ -101,7 +101,7 @@ Feature: Read PDF in Palace Bookshelf on IOS When Open the 0 bookmark on bookmarks pdf screen Then Page number is equal to 'pageNumberInfo' on pdf reader screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Check table of contents When Open TOC on pdf reader screen And Open text chapter content on pdf toc screen @@ -109,7 +109,7 @@ Feature: Read PDF in Palace Bookshelf on IOS When Open content with thumbnails on pdf toc screen Then Thumbnails of the book pages are displayed - @tier2 @exclude_android + @palace @exclude_android Scenario: Navigate by Chapters When Open TOC on pdf reader screen And Open text chapter content on pdf toc screen diff --git a/src/test/java/features/Samples.feature b/src/test/java/features/Samples.feature index d2e4b55..1864480 100644 --- a/src/test/java/features/Samples.feature +++ b/src/test/java/features/Samples.feature @@ -1,6 +1,6 @@ Feature: Check of View Sample - @tier2 @exclude_android + @palace @exclude_android Scenario: Palace Marketplace: Check of view sample When Close tutorial screen Then Welcome screen is opened @@ -21,7 +21,7 @@ Feature: Check of View Sample And Return to previous screen from epub Then Book 'bookInfo' is opened on book details screen - @tier2 @exclude_android + @palace @exclude_android Scenario: Overdrive: Check of view sample in epub When Close tutorial screen Then Welcome screen is opened @@ -42,7 +42,7 @@ Feature: Check of View Sample And Click VIEW_SAMPLE action button on Book details screen Then Reader epub screen is opened - @tier2 @exclude_android + @palace @exclude_android Scenario: Overdrive: Check of view sample in audiobook When Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/Search.feature b/src/test/java/features/Search.feature index a88e129..f849f21 100644 --- a/src/test/java/features/Search.feature +++ b/src/test/java/features/Search.feature @@ -223,7 +223,7 @@ Feature: Search module Then Catalog screen is opened And Category names are loaded on Catalog screen When Open search modal - And Search 'available' book of distributor 'Bibliotheca' and bookType 'EBOOK' and save as 'bookNameInfo' + And Search for "An Open Web" and save bookName as 'bookNameInfo' Then EBOOK book with GET action button and 'bookNameInfo' bookName is displayed on Catalog books screen @smoke diff --git a/src/test/java/features/Settings.feature b/src/test/java/features/Settings.feature index fdd44c5..0ed06e8 100644 --- a/src/test/java/features/Settings.feature +++ b/src/test/java/features/Settings.feature @@ -1,6 +1,6 @@ Feature: Check sections from settings screen - @tier2 @exclude_android + @palace @exclude_android Scenario: About Palace When Close tutorial screen Then Welcome screen is opened @@ -11,7 +11,7 @@ Feature: Check sections from settings screen And Open About Palace on settings screen Then About Palace screen is opened - @tier2 + @palace Scenario: Privacy Policy When Close tutorial screen Then Welcome screen is opened @@ -22,7 +22,7 @@ Feature: Check sections from settings screen And Open Privacy Policy on settings screen Then Privacy Policy screen is opened - @tier2 + @palace Scenario: User Agreement When Close tutorial screen Then Welcome screen is opened @@ -37,7 +37,7 @@ Feature: Check sections from settings screen When Scroll page to link "http://thepalaceproject.org/licenses/" on user agreement screen Then Link "http://thepalaceproject.org/licenses/" is available on user agreement screen - @tier2 + @palace Scenario: Software Licenses When Close tutorial screen Then Welcome screen is opened @@ -50,7 +50,7 @@ Feature: Check sections from settings screen When Scroll page to link "www.apache.org/licenses" on software licenses screen Then Link "www.apache.org/licenses" is available on software licenses screen - @tier2 + @palace Scenario: Settings: User License Agreement When Close tutorial screen Then Welcome screen is opened @@ -63,7 +63,7 @@ Feature: Check sections from settings screen And Open User license agreement on account screen Then User License Agreement link is opened - @logout @tier1 @exclude_android + @logout @palace @exclude_android Scenario: Setting: Advanced When Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/smoke/Lyrasis.feature b/src/test/java/features/smoke/Lyrasis.feature deleted file mode 100644 index a299288..0000000 --- a/src/test/java/features/smoke/Lyrasis.feature +++ /dev/null @@ -1,85 +0,0 @@ -Feature: Smoke tests in LYRASIS Reads library - - - - @smoke @logout @returnBooks @exclude_android - Scenario: IOS: Read pdfs: Pages: Perform check of reader navigating (swiping left and right) - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "LYRASIS Reads" on Add library screen - Then Library "LYRASIS Reads" is opened on Libraries screen - When Enter credentials for 'LYRASIS Reads' library - Then Login is performed successfully - When Activate sync bookmarks on Sign in screen - And Open Catalog - And Open search modal - And Search for "Race Cars" 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' - And Click READ action button on Book details screen - Then Reader pdf screen is opened - When Save page number as 'pageInfo' on pdf reader screen - And Go to next page on reader pdf screen - Then Page number increased by 1 from 'pageInfo' on pdf reader screen - When Save page number as 'pageInfo2' on pdf reader screen - And Go to previous page on reader pdf screen - Then Page number decreased by 1 from 'pageInfo2' on pdf reader screen - - - - @smoke @logout @returnBooks @exclude_android - Scenario: iOS: Read pdfs: Search: Perform check that the field allows you to enter characters and delete them - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "LYRASIS Reads" on Add library screen - Then Library "LYRASIS Reads" is opened on Libraries screen - When Enter credentials for 'LYRASIS Reads' library - Then Login is performed successfully - When Activate sync bookmarks on Sign in screen - And Open Catalog - And Open search modal - And Search for "Race Cars" 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' - And Click READ action button on Book details screen - Then Reader pdf screen is opened - When Open search pdf screen - And Enter 'try' text and save it as 'searchedText' on search pdf screen - Then The field allows to enter characters and contains 'searchedText' on search pdf screen - When Delete text in search line on search pdf screen - Then Search field is empty on search pdf screen - - @smoke @logout @returnBooks @exclude_android - Scenario: iOS: Read pdfs: Search: Perform check of finding a word in the book - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "LYRASIS Reads" on Add library screen - Then Library "LYRASIS Reads" is opened on Libraries screen - When Enter credentials for 'LYRASIS Reads' library - Then Login is performed successfully - When Activate sync bookmarks on Sign in screen - And Open Catalog - And Open search modal - And Search for "Race Cars" 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' - And Click READ action button on Book details screen - Then Reader pdf screen is opened - When Open search pdf screen - And Enter '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/features/test/test.feature b/src/test/java/features/test/test.feature deleted file mode 100644 index a8201f7..0000000 --- a/src/test/java/features/test/test.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: test for Aquality - - @aquality - Scenario: Check the possibility of editing data in search field - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "LYRASIS Reads" on Add library screen - And Open search modal - And Type text "Book" and save it as 'word' - And Edit data by adding characters in search field and save it as 'newWord' - Then Placeholder contains word 'newWord' text in search field \ No newline at end of file diff --git a/src/test/java/framework/utilities/ActionProcessorUtils.java b/src/test/java/framework/utilities/ActionProcessorUtils.java index 21becd6..f6d8b48 100644 --- a/src/test/java/framework/utilities/ActionProcessorUtils.java +++ b/src/test/java/framework/utilities/ActionProcessorUtils.java @@ -3,6 +3,9 @@ import aquality.appium.mobile.application.AqualityServices; import aquality.appium.mobile.application.PlatformName; +import java.util.function.BooleanSupplier; +import java.util.function.Supplier; + public class ActionProcessorUtils { private static final PlatformName PLATFORM_NAME = AqualityServices.getApplication().getPlatformName(); @@ -13,6 +16,20 @@ private static void doForPlatform(PlatformName platformName, Runnable action) { } } + private static T doForPlatform(PlatformName platformName, Supplier action) { + if(PLATFORM_NAME.equals(platformName)) { + return action.get(); + } + return null; + } + + private static boolean doForPlatform(PlatformName platformName, BooleanSupplier action) { + if(PLATFORM_NAME.equals(platformName)) { + return action.getAsBoolean(); + } + return false; + } + public static void doForAndroid(Runnable action){ doForPlatform(PlatformName.ANDROID, action); } @@ -20,4 +37,20 @@ public static void doForAndroid(Runnable action){ public static void doForIos(Runnable action) { doForPlatform(PlatformName.IOS, action); } -} + + public static T doForAndroid(Supplier action) { + return doForPlatform(PlatformName.ANDROID, action); + } + + public static T doForIos(Supplier action) { + return doForPlatform(PlatformName.IOS, action); + } + + public static boolean doForAndroid(BooleanSupplier action) { + return doForPlatform(PlatformName.ANDROID, action); + } + + public static boolean doForIos(BooleanSupplier action) { + return doForPlatform(PlatformName.IOS, action); + } +} \ No newline at end of file diff --git a/src/test/java/framework/utilities/Logger.java b/src/test/java/framework/utilities/Logger.java index 661c984..2244b24 100644 --- a/src/test/java/framework/utilities/Logger.java +++ b/src/test/java/framework/utilities/Logger.java @@ -39,7 +39,13 @@ public void createAppender(String name) { public byte[] getLoggerInfoBytes() { byte[] data = new byte[0]; try { - data = Files.readAllBytes(Paths.get(scenarioAppender.getFile())); + String filePath = scenarioAppender.getFile(); + if(filePath != null) { + filePath = filePath.replace(":", "_"); + data = Files.readAllBytes(Paths.get(filePath)); + } else { + AqualityServices.getLogger().error("File path is null"); + } } catch (IOException exception) { AqualityServices.getLogger().error(exception.toString()); } diff --git a/src/test/java/runners/TestRunner.java b/src/test/java/runners/TestRunner.java index 4827afe..a9715d0 100644 --- a/src/test/java/runners/TestRunner.java +++ b/src/test/java/runners/TestRunner.java @@ -18,7 +18,7 @@ plugin = { "io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm" }, - tags = "@report" + tags = "@settings" ) public class TestRunner { @@ -26,9 +26,9 @@ public class TestRunner { @BeforeClass public static void setup() { AqualityServices.getLogger().info("Start getting books"); -// XMLUtil xmlUtil = new XMLUtil(); -// GettingBookUtil.setXmlUtil(xmlUtil); -// GettingBookUtil.printDistributorsInfo(); + XMLUtil xmlUtil = new XMLUtil(); + GettingBookUtil.setXmlUtil(xmlUtil); + GettingBookUtil.printDistributorsInfo(); AqualityServices.getLogger().info("end getting books"); } } diff --git a/src/test/java/screens/AboutPalaceScreen.java b/src/test/java/screens/AboutPalaceScreen.java index e0425e9..ff443f7 100644 --- a/src/test/java/screens/AboutPalaceScreen.java +++ b/src/test/java/screens/AboutPalaceScreen.java @@ -22,4 +22,4 @@ public AboutPalaceScreen() { public boolean isOpened() { return lblAboutPalace.state().waitForDisplayed(); } -} +} \ No newline at end of file diff --git a/src/test/java/screens/AccountScreen.java b/src/test/java/screens/AccountScreen.java index d6ed9bf..3a7e51d 100644 --- a/src/test/java/screens/AccountScreen.java +++ b/src/test/java/screens/AccountScreen.java @@ -1,7 +1,6 @@ package screens; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.elements.interfaces.ILink; @@ -101,15 +100,19 @@ public void tapSignIn() { } public boolean isSignInSuccessful() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { + boolean isSignInSuccessful = ActionProcessorUtils.doForAndroid(() -> { lblLoading.state().waitForDisplayed(); lblLoading.state().waitForNotDisplayed(); AqualityServices.getConditionalWait().waitFor(() -> btnSignOut.state().isDisplayed() || btnSignInError.state().isDisplayed(), Duration.ofMillis(BooksTimeouts.TIMEOUT_BOOK_CHANGES_STATUS.getTimeoutMillis())); return getLoginButtonText().equals(AccountScreenSignInStatus.SIGN_OUT.getDefaultLocalizedValue()); - } else { - return btnSignOut.state().isDisplayed(); + }); + + if(!isSignInSuccessful) { + isSignInSuccessful = ActionProcessorUtils.doForIos(() -> btnSignOut.state().isDisplayed()); } + + return isSignInSuccessful; } private String getLoginButtonText() { @@ -202,4 +205,4 @@ public void clickDelete(String button) { public boolean isLogoutSuccessful() { return AqualityServices.getConditionalWait().waitFor(() -> btnSignIn.state().isDisplayed()); } -} +} \ No newline at end of file diff --git a/src/test/java/screens/AddLibraryScreen.java b/src/test/java/screens/AddLibraryScreen.java index c532e6c..acc94fd 100644 --- a/src/test/java/screens/AddLibraryScreen.java +++ b/src/test/java/screens/AddLibraryScreen.java @@ -1,6 +1,5 @@ package screens; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.IElement; @@ -11,7 +10,6 @@ import framework.utilities.ActionProcessorUtils; import framework.utilities.KeyboardUtils; import framework.utilities.LocatorUtils; -import framework.utilities.PlatformUtils; import models.AndroidLocator; import models.IosLocator; import org.openqa.selenium.By; @@ -81,11 +79,12 @@ public void clearSearchField(){ } public boolean isSearchFieldEmpty() { - if(PlatformUtils.getPlatformName() == PlatformName.ANDROID) { - return txbSearchField.getText().equals("Search accounts…"); - } else { - return txbSearchField.getText().isEmpty(); + boolean isEmpty = ActionProcessorUtils.doForAndroid(() -> txbSearchField.getText().equals("Search accounts…")); + + if(!isEmpty) { + isEmpty = ActionProcessorUtils.doForIos(() -> txbSearchField.getText().isEmpty()); } + return isEmpty; } public boolean isLibraryDisplayed(String libraryName) { @@ -122,4 +121,4 @@ private List getLibrariesNames() { libraries.forEach(library -> names.add(library.getText().toLowerCase())); return names; } -} +} \ No newline at end of file diff --git a/src/test/java/screens/AlertScreen.java b/src/test/java/screens/AlertScreen.java index 282b084..e150d5b 100644 --- a/src/test/java/screens/AlertScreen.java +++ b/src/test/java/screens/AlertScreen.java @@ -51,4 +51,4 @@ public String getTextFromAlertButton(ActionButtonsForBooksAndAlertsKeys actionBu IButton actionButton = getElementFactory().getButton(By.xpath(String.format(ACTION_BUTTON_LOCATOR_IOS, actionButtonKey.getDefaultLocalizedValue())), String.format("%s button alert", actionButtonKey.getDefaultLocalizedValue())); return actionButton.getText(); } -} +} \ No newline at end of file diff --git a/src/test/java/screens/BookDetailsScreen.java b/src/test/java/screens/BookDetailsScreen.java index 90fe29a..6846315 100644 --- a/src/test/java/screens/BookDetailsScreen.java +++ b/src/test/java/screens/BookDetailsScreen.java @@ -1,7 +1,6 @@ package screens; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; @@ -9,6 +8,7 @@ import constants.appattributes.IosAttributes; import enums.localization.catalog.ActionButtonsForBooksAndAlertsKeys; import enums.timeouts.BooksTimeouts; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import models.AndroidLocator; import models.CatalogBookModel; @@ -124,28 +124,35 @@ public boolean isCategoryInfoExist() { } public String getPublisherInfo() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return lblPublisherInfo.getAttribute(IosAttributes.NAME); - } else { - return lblPublisherInfo.getText(); + String publisherInfo = ActionProcessorUtils.doForIos(() -> lblPublisherInfo.getAttribute(IosAttributes.NAME)); + + if(publisherInfo == null) { + publisherInfo = ActionProcessorUtils.doForAndroid(lblPublisherInfo::getText); } + + return publisherInfo; } public String getCategoryInfo() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return lblCategories.getAttribute(IosAttributes.NAME); - } else { - lblCategories.state().waitForDisplayed(); - return lblCategories.getText(); + String categoryInfo = ActionProcessorUtils.doForIos(() -> lblCategories.getAttribute(IosAttributes.NAME)); + + if(categoryInfo == null) { + categoryInfo = ActionProcessorUtils.doForAndroid(() -> { + lblCategories.state().waitForDisplayed(); + return lblCategories.getText(); + }); } + return categoryInfo; } public String getDistributorInfo() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return lblDistributor.getAttribute(IosAttributes.NAME); - } else { - return lblDistributor.getText(); + String distributorInfo = ActionProcessorUtils.doForIos(() -> lblDistributor.getAttribute(IosAttributes.NAME)); + + if(distributorInfo == null) { + distributorInfo = ActionProcessorUtils.doForAndroid(lblDistributor::getText); } + + return distributorInfo; } public boolean isRelatedBooksExists(String authorName) { diff --git a/src/test/java/screens/CatalogBooksScreen.java b/src/test/java/screens/CatalogBooksScreen.java index 6c9ecd2..e0a4470 100644 --- a/src/test/java/screens/CatalogBooksScreen.java +++ b/src/test/java/screens/CatalogBooksScreen.java @@ -10,6 +10,7 @@ import enums.BookType; import enums.localization.catalog.ActionButtonsForBooksAndAlertsKeys; import enums.timeouts.BooksTimeouts; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import framework.utilities.PlatformUtils; import models.AndroidLocator; @@ -93,7 +94,7 @@ public boolean isNoResults() { public CatalogBookModel openBookAndGetBookInfo(BookType bookType, String bookName, ActionButtonsForBooksAndAlertsKeys actionButtonKey) { String bookNameForLocator = bookName; - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS && BookType.AUDIOBOOK == bookType) { + if (PlatformUtils.getPlatformName() == PlatformName.IOS && BookType.AUDIOBOOK == bookType) { bookNameForLocator = bookNameForLocator + ". Audiobook."; } @@ -215,13 +216,15 @@ public CatalogBookModel clickActionButtonOnTheFirstBookAndGetBookInfo(BookType b CatalogBookModel bookInfo = new CatalogBookModel(); - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + ActionProcessorUtils.doForIos(() -> { bookInfo.setTitle(lblBookName.getAttribute(IosAttributes.NAME)) .setAuthor(author); - } else { + }); + + ActionProcessorUtils.doForAndroid(() -> { bookInfo.setTitle(lblBookName.getText()) .setAuthor(author); - } + }); actionButton.click(); if (actionButtonKey == ActionButtonsForBooksAndAlertsKeys.GET || actionButtonKey == ActionButtonsForBooksAndAlertsKeys.REMOVE @@ -238,4 +241,4 @@ private IButton getActionButton(String bookName, ActionButtonsForBooksAndAlertsK new AndroidLocator(By.xpath(String.format(BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_ANDROID, bookName, key))), new IosLocator(By.xpath(String.format(BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_IOS, bookName, key)))), key); } -} +} \ No newline at end of file diff --git a/src/test/java/screens/CatalogScreen.java b/src/test/java/screens/CatalogScreen.java index 1ea6ea5..e6200a7 100644 --- a/src/test/java/screens/CatalogScreen.java +++ b/src/test/java/screens/CatalogScreen.java @@ -2,7 +2,6 @@ import aquality.appium.mobile.actions.SwipeDirection; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.Attributes; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; @@ -12,11 +11,11 @@ import aquality.selenium.core.elements.ElementState; import aquality.selenium.core.elements.ElementsCount; import constants.appattributes.IosAttributes; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import framework.utilities.swipe.SwipeElementUtils; import models.AndroidLocator; import models.IosLocator; -import org.apache.commons.lang3.StringUtils; import org.openqa.selenium.By; import java.util.HashSet; @@ -95,19 +94,25 @@ public Set getListOfBooksNameInFirstCategory() { } public List getListOfBooksNames() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { + List listOfBookNames = ActionProcessorUtils.doForAndroid(() -> { List listOfBooks = getElementFactory().findElements(By.xpath(BOOK_NAME_LOCATOR_ANDROID), ElementType.LABEL); return listOfBooks.stream().map(book -> book.getText()).collect(Collectors.toList()); - } else { - state().waitForDisplayed(); - int countOfItems = getElements(By.xpath(BOOK_NAME_LOCATOR_IOS)).size(); - AqualityServices.getConditionalWait().waitFor(() -> getElements(By.xpath(BOOK_NAME_LOCATOR_IOS)).size() <= countOfItems); - List listOfNames = getValuesFromListOfLabels(By.xpath(BOOK_NAME_LOCATOR_IOS)); - AqualityServices.getLogger().info("Found list of books from all subcategories on screen - " + listOfNames.stream().map(Object::toString) - .collect(Collectors.joining(", "))); - AqualityServices.getLogger().info("amount of books from all subcategories on screen - " + listOfNames.size()); - return listOfNames; + }); + + if(listOfBookNames == null) { + listOfBookNames = ActionProcessorUtils.doForIos(() -> { + state().waitForDisplayed(); + int countOfItems = getElements(By.xpath(BOOK_NAME_LOCATOR_IOS)).size(); + AqualityServices.getConditionalWait().waitFor(() -> getElements(By.xpath(BOOK_NAME_LOCATOR_IOS)).size() <= countOfItems); + List listOfNames = getValuesFromListOfLabels(By.xpath(BOOK_NAME_LOCATOR_IOS)); + AqualityServices.getLogger().info("Found list of books from all subcategories on screen - " + listOfNames.stream().map(Object::toString) + .collect(Collectors.joining(", "))); + AqualityServices.getLogger().info("amount of books from all subcategories on screen - " + listOfNames.size()); + return listOfNames; + }); } + + return listOfBookNames; } public void openCategory(String categoryName) { @@ -137,30 +142,18 @@ public boolean areCategoryNamesDisplayed() { public boolean isMoreBtnPresent() { List buttons = getMoreBtn(); - IButton btn = getElementFactory().getButton(By.xpath(MORE_BUTTON_LOCATOR_IOS), "sdfs"); - System.out.println("exist: " + btn.state().isExist()); - System.out.println("Enabled:" + btn.state().isEnabled()); - - System.out.println("step with assert:" + buttons.size()); - return buttons.stream().allMatch(button -> button.state().waitForDisplayed()); } public String clickToMoreBtn() { List buttons = getMoreBtn(); - System.out.println("btn: " + buttons.size()); - int randomNumber = 1 + (int) (Math.random() * buttons.size()); String sectionName = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath(String.format(CURRENT_SECTION_LOCATOR_IN_CATALOG_ANDROID, randomNumber))), new IosLocator(By.xpath(String.format(CURRENT_SECTION_LOCATOR_IN_CATALOG_IOS, randomNumber)))), "Book section name").getText(); buttons.get(randomNumber - 1).click(); - - - System.out.println(StringUtils.substringAfter(sectionName, "More")); - return sectionName; } @@ -190,11 +183,13 @@ public String getTheNameOfBookTypeBtn(String typeOfBookNameBtn) { public boolean isSectionWithBookTypeOpen(String typeSection) { IButton btnSectionType = btnBookNameTypeSection.createBtn(typeSection); - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return btnSectionType.getAttribute(Attributes.VALUE).equals("1"); - } else { - return btnSectionType.getAttribute(Attributes.CHECKED).equals(Boolean.TRUE.toString()); + boolean isOpened = ActionProcessorUtils.doForIos(() -> btnSectionType.getAttribute(Attributes.VALUE).equals("1")); + + if(!isOpened) { + isOpened = ActionProcessorUtils.doForAndroid(() -> btnSectionType.getAttribute(Attributes.CHECKED).equals(Boolean.TRUE.toString())); } + + return isOpened; } public void switchToCatalogTab(String catalogTab) { diff --git a/src/test/java/screens/LibrariesScreen.java b/src/test/java/screens/LibrariesScreen.java index d3e673f..66064bf 100644 --- a/src/test/java/screens/LibrariesScreen.java +++ b/src/test/java/screens/LibrariesScreen.java @@ -1,7 +1,6 @@ package screens; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; @@ -73,13 +72,17 @@ public boolean isAddLibraryBtnDisplayed() { } public boolean isLibrariesAreSorted() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + boolean areSorted = ActionProcessorUtils.doForIos(() -> { List libraries = getLibrariesNames(); libraries.remove(0); return Ordering.natural().isOrdered(libraries); - } else { - return Ordering.natural().isOrdered(getLibrariesNames()); + }); + + if(!areSorted) { + areSorted = ActionProcessorUtils.doForAndroid(() -> Ordering.natural().isOrdered(getLibrariesNames())); } + + return areSorted; } public boolean isLibrarySettingsOpened(String libraryName) { diff --git a/src/test/java/screens/TutorialScreen.java b/src/test/java/screens/TutorialScreen.java index c0ecabe..bb658a8 100644 --- a/src/test/java/screens/TutorialScreen.java +++ b/src/test/java/screens/TutorialScreen.java @@ -1,7 +1,5 @@ package screens; -import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; @@ -10,6 +8,7 @@ import aquality.selenium.core.elements.ElementsCount; import constants.appattributes.AndroidAttributes; import constants.appattributes.IosAttributes; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import framework.utilities.swipe.SwipeElementUtils; import framework.utilities.swipe.directions.EntireElementSwipeDirection; @@ -61,11 +60,13 @@ public void goToNextPage() { } public List getListOfPageNames() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { - return getListOfLabelsOfTutorialTabs().stream().map(tab -> tab.getAttribute(AndroidAttributes.CONTENT_DESC)).collect(Collectors.toList()); - } else { - return getListOfLabelsOfTutorialTabs().stream().map(tab -> tab.getAttribute(IosAttributes.NAME)).collect(Collectors.toList()); + List listOfPageNames = ActionProcessorUtils.doForAndroid(() -> getListOfLabelsOfTutorialTabs().stream().map(tab -> tab.getAttribute(AndroidAttributes.CONTENT_DESC)).collect(Collectors.toList())); + + if(listOfPageNames == null) { + listOfPageNames = ActionProcessorUtils.doForIos(() -> getListOfLabelsOfTutorialTabs().stream().map(tab -> tab.getAttribute(IosAttributes.NAME)).collect(Collectors.toList())); } + + return listOfPageNames; } private List getListOfLabelsOfTutorialTabs() { diff --git a/src/test/java/screens/audiobook/AudioPlayerScreen.java b/src/test/java/screens/audiobook/AudioPlayerScreen.java index b46eb6e..0ce79d4 100644 --- a/src/test/java/screens/audiobook/AudioPlayerScreen.java +++ b/src/test/java/screens/audiobook/AudioPlayerScreen.java @@ -1,13 +1,13 @@ package screens.audiobook; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.screens.Screen; import aquality.selenium.core.elements.ElementState; import constants.appattributes.IosAttributes; import enums.localization.catalog.TimerKeys; +import framework.utilities.ActionProcessorUtils; import framework.utilities.DateUtils; import framework.utilities.LocatorUtils; import io.appium.java_client.TouchAction; @@ -129,11 +129,13 @@ public boolean isPlayButtonPresent() { } public Duration getLeftTime() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { - return DateUtils.getDuration(lblLeftTime.getText()); - } else { - return DateUtils.getDuration(lblLeftTime.getAttribute(IosAttributes.VALUE)); + Duration leftTime = ActionProcessorUtils.doForAndroid(() -> DateUtils.getDuration(lblLeftTime.getText())); + + if(leftTime == null) { + leftTime = ActionProcessorUtils.doForIos(() -> DateUtils.getDuration(lblLeftTime.getAttribute(IosAttributes.VALUE))); } + + return leftTime; } public boolean isAudiobookNamePresent(String audiobookName) { @@ -147,11 +149,13 @@ public void openToc() { } public String getChapterName() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return lblChapterName.getAttribute(IosAttributes.VALUE); - } else { - return lblChapterName.getText(); + String chapterName = ActionProcessorUtils.doForIos(() -> lblChapterName.getAttribute(IosAttributes.VALUE)); + + if(chapterName == null) { + chapterName = ActionProcessorUtils.doForAndroid(lblChapterName::getText); } + + return chapterName; } public void openPlaybackSpeed() { @@ -163,11 +167,13 @@ public PlaybackSpeedScreen getPlaybackSpeedAudiobookScreen() { } public Duration getRightTime() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return DateUtils.getDuration(lblRightTime.getAttribute(IosAttributes.VALUE)); - } else { - return DateUtils.getDuration(lblRightTime.getText()); + Duration rightTime = ActionProcessorUtils.doForIos(() -> DateUtils.getDuration(lblRightTime.getAttribute(IosAttributes.VALUE))); + + if(rightTime == null) { + rightTime = ActionProcessorUtils.doForAndroid(() -> DateUtils.getDuration(lblRightTime.getText())); } + + return rightTime; } public void skipAhead() { @@ -240,12 +246,17 @@ public void tapOnPlayBarBackward() { } public boolean isPlaybackSpeedPresent(String playbackSpeed) { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + boolean isPresent = ActionProcessorUtils.doForIos(() -> { String speedOptionName = speedNameIos.get(playbackSpeed); return getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_LOC_IOS, speedOptionName)), speedOptionName).state().waitForDisplayed(); - }else { - return getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_LOC_ANDROID, playbackSpeed)), "Playback speed").state().waitForDisplayed(); + }); + + if(!isPresent) { + isPresent = ActionProcessorUtils.doForAndroid(() -> + getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_LOC_ANDROID, playbackSpeed)), "Playback speed").state().waitForDisplayed()); } + + return isPresent; } public void tapBookmarkIcon() { diff --git a/src/test/java/screens/audiobook/BookmarksAudiobookScreen.java b/src/test/java/screens/audiobook/BookmarksAudiobookScreen.java index 7a11cc6..9932a2e 100644 --- a/src/test/java/screens/audiobook/BookmarksAudiobookScreen.java +++ b/src/test/java/screens/audiobook/BookmarksAudiobookScreen.java @@ -1,12 +1,11 @@ package screens.audiobook; -import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.screens.Screen; import constants.appattributes.AndroidAttributes; import constants.appattributes.IosAttributes; +import framework.utilities.ActionProcessorUtils; import framework.utilities.DateUtils; import framework.utilities.LocatorUtils; import models.AndroidLocator; @@ -35,11 +34,14 @@ public BookmarksAudiobookScreen() { } public boolean isBookmarksScreenSelected() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { - return btnBookmarks.getAttribute(AndroidAttributes.SELECTED).equals(Boolean.TRUE.toString()); - }else { - return lblNoBookmarks.state().waitForDisplayed(); + boolean isSelected = ActionProcessorUtils.doForAndroid(() -> + btnBookmarks.getAttribute(AndroidAttributes.SELECTED).equals(Boolean.TRUE.toString())); + + if(!isSelected) { + isSelected = ActionProcessorUtils.doForIos(() -> lblNoBookmarks.state().waitForDisplayed()); } + + return isSelected; } public boolean isNoBookmarksMessageDisplayed() { @@ -51,11 +53,12 @@ public String getChapterName() { } public String getChapterTime() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return DateUtils.getDuration(lblChapterTime.getAttribute(IosAttributes.VALUE)).toString(); - } else { - return DateUtils.getDuration(lblChapterTime.getText()).toString(); + String chapterTime = ActionProcessorUtils.doForIos(() -> DateUtils.getDuration(lblChapterTime.getAttribute(IosAttributes.VALUE)).toString()); + + if(chapterTime == null) { + chapterTime = ActionProcessorUtils.doForAndroid(() -> DateUtils.getDuration(lblChapterTime.getText()).toString()); } + return chapterTime; } } diff --git a/src/test/java/screens/audiobook/TocAudiobookScreen.java b/src/test/java/screens/audiobook/TocAudiobookScreen.java index dec9b77..3512747 100644 --- a/src/test/java/screens/audiobook/TocAudiobookScreen.java +++ b/src/test/java/screens/audiobook/TocAudiobookScreen.java @@ -1,7 +1,6 @@ package screens.audiobook; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.IElement; @@ -10,6 +9,7 @@ import constants.appattributes.AndroidAttributes; import constants.appattributes.IosAttributes; import enums.timeouts.BooksTimeouts; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import models.AndroidLocator; import models.IosLocator; @@ -49,19 +49,25 @@ public TocAudiobookScreen() { } public String openChapterAndGetChapterName(int chapterNumber) { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS){ + String chapterName = ActionProcessorUtils.doForIos(() -> { ILabel lblChapter = getElementFactory().getLabel(By.xpath(String.format(CHAPTER_NAME_BY_CHAPTER_NUMBER_LOC_IOS, chapterNumber)), "Chapter"); String chapterText = lblChapter.getAttribute(IosAttributes.NAME); lblChapter.click(); return chapterText; - } else { - IElement lblChapterText = getChapters().get(chapterNumber); - String chapterText = lblChapterText.getAttribute(AndroidAttributes.TEXT); - ILabel downloadProgress = getElementFactory().getLabel(By.xpath(String.format(DOWNLOADING_PROGRESS_LOC_ANDROID, chapterNumber + 1)), "Downloading progress"); - AqualityServices.getConditionalWait().waitFor(() -> !downloadProgress.state().isDisplayed(), Duration.ofMillis(BooksTimeouts.TIMEOUT_BOOK_CHANGES_STATUS.getTimeoutMillis())); - lblChapterText.click(); - return chapterText; + }); + + if(chapterName == null) { + chapterName = ActionProcessorUtils.doForAndroid(() -> { + IElement lblChapterText = getChapters().get(chapterNumber); + String chapterText = lblChapterText.getAttribute(AndroidAttributes.TEXT); + ILabel downloadProgress = getElementFactory().getLabel(By.xpath(String.format(DOWNLOADING_PROGRESS_LOC_ANDROID, chapterNumber + 1)), "Downloading progress"); + AqualityServices.getConditionalWait().waitFor(() -> !downloadProgress.state().isDisplayed(), Duration.ofMillis(BooksTimeouts.TIMEOUT_BOOK_CHANGES_STATUS.getTimeoutMillis())); + lblChapterText.click(); + return chapterText; + }); } + + return chapterName; } public int getCountOfChapters() { @@ -94,11 +100,13 @@ public void openChapters() { } public boolean isChaptersSelected() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - return lblChapterName.state().waitForDisplayed(); - }else{ - return btnChapters.getAttribute(AndroidAttributes.SELECTED).equals(Boolean.TRUE.toString()); + boolean isSelected = ActionProcessorUtils.doForIos(() -> lblChapterName.state().waitForDisplayed()); + + if(!isSelected) { + isSelected = ActionProcessorUtils.doForAndroid(() -> btnChapters.getAttribute(AndroidAttributes.SELECTED).equals(Boolean.TRUE.toString())); } + + return isSelected; } public void clickBackBtn() { diff --git a/src/test/java/screens/epub/BookmarksEpubScreen.java b/src/test/java/screens/epub/BookmarksEpubScreen.java index 7bfb6d3..f157e28 100644 --- a/src/test/java/screens/epub/BookmarksEpubScreen.java +++ b/src/test/java/screens/epub/BookmarksEpubScreen.java @@ -1,7 +1,6 @@ package screens.epub; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; @@ -48,11 +47,10 @@ public boolean isBookmarkScreenOpened() { } public boolean isBookmarkPresent(String expectedBookmarkTitle, String bookmarkDateTime) { - LocalDateTime expectedLocalDateTime; - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - expectedLocalDateTime = getExpectedLocalDateTimeIos(bookmarkDateTime); - } else { - expectedLocalDateTime = DateUtils.getExpectedLocalDateTime(bookmarkDateTime); + LocalDateTime expectedLocalDateTime = ActionProcessorUtils.doForIos(() -> getExpectedLocalDateTimeIos(bookmarkDateTime)); + + if(expectedLocalDateTime == null) { + expectedLocalDateTime = ActionProcessorUtils.doForAndroid(() -> DateUtils.getExpectedLocalDateTime(bookmarkDateTime)); } AqualityServices.getLogger().info("expected bookmark info: "); diff --git a/src/test/java/screens/epub/ReaderEpubScreen.java b/src/test/java/screens/epub/ReaderEpubScreen.java index 7487736..5ff805f 100644 --- a/src/test/java/screens/epub/ReaderEpubScreen.java +++ b/src/test/java/screens/epub/ReaderEpubScreen.java @@ -1,7 +1,6 @@ package screens.epub; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.screens.Screen; import constants.RegEx; @@ -60,16 +59,21 @@ public void openNavigationBar() { } public String getBookName() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + String bookName = ActionProcessorUtils.doForIos(() -> { String text = lblBookName.getAttribute(IosAttributes.NAME); AqualityServices.getLogger().info("Book name on epub reader screen - " + text); return text; - } else { - hideNavigationBar(); - String text = lblBookName.getText(); - AqualityServices.getLogger().info("Book name on epub reader screen - " + text); - return text; + }); + + if(bookName == null) { + bookName = ActionProcessorUtils.doForAndroid(() -> { + hideNavigationBar(); + String text = lblBookName.getText(); + AqualityServices.getLogger().info("Book name on epub reader screen - " + text); + return text; + }); } + return bookName; } public void hideNavigationBar() { @@ -79,24 +83,34 @@ public void hideNavigationBar() { } public String getPageNumber() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - String pageNumber = lblPageNumber.getAttribute(IosAttributes.NAME); - pageNumber = RegExUtil.deleteBracketsFromText(pageNumber); - return RegExUtil.getStringFromFirstGroup(pageNumber, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); - } else { - String pageNumber = lblPageNumber.getText(); - return RegExUtil.getStringFromFirstGroup(pageNumber, RegEx.PAGE_NUMBER_REGEX_FOR_ANDROID); + 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); + }); + + if ((pageNumber == null)) { + pageNumber = ActionProcessorUtils.doForAndroid(() -> { + String number = lblPageNumber.getText(); + return RegExUtil.getStringFromFirstGroup(number, RegEx.PAGE_NUMBER_REGEX_FOR_ANDROID); + }); } + + return pageNumber; } public String getChapterName() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { - String chapterName = lblChapterName.getAttribute(IosAttributes.NAME); - chapterName = RegExUtil.deleteBracketsFromText(chapterName); - return RegExUtil.getStringFromThirdGroup(chapterName, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); - } else { - return lblChapterName.getText(); + String chapterName = ActionProcessorUtils.doForIos(() -> { + String chapter = lblChapterName.getAttribute(IosAttributes.NAME); + chapter = RegExUtil.deleteBracketsFromText(chapter); + return RegExUtil.getStringFromThirdGroup(chapter, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); + }); + + if(chapterName == null) { + chapterName = ActionProcessorUtils.doForAndroid(lblChapterName::getText); } + + return chapterName; } public void tapRightCorner() { diff --git a/src/test/java/screens/menubar/MenuBarScreen.java b/src/test/java/screens/menubar/MenuBarScreen.java index 0dfd9f9..c5f1afc 100644 --- a/src/test/java/screens/menubar/MenuBarScreen.java +++ b/src/test/java/screens/menubar/MenuBarScreen.java @@ -1,9 +1,9 @@ package screens.menubar; import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.screens.Screen; +import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import models.AndroidLocator; import models.IosLocator; @@ -45,11 +45,13 @@ public String getTypeOfTab(String tabName) { private IButton getButton(MenuBar menuItem) { String itemName = menuItem.getItemName(); - if (AqualityServices.getApplication().getPlatformName() == PlatformName.ANDROID) { - return getElementFactory().getButton(By.id(itemName), itemName); - } else { - return getElementFactory().getButton(By.xpath(String.format(BOTTOM_MENU_ELEMENT_LOC_IOS, itemName)), itemName); + IButton button = ActionProcessorUtils.doForAndroid(() -> getElementFactory().getButton(By.id(itemName), itemName)); + + if (button == null) { + button = ActionProcessorUtils.doForIos(() -> getElementFactory().getButton(By.xpath(String.format(BOTTOM_MENU_ELEMENT_LOC_IOS, itemName)), itemName)); } + + return button; } @FunctionalInterface diff --git a/src/test/java/screens/pdf/ReaderPdfScreen.java b/src/test/java/screens/pdf/ReaderPdfScreen.java index 6a7b547..07767f6 100644 --- a/src/test/java/screens/pdf/ReaderPdfScreen.java +++ b/src/test/java/screens/pdf/ReaderPdfScreen.java @@ -1,7 +1,5 @@ package screens.pdf; -import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import aquality.appium.mobile.elements.interfaces.ILabel; import aquality.appium.mobile.screens.Screen; import constants.appattributes.IosAttributes; @@ -52,12 +50,16 @@ public boolean isReaderOpened() { } public int getPageNumber() { - if(AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + Integer pageNumber = ActionProcessorUtils.doForIos(() -> { openNavigationBar(); return Integer.parseInt(StringUtils.substringBefore(lblPageNumber.getAttribute(IosAttributes.NAME), "/")); - } else { - return Integer.parseInt(StringUtils.substringBefore(lblPageNumber.getText(), ",")); + }); + + if(pageNumber == null) { + pageNumber = ActionProcessorUtils.doForAndroid(() -> Integer.parseInt(StringUtils.substringBefore(lblPageNumber.getText(), ","))); } + + return pageNumber; } public void openNavigationBar() { @@ -95,12 +97,16 @@ public void swipePageUp() { } public String getBookName() { - if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + String bookName = ActionProcessorUtils.doForIos(() -> { openNavigationBar(); return lblBookName.getAttribute(IosAttributes.NAME); - } else { - return lblBookName.getText(); + }); + + if(bookName == null) { + bookName = ActionProcessorUtils.doForAndroid(lblBookName::getText); } + + return bookName; } public int getLastPageNumber() { diff --git a/src/test/java/screens/pdf/SearchPdfScreen.java b/src/test/java/screens/pdf/SearchPdfScreen.java index aa4c577..a673d91 100644 --- a/src/test/java/screens/pdf/SearchPdfScreen.java +++ b/src/test/java/screens/pdf/SearchPdfScreen.java @@ -48,7 +48,7 @@ public void deleteText() { } public boolean isSearchFieldEmpty() { - return txbSearchLine.getText().isEmpty(); + return txbSearchLine.getText().equals("Search"); } public boolean isSearchPdfScreenOpened() {