diff --git a/src/test/java/features/AudiobookLyrasis.feature b/src/test/java/features/AudiobookLyrasis.feature index d41a345..b3a6789 100644 --- a/src/test/java/features/AudiobookLyrasis.feature +++ b/src/test/java/features/AudiobookLyrasis.feature @@ -27,8 +27,8 @@ Feature: Audiobooks in LYRASIS Reads And Open the 3 chapter on toc audiobook screen and save the chapter name as 'chapterNameKey' Then Audio player screen of book 'bookInfo' is opened And Chapter name on audio player screen is equal to 'chapterNameKey' saved chapter name - And Pause button is present on audio player screen - When Select "2.0"X playback speed on playback speed audiobook screen + When Select "1.5"X playback speed on playback speed audiobook screen + And Tap play button on audio player screen And Wait for 3 seconds And Tap pause button on audio player screen Then Play button is present on audio player screen @@ -41,7 +41,8 @@ Feature: Audiobooks in LYRASIS Reads When Open toc audiobook screen And Open random chapter on toc audiobook screen and save chapter name as 'chapterNameKey2' Then Audio player screen of book 'bookInfo' is opened - When Wait for 3 seconds + When Tap play button on audio player screen + And Wait for 3 seconds And Tap pause button on audio player screen Then Play button is present on audio player screen When Save book play time as 'timeAhead' on audio player screen @@ -61,9 +62,8 @@ Feature: Audiobooks in LYRASIS Reads | Biblioboard | @logout @returnBooks @tier1 - Scenario: Navigate by Audiobook -# When Search 'available' book of distributor '<distributor>' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' - When Search for "Pinocchio" and save bookName as 'bookNameInfo' + Scenario Outline: Navigate by Audiobook + When Search 'available' book of distributor '<distributor>' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab And Open AUDIOBOOK 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,19 +75,19 @@ Feature: Audiobooks in LYRASIS Reads And Skip ahead 15 seconds on audio player screen And Tap pause button on audio player screen Then Play button is present on audio player screen - And Playback has been moved forward by 15 seconds from 'timeAhead' and 'chapterTimeKey' seconds on audio player screen + And Playback has been moved forward by 30 seconds from 'timeAhead' and 'chapterTimeKey' seconds on audio player screen When Save book play time as 'timeBehind' on audio player screen And Skip behind 15 seconds on audio player screen And Tap pause button on audio player screen 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 + And Playback has been moved behind by 30 seconds from 'timeBehind' and 'chapterTimeKey' seconds on audio player screen -# Scenarios: -# | distributor | -# | Bibliotheca | -# | Palace Marketplace | -# | Axis 360 | -# | Biblioboard | + Scenarios: + | distributor | + | Bibliotheca | + | Palace Marketplace | + | Axis 360 | + | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Check end of chapter sleep timer @@ -99,16 +99,17 @@ Feature: Audiobooks in LYRASIS Reads When Click LISTEN action button on Book details screen Then Audio player screen of book 'bookInfo' is opened When Open toc audiobook screen - Then The first chapter is loaded - When Open the 2 chapter on toc audiobook screen and save the chapter name as 'chapterName' and chapter number as 'chapterNumber' + And Wait for 3 seconds + And Open the 1 chapter on toc audiobook screen and save the chapter name as 'chapterName' and chapter number as 'chapterNumber' + And Tap pause button on audio player screen And Set END_OF_CHAPTER sleep timer on sleep timer audiobook screen - And Select 2X playback speed on playback speed audiobook screen - And Stretch slider on the time tracking line to the end of playback + And Select "2.0"X playback speed on playback speed audiobook screen + And Tap play button on audio player screen And Listen a chapter on audio player screen Then Play button is present on audio player screen When Save the name of chapter as 'nextChapter' on audio player screen And Open toc audiobook screen - Then Chapter name next to 'chapterNumber' on toc audiobook screen is equal to 'nextChapter' saved chapter name + Then Chapter name next to 'chapterNumber' chapter on toc audiobook screen is equal to 'nextChapter' saved chapter name Scenarios: | distributor | @@ -147,7 +148,7 @@ Feature: Audiobooks in LYRASIS Reads When Open toc audiobook screen Then The first chapter is loaded When Open the 1 chapter on toc audiobook screen and save the chapter name as 'chapterName' and chapter number as 'chapterNumber' - And Select 2X playback speed on playback speed audiobook screen + And Select "2.0"X playback speed on playback speed audiobook screen And Listen a chapter on audio player screen Then Next chapter play automatically and chapter name is not 'chapterName' on audio player screen @@ -252,7 +253,7 @@ Feature: Audiobooks in LYRASIS Reads Then Check that book contains LISTEN action button on Book details screen When Click LISTEN action button on Book details screen Then Audio player screen of book 'bookInfo' is opened - When Select <speed>X playback speed on playback speed audiobook screen + When Select "<speed>"X playback speed on playback speed audiobook screen Then Current playback speed value is <speed>X on audio player screen When Return to previous screen from audio player screen And Click LISTEN action button on Book details screen @@ -275,19 +276,19 @@ Feature: Audiobooks in LYRASIS Reads | Palace Marketplace | 0.75 | 8 | 6 | | Palace Marketplace | 1.25 | 8 | 10 | | Palace Marketplace | 1.50 | 6 | 9 | - | Palace Marketplace | 2 | 5 | 10 | + | Palace Marketplace | 2.0 | 5 | 10 | | Axis 360 | 0.75 | 8 | 6 | | Axis 360 | 1.25 | 8 | 10 | | Axis 360 | 1.50 | 6 | 9 | - | Axis 360 | 2 | 5 | 10 | + | Axis 360 | 2.0 | 5 | 10 | | Biblioboard | 0.75 | 8 | 6 | | Biblioboard | 1.25 | 8 | 10 | | Biblioboard | 1.50 | 6 | 9 | - | Biblioboard | 2 | 5 | 10 | + | Biblioboard | 2.0 | 5 | 10 | | Bibliotheca | 0.75 | 8 | 6 | | Bibliotheca | 1.25 | 8 | 10 | | Bibliotheca | 1.50 | 6 | 9 | - | Bibliotheca | 2 | 5 | 10 | + | Bibliotheca | 2.0 | 5 | 10 | @logout @returnBooks @tier1 Scenario: TOC: Check of table of contents diff --git a/src/test/java/features/AudiobookOverdrive.feature b/src/test/java/features/AudiobookOverdrive.feature index d57b502..00c8e81 100644 --- a/src/test/java/features/AudiobookOverdrive.feature +++ b/src/test/java/features/AudiobookOverdrive.feature @@ -31,7 +31,7 @@ Feature: Audiobooks in A1QA library Then Audio player screen of book 'bookInfo' is opened And Chapter name on audio player screen is equal to 'chapterNameKey' saved chapter name And Pause button is present on audio player screen - When Select 2X playback speed on playback speed audiobook screen + When Select "2"X playback speed on playback speed audiobook screen And Wait for 3 seconds And Tap pause button on audio player screen Then Play button is present on audio player screen @@ -75,12 +75,12 @@ Feature: Audiobooks in A1QA library And Skip ahead 15 seconds on audio player screen And Tap pause button on audio player screen Then Play button is present on audio player screen - And Playback has been moved forward by 15 seconds from 'timeAhead' and 'chapterTimeKey' seconds on audio player screen + And Playback has been moved forward by 30 seconds from 'timeAhead' and 'chapterTimeKey' seconds on audio player screen When Save book play time as 'timeBehind' on audio player screen And Skip behind 15 seconds on audio player screen And Tap pause button on audio player screen 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 + And Playback has been moved behind by 30 seconds from 'timeBehind' and 'chapterTimeKey' seconds on audio player screen @logout @returnBooks @tier2 Scenario: Audiobooks: Check end of chapter sleep timer @@ -94,13 +94,13 @@ Feature: Audiobooks in A1QA library When Open toc audiobook screen And Open the 1 chapter on toc audiobook screen and save the chapter name as 'chapterName' and chapter number as 'chapterNumber' And Set END_OF_CHAPTER sleep timer on sleep timer audiobook screen - And Select 2X playback speed on playback speed audiobook screen + And Select "2"X playback speed on playback speed audiobook screen And Stretch slider on the time tracking line forward on audio player screen And Listen a chapter on audio player screen Then Play button is present on audio player screen When Save the name of chapter as 'nextChapter' on audio player screen And Open toc audiobook screen - Then Chapter name next to 'chapterNumber' on toc audiobook screen is equal to 'nextChapter' saved chapter name + Then Chapter name next to 'chapterNumber' chapter on toc audiobook screen is equal to 'nextChapter' saved chapter name @logout @returnBooks @tier2 @exclude_android Scenario: Audiobooks: Check of line for time remaining @@ -124,7 +124,7 @@ Feature: Audiobooks in A1QA library Then Audio player screen of book 'bookInfo' is opened When Open toc audiobook screen And Open the 1 chapter on toc audiobook screen and save the chapter name as 'chapterName' and chapter number as 'chapterNumber' - And Select 2X playback speed on playback speed audiobook screen + And Select "2"X playback speed on playback speed audiobook screen And Listen a chapter on audio player screen Then Next chapter play automatically and chapter name is not 'chapterName' on audio player screen @@ -201,7 +201,7 @@ Feature: Audiobooks in A1QA library Then Check that book contains LISTEN action button on Book details screen When Click LISTEN action button on Book details screen Then Audio player screen of book 'bookInfo' is opened - When Select <speed>X playback speed on playback speed audiobook screen + When Select "<speed>"X playback speed on playback speed audiobook screen Then Current playback speed value is <speed>X on audio player screen When Return to previous screen from audio player screen And Click LISTEN action button on Book details screen diff --git a/src/test/java/features/BookDetailView.feature b/src/test/java/features/BookDetailView.feature index fda47d3..4fb0a3a 100644 --- a/src/test/java/features/BookDetailView.feature +++ b/src/test/java/features/BookDetailView.feature @@ -63,7 +63,7 @@ Feature: Book detail view screen And Switch to '<tabName>' catalog tab And Open <bookType> book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then Book 'bookInfo' is opened on book details screen - And Description is not empty on Book details screen + And Description exists on Book details screen And Button More in Description is available on Book details screen Scenarios: @@ -112,7 +112,8 @@ Feature: Book detail view screen And Switch to '<tabName>' catalog tab And Open <bookType> book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then Book 'bookInfo' is opened on book details screen - And Related books section is displayed on book details screen + When Swipe down + Then Related books section is displayed on book details screen And There is a list of related books on book details screen And More button in related books section is available on book details screen @@ -178,7 +179,7 @@ Feature: Book detail view screen And Search for "Persuasion" and save bookName as 'bookNameInfo' And Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then Book 'bookInfo' is opened on book details screen - And Description is not empty on Book details screen + And Description exists on Book details screen And Button More in Description is available on Book details screen @tier2 @@ -254,7 +255,7 @@ Feature: Book detail view screen And Search for "The Oregon Trail" and save bookName as 'bookNameInfo' And Open EBOOK book with GET action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then Book 'bookInfo' is opened on book details screen - And Description is not empty on Book details screen + And Description exists on Book details screen And Button More in Description is available on Book details screen @tier2 diff --git a/src/test/java/features/CatalogNavigation.feature b/src/test/java/features/CatalogNavigation.feature index c132c3a..73e7754 100644 --- a/src/test/java/features/CatalogNavigation.feature +++ b/src/test/java/features/CatalogNavigation.feature @@ -195,39 +195,41 @@ Feature: Catalog Navigation module | type1 | type2 | | Everything | Popular Books | - @smoke @logout @returnBooks @exclude_android - Scenario: Catalog: Perform check of Reserve button and Allow notifications - 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 "Fahrenheit 451" and save bookName as 'bookNameInfo' - And Open AUDIOBOOK book with RESERVE action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' - And Click RESERVE action button without closing alert on Book details screen - Then There is an alert to allow notifications - When Tap ALLOW button on the alert - Then Alert to allow notification is not displayed - And Check that book contains REMOVE action button on Book details screen +# notifications are after opening the app +# @smoke1 @logout @returnBooks @exclude_android +# Scenario: Catalog: Perform check of Reserve button and Allow notifications +# 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 'unavailable' book of distributor 'Palace Marketplace' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' +# And Open AUDIOBOOK book with RESERVE action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' +# And Click RESERVE action button without closing alert on Book details screen +# Then There is an alert to allow notifications +# When Tap ALLOW button on the alert +# Then Alert to allow notification is not displayed +# And Check that book contains REMOVE action button on Book details screen - @smoke @logout @returnBooks @exclude_android - Scenario: Catalog: Alert: Perform check of "Don't Allow" button - 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 "Fahrenheit 451" and save bookName as 'bookNameInfo' - And Open AUDIOBOOK book with RESERVE action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' - And Click RESERVE action button without closing alert on Book details screen - Then There is an alert to allow notifications - When Don't Allow notifications on the alert - Then Alert to allow notification is not displayed - And Check that book contains REMOVE action button on Book details screen +# notifications are after opening the app +# @smoke1 @logout @returnBooks @exclude_android +# Scenario: Catalog: Alert: Perform check of "Don't Allow" button +# 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 'unavailable' book of distributor 'Palace Marketplace' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' +# And Open AUDIOBOOK book with RESERVE action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' +# And Click RESERVE action button without closing alert on Book details screen +# Then There is an alert to allow notifications +# When Don't Allow notifications on the alert +# Then Alert to allow notification is not displayed +# And Check that book contains REMOVE action button on Book details screen # More button is not available # @smoke diff --git a/src/test/java/features/EpubLyrasis.feature b/src/test/java/features/EpubLyrasis.feature index 561986e..edd14dc 100644 --- a/src/test/java/features/EpubLyrasis.feature +++ b/src/test/java/features/EpubLyrasis.feature @@ -250,6 +250,7 @@ Feature: Read EPUB in Lyrasis Reads When Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen 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 + # When Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen # And Go to previous page on reader epub screen # Then Previous page is opened and old page has 'pageNumberKey' pageNumber and 'chapterNameKey' chapterName on epub reader screen @@ -274,4 +275,25 @@ Feature: Read EPUB in Lyrasis Reads And Click READ action button on Book details screen Then 'bookInfo' book is present on epub reader screen When Open random chapter of epub and save it as 'chapterName' from toc epub screen - Then Chapter 'chapterName' is opened on epub reader screen \ No newline at end of file + Then Chapter 'chapterName' is opened on epub reader screen + + @smoke @logout @returnBooks + Scenario: Read ebooks: Search: Perform check of Search icon + 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 Search epub screen is opened + + @smoke @logout @returnBooks + Scenario: Read ebooks: Search: Perform check of entering characters + When Search for "The Story 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 '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 diff --git a/src/test/java/features/PdfPalaceAndroid.feature b/src/test/java/features/PdfPalaceAndroid.feature index dd259a5..708ad60 100644 --- a/src/test/java/features/PdfPalaceAndroid.feature +++ b/src/test/java/features/PdfPalaceAndroid.feature @@ -1,5 +1,7 @@ Feature: Read PDF in Palace Bookshelf on Android + #there is an issue with TOC + Background: Given Close tutorial screen Then Welcome screen is opened diff --git a/src/test/java/features/Reservations.feature b/src/test/java/features/Reservations.feature index f6db6f6..3863b74 100644 --- a/src/test/java/features/Reservations.feature +++ b/src/test/java/features/Reservations.feature @@ -162,7 +162,7 @@ Feature: Reservation of book in LYRASIS When Activate sync bookmarks on Sign in screen And Open Catalog And Open search modal - And Search for "Fahrenheit 451" and save bookName as 'bookNameInfo' + And Search 'unavailable' book of distributor 'Palace Marketplace' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab And Click RESERVE action button on AUDIOBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then AUDIOBOOK book with REMOVE action button and 'bookInfo' bookInfo is present on Catalog books screen @@ -187,7 +187,7 @@ Feature: Reservation of book in LYRASIS When Activate sync bookmarks on Sign in screen And Open Catalog And Open search modal - And Search for "Fahrenheit 451" and save bookName as 'bookNameInfo' + And Search 'unavailable' book of distributor 'Palace Marketplace' and bookType 'AUDIOBOOK' and save as 'bookNameInfo' And Switch to 'Audiobooks' catalog tab And Click RESERVE action button on AUDIOBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then AUDIOBOOK book with REMOVE action button and 'bookInfo' bookInfo is present on Catalog books screen diff --git a/src/test/java/runners/TestRunner.java b/src/test/java/runners/TestRunner.java index b1407ef..a509d84 100644 --- a/src/test/java/runners/TestRunner.java +++ b/src/test/java/runners/TestRunner.java @@ -17,8 +17,7 @@ }, plugin = { "io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm" - }, - tags = "@check" + } ) public class TestRunner { diff --git a/src/test/java/screens/BookDetailsScreen.java b/src/test/java/screens/BookDetailsScreen.java index 72249e0..13e4174 100644 --- a/src/test/java/screens/BookDetailsScreen.java +++ b/src/test/java/screens/BookDetailsScreen.java @@ -36,9 +36,9 @@ public class BookDetailsScreen extends Screen { private final ILabel lblBookFormat = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.LinearLayout//android.widget.TextView[@text=\"Format\"]/following::android.widget.TextView")), new IosLocator(By.xpath("//XCUIElementTypeStaticText[contains(@name, \"Book format\")]/following::XCUIElementTypeStaticText"))), "Book format label"); - private final ILabel lblTextInDescription = getElementFactory().getLabel(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.TextView[@text=\"Description\"]/following::android.widget.TextView")), - new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Description\"]/following::XCUIElementTypeTextView"))), "Info in description section"); + private final ILabel lblDescription = getElementFactory().getLabel(LocatorUtils.getLocator( + new AndroidLocator(By.id("bookDetailDescriptionTitle")), + new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Description\"]"))), "Info in description section"); private final IButton btnMoreInDescription = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.TextView[@text=\"Description\"]//following::android.widget.TextView[@text=\"Moreā¦\"]")), new IosLocator(By.xpath("//XCUIElementTypeStaticText//following::XCUIElementTypeButton[@name=\"More...\"]"))), "More btn in Description section"); @@ -126,8 +126,8 @@ public String getBookFormatInfo() { return lblBookFormat.getText(); } - public boolean isDescriptionNotEmpty() { - return !lblTextInDescription.getText().isEmpty(); + public boolean isDescriptionExists() { + return lblDescription.state().waitForExist(); } public boolean isMoreBtnInDescriptionAvailable() { diff --git a/src/test/java/screens/audiobook/AudioPlayerScreen.java b/src/test/java/screens/audiobook/AudioPlayerScreen.java index 96061ad..b32292a 100644 --- a/src/test/java/screens/audiobook/AudioPlayerScreen.java +++ b/src/test/java/screens/audiobook/AudioPlayerScreen.java @@ -102,11 +102,15 @@ public AudioPlayerScreen() { ).collect(Collectors.toMap(data -> data[0], data -> data[1])); public boolean isPlayerOpened(String bookName) { - btnPlay.state().waitForDisplayed(); + if(btnPause.state().waitForDisplayed()){ + btnPause.click(); + } - return getElementFactory().getLabel(LocatorUtils.getLocator( + ILabel lblBookName = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath(String.format(AUDIOBOOK_NAME_LOCATOR_ANDROID, bookName))), - new IosLocator(By.xpath(String.format(AUDIOBOOK_NAME_LOCATOR_IOS,bookName)))), "Book name").state().waitForDisplayed(); + new IosLocator(By.xpath(String.format(AUDIOBOOK_NAME_LOCATOR_IOS,bookName)))), "Book name"); + + return lblBookName.state().waitForDisplayed(); } public void returnToPreviousScreen() { diff --git a/src/test/java/screens/audiobook/PlaybackSpeedScreen.java b/src/test/java/screens/audiobook/PlaybackSpeedScreen.java index 257b174..c89ba90 100644 --- a/src/test/java/screens/audiobook/PlaybackSpeedScreen.java +++ b/src/test/java/screens/audiobook/PlaybackSpeedScreen.java @@ -23,7 +23,7 @@ public class PlaybackSpeedScreen extends Screen { private static final String PLAYBACK_SPEED_ANDROID = "//*[@text=\"%sx\"]"; - private static final String PLAYBACK_SPEED_IOS = "//XCUIElementTypeButton[contains(@name,\"%s\")]"; + private static final String PLAYBACK_SPEED_IOS = "//XCUIElementTypeScrollView//XCUIElementTypeAny/XCUIElementTypeButton[contains(@name,\"%s\")]"; public PlaybackSpeedScreen() { super(LocatorUtils.getLocator( @@ -40,6 +40,8 @@ public PlaybackSpeedScreen() { public void selectPlaybackSpeed(String playbackSpeed) { ActionProcessorUtils.doForIos(() -> { + System.out.println("Speed: " + playbackSpeed); + getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_IOS, playbackSpeed)), "Playback speed " + playbackSpeed).click(); }); ActionProcessorUtils.doForAndroid(() -> { diff --git a/src/test/java/screens/audiobook/SleepTimerScreen.java b/src/test/java/screens/audiobook/SleepTimerScreen.java index 71f62a0..969bed7 100644 --- a/src/test/java/screens/audiobook/SleepTimerScreen.java +++ b/src/test/java/screens/audiobook/SleepTimerScreen.java @@ -16,7 +16,7 @@ public class SleepTimerScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeWindow/XCUIElementTypeOther[2]/XCUIElementTypeOther[3]/XCUIElementTypeOther/XCUIElementTypeOther[2]//XCUIElementTypeButton"))), "Cancel button"); private static final String SLEEP_TIMER_LOC_ANDROID = "//*[contains(@resource-id, \"player_sleep_item_view_name\") and @text=\"%s\"]"; - private static final String SLEEP_TIMER_LOC_IOS = "//XCUIElementTypeButton[@name=\"%s\"]"; + private static final String SLEEP_TIMER_LOC_IOS = "//XCUIElementTypeScrollView//XCUIElementTypeOther/XCUIElementTypeButton[@name=\"%s\"]"; public SleepTimerScreen() { super(LocatorUtils.getLocator( @@ -27,6 +27,9 @@ public SleepTimerScreen() { public void setTimer(TimerKeys timerSetting) { ActionProcessorUtils.doForIos(() -> { String buttonName = timerSetting.getDefaultLocalizedValue(); + + System.out.println("Sleep: " + buttonName); + getElementFactory().getButton(By.xpath(String.format(SLEEP_TIMER_LOC_IOS, buttonName)), buttonName).click(); }); diff --git a/src/test/java/screens/audiobook/TocAudiobookScreen.java b/src/test/java/screens/audiobook/TocAudiobookScreen.java index d0b2431..8db70a7 100644 --- a/src/test/java/screens/audiobook/TocAudiobookScreen.java +++ b/src/test/java/screens/audiobook/TocAudiobookScreen.java @@ -40,6 +40,7 @@ public class TocAudiobookScreen extends Screen { private static final String CHAPTERS_LOC_ANDROID = "//android.widget.LinearLayout//android.widget.TextView[contains(@resource-id, \"player_toc_chapter_item_view_title\")]"; private static final String DOWNLOADING_PROGRESS_LOC_ANDROID = "//androidx.recyclerview.widget.RecyclerView//android.widget.RelativeLayout[%d]//android.view.View"; + private static final String CHAPTERS_LOC_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText"; private static final String CHAPTER_NAME_BY_CHAPTER_NUMBER_LOC_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]//XCUIElementTypeStaticText[1]"; public TocAudiobookScreen() { @@ -60,7 +61,7 @@ public String openChapterAndGetChapterName(int chapterNumber) { 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"); + 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; @@ -114,6 +115,8 @@ public void clickBackBtn() { } private List<IElement> getChapters() { - return getElementFactory().findElements(By.xpath(CHAPTERS_LOC_ANDROID), ElementType.LABEL).stream().limit(10).collect(Collectors.toList()); + return getElementFactory().findElements(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(CHAPTERS_LOC_ANDROID)), + new IosLocator(By.xpath(CHAPTERS_LOC_IOS))), ElementType.LABEL).stream().limit(10).collect(Collectors.toList()); } } diff --git a/src/test/java/screens/epub/NavigationBarScreen.java b/src/test/java/screens/epub/NavigationBarScreen.java index cc799fe..abb6665 100644 --- a/src/test/java/screens/epub/NavigationBarScreen.java +++ b/src/test/java/screens/epub/NavigationBarScreen.java @@ -25,6 +25,9 @@ public class NavigationBarScreen extends Screen { private final IButton btnFontSettings = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.TextView[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")), + new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"search.button\"]"))), "Search button"); public NavigationBarScreen() { super(LocatorUtils.getLocator( @@ -55,4 +58,8 @@ public void tapDeleteBookmarkButton() { public void tapFontSettingsButton() { btnFontSettings.click(); } + + public void tapSearchIcon() { + btnSearch.click(); + } } diff --git a/src/test/java/screens/epub/ReaderEpubScreen.java b/src/test/java/screens/epub/ReaderEpubScreen.java index 5ff805f..155f40d 100644 --- a/src/test/java/screens/epub/ReaderEpubScreen.java +++ b/src/test/java/screens/epub/ReaderEpubScreen.java @@ -20,6 +20,7 @@ public class ReaderEpubScreen extends Screen { private final NavigationBarScreen navigationBarScreen; + private final SearchEpubScreen searchEpubScreen; private final ILabel lblPage = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.webkit.WebView[1]")), @@ -42,6 +43,7 @@ public ReaderEpubScreen() { new AndroidLocator(By.xpath("//android.view.ViewGroup[contains(@resource-id,\"readerToolbar\")]")), new IosLocator(By.xpath("//*[contains(@name,\"Page\")]"))), "Reader epub screen"); navigationBarScreen = new NavigationBarScreen(); + searchEpubScreen = new SearchEpubScreen(); } public void swipeToNextPage() { @@ -160,4 +162,8 @@ public void clickRightCorner() { action.tap(PointOption.point(width - 10, height / 2)).perform(); }); } + + public SearchEpubScreen getSearchEpubScreen() { + return searchEpubScreen; + } } diff --git a/src/test/java/screens/epub/SearchEpubScreen.java b/src/test/java/screens/epub/SearchEpubScreen.java new file mode 100644 index 0000000..13c9394 --- /dev/null +++ b/src/test/java/screens/epub/SearchEpubScreen.java @@ -0,0 +1,33 @@ +package screens.epub; + +import aquality.appium.mobile.elements.interfaces.ITextBox; +import aquality.appium.mobile.screens.Screen; +import framework.utilities.LocatorUtils; +import models.AndroidLocator; +import models.IosLocator; +import org.openqa.selenium.By; + +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"); + + public SearchEpubScreen () { + super(LocatorUtils.getLocator( + new AndroidLocator(By.id("search_src_text")), + new IosLocator(By.xpath("//XCUIElementTypeTextField"))), "Search epub screen"); + } + + public boolean isSearchScreenOpened() { + return txbSearchField.state().waitForDisplayed(); + } + + public void enterText(String text) { + txbSearchField.sendKeys(text); + } + + public String getTextFromSearchTxb() { + return txbSearchField.getText(); + } +} diff --git a/src/test/java/screens/pdf/NavigationBarPdfScreen.java b/src/test/java/screens/pdf/NavigationBarPdfScreen.java index 40a7cae..8ffc685 100644 --- a/src/test/java/screens/pdf/NavigationBarPdfScreen.java +++ b/src/test/java/screens/pdf/NavigationBarPdfScreen.java @@ -16,7 +16,7 @@ public class NavigationBarPdfScreen extends Screen { new AndroidLocator(By.xpath("")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeOther[2]//XCUIElementTypeButton[2]"))), "Search button"); private final IButton btnBack = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.ImageButton[@content-desc=\"Back\"]")), + new AndroidLocator(By.xpath("//android.widget.ImageView[@content-desc=\"Back\"]")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeButton[@name=\"Back\"]"))), "Back button"); private final IButton btnSettings = getElementFactory().getButton(By.xpath("//android.widget.Button[@content-desc=\"Settings\"]"), "Settings button"); private final IButton btnBookmark = getElementFactory().getButton(LocatorUtils.getLocator( diff --git a/src/test/java/stepdefinitions/ApplicationSteps.java b/src/test/java/stepdefinitions/ApplicationSteps.java index c07df4d..c35d416 100644 --- a/src/test/java/stepdefinitions/ApplicationSteps.java +++ b/src/test/java/stepdefinitions/ApplicationSteps.java @@ -61,6 +61,11 @@ public void swipeUp() { SwipeElementUtils.swipeUp(); } + @When("Swipe down") + public void swipeDown() { + SwipeElementUtils.swipeDown(); + } + @Then("Tutorial screen is opened") public void checkTutorialScreenIsOpened() { Assert.assertTrue("Tutorial screen is not opened!", tutorialScreen.isTutorialScreenOpened()); diff --git a/src/test/java/stepdefinitions/BookDetailsSteps.java b/src/test/java/stepdefinitions/BookDetailsSteps.java index e875874..05767c4 100644 --- a/src/test/java/stepdefinitions/BookDetailsSteps.java +++ b/src/test/java/stepdefinitions/BookDetailsSteps.java @@ -91,9 +91,9 @@ public void isBookFormatCorrect(String bookFormat) { Assert.assertEquals("Book format is not correct", bookFormat, bookDetailsScreen.getBookFormatInfo()); } - @Then("Description is not empty on Book details screen") + @Then("Description exists on Book details screen") public void isDescriptionNotEmpty() { - Assert.assertTrue("Description section is empty", bookDetailsScreen.isDescriptionNotEmpty()); + Assert.assertTrue("Description section is empty", bookDetailsScreen.isDescriptionExists()); } @Then("Button More in Description is available on Book details screen") @@ -136,9 +136,6 @@ public void isDistributorCorrect(String distributor) { @Then("Related books section is displayed on book details screen") public void isRelatedBooksExists() { String authorName = bookDetailsScreen.getBookInfo().getAuthor(); - if (AqualityServices.getApplication().getPlatformName()==PlatformName.ANDROID) { - SwipeElementUtils.swipeDown(); - } Assert.assertTrue("Related books section is not displayed", bookDetailsScreen.isRelatedBooksExists(authorName)); } diff --git a/src/test/java/stepdefinitions/audiobooksteps/AudioPlayerSteps.java b/src/test/java/stepdefinitions/audiobooksteps/AudioPlayerSteps.java index b5fab5b..e4beb65 100644 --- a/src/test/java/stepdefinitions/audiobooksteps/AudioPlayerSteps.java +++ b/src/test/java/stepdefinitions/audiobooksteps/AudioPlayerSteps.java @@ -50,8 +50,7 @@ public void checkThatPauseButtonIsPresentOnAudioPlayerScreen() { @When("Tap pause button on audio player screen") public void tapPauseButtonOnAudioPlayerScreen() { - if(audioPlayerScreen.isPauseButtonPresent()) - audioPlayerScreen.tapPauseBtn(); + audioPlayerScreen.tapPauseBtn(); } @Then("Play button is present on audio player screen") @@ -161,11 +160,10 @@ public void stretchSliderToTheEnd() { @When("Listen a chapter on audio player screen") public void waitTheEndOfChapter() { - audioPlayerScreen.stretchPlaySliderToTheEnd(); AqualityServices.getConditionalWait().waitFor(()-> { boolean isNull = false; long timer = audioPlayerScreen.getRightTime().getSeconds(); - if(timer==0 || audioPlayerScreen.isPlayButtonPresent()) + if(timer == 0 || audioPlayerScreen.isPlayButtonPresent()) isNull = true; return isNull; }); @@ -260,7 +258,9 @@ public void tapBookmarkIcon() { @Then("The message Bookmark added appears on audio player screen") public void checkBookmarkMessageAppears() { - Assert.assertTrue("Bookmark added message is not displayed", audioPlayerScreen.isBookmarkAddedMessageDisplayed()); + if (AqualityServices.getApplication().getPlatformName() == PlatformName.IOS) { + Assert.assertTrue("Bookmark added message is not displayed", audioPlayerScreen.isBookmarkAddedMessageDisplayed()); + } } @Then("Book is playing on audio player screen") diff --git a/src/test/java/stepdefinitions/audiobooksteps/TocAudiobookSteps.java b/src/test/java/stepdefinitions/audiobooksteps/TocAudiobookSteps.java index 0d72c3d..6f71070 100644 --- a/src/test/java/stepdefinitions/audiobooksteps/TocAudiobookSteps.java +++ b/src/test/java/stepdefinitions/audiobooksteps/TocAudiobookSteps.java @@ -42,18 +42,17 @@ public void isChapterLoaded(){ @When("Open the {int} chapter on toc audiobook screen and save the chapter name as {string} and chapter number as {string}") public void openChapterAndSaveNameAndNumber(int chapterNumber, String chapterNameKey, String chapterNumberKey) { - String chapter = tocAudiobookScreen.openChapterAndGetChapterName(chapterNumber - 1); + String chapter = tocAudiobookScreen.openChapterAndGetChapterName(chapterNumber); context.add(chapterNameKey, chapter); context.add(chapterNumberKey, chapterNumber); } - @Then("Chapter name next to {string} on toc audiobook screen is equal to {string} saved chapter name") - public void checkChapterNameOnToc(String chapterNumberKey, String chapterNameKey) { + @Then("Chapter name next to {string} chapter on toc audiobook screen is equal to {string} saved chapter name") + public void checkChapterNameOnToc(String chapterNumberKey, String savedChapterNameKey) { int chapterNumber = context.get(chapterNumberKey); - String chapterNameFromToc = tocAudiobookScreen.getChapterName(chapterNumber); - String chapterNameFromScreen = context.get(chapterNameKey); - String cutChapterName = chapterNameFromScreen.substring(0, chapterNameFromScreen.indexOf('(') - 1); - Assert.assertEquals("Chapter does not change to next. ", cutChapterName, chapterNameFromToc); + String nextChapterName = tocAudiobookScreen.getChapterName(chapterNumber + 1); + String savedChapterName = context.get(savedChapterNameKey); + Assert.assertEquals("Chapter does not change to next. ", savedChapterName, nextChapterName); } @Then("There are two tabs Content and Bookmarks on toc audiobook screen") diff --git a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java index dfbc0ee..3c877f5 100644 --- a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java +++ b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java @@ -180,4 +180,28 @@ public void checkPageInfoPageInfoIsCorrect(String pageNumberKey) { String actualPageNumber = readerEpubScreen.getPageNumber(); Assert.assertTrue(String.format("PageNumber is not correct. ExpectedPageNumber-%1$s but actualPageNumber-%2$s", expectedPageNumber, actualPageNumber), AqualityServices.getConditionalWait().waitFor(() -> expectedPageNumber.equals(actualPageNumber))); } + + @When("Tap search icon on epub reader screen") + public void tapSearchIcon() { + readerEpubScreen.openNavigationBar(); + readerEpubScreen.getNavigationBarEpubScreen().tapSearchIcon(); + } + + @Then("Search epub screen is opened") + public void isSearchOpened() { + Assert.assertTrue("Search screen is not opened!", readerEpubScreen.getSearchEpubScreen().isSearchScreenOpened()); + } + + @When("Enter {string} text and save it as {string} on search epub screen") + public void enterTextAndSaveIt(String text, String searchedTextKey) { + readerEpubScreen.getSearchEpubScreen().enterText(text); + context.add(searchedTextKey, text); + } + + @Then("The field allows to enter characters and contains {string} on search epub screen") + public void checkTheEnteredText(String searchedTextKey) { + String expectedSearchedText = context.get(searchedTextKey); + String actualSearchedText = readerEpubScreen.getSearchEpubScreen().getTextFromSearchTxb(); + Assert.assertEquals("The field is empty!", expectedSearchedText, actualSearchedText); + } } \ No newline at end of file