diff --git a/src/test/java/features/AudiobookOverdrive.feature b/src/test/java/features/AudiobookOverdrive.feature index d80ddcd..6fae4ac 100644 --- a/src/test/java/features/AudiobookOverdrive.feature +++ b/src/test/java/features/AudiobookOverdrive.feature @@ -17,18 +17,10 @@ Feature: Audiobooks in A1QA library When Open Catalog And Switch to "Audiobooks" catalog tab Then Catalog screen is opened - When Open categories by chain and chain starts from CategoryScreen: - | OverDrive | - Then Subcategory screen is opened @logout @returnBooks @tier2 Scenario: Audiobooks: Open the audiobook at the last open chapter and check time code - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -70,11 +62,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Navigate by Audiobook - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -102,12 +90,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check end of chapter sleep timer - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -128,11 +111,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 @exclude_android Scenario: Audiobooks: Check of line for time remaining - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -145,12 +124,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check of switching to the next chapter - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -167,11 +141,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check closing playback speed and sleep timer - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -192,12 +162,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check time tracking line - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -221,11 +186,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check of not rewinding forward and back by tapping on time bar - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen @@ -250,12 +211,7 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario Outline: Audiobooks: Playback speed: Check of playback speed - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' - And Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Get AUDIOBOOK book from "OverDrive" category and save it as 'bookNameInfo' 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 Then Check that book contains LISTEN action button on Book details screen diff --git a/src/test/java/features/Distributors.feature b/src/test/java/features/Distributors.feature index c7588f9..90fc939 100644 --- a/src/test/java/features/Distributors.feature +++ b/src/test/java/features/Distributors.feature @@ -79,13 +79,7 @@ Feature: Distributors And Open Catalog And Switch to "eBooks" catalog tab Then Catalog screen is opened - When Open categories by chain and chain starts from CategoryScreen: - | OverDrive | - Then Subcategory screen is opened - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' + When Get EBOOK book from "OverDrive" category and save it as 'bookNameInfo' And 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 Then Check that book contains READ action button on Book details screen diff --git a/src/test/java/features/EpubOverdrive.feature b/src/test/java/features/EpubOverdrive.feature index 65b3b3e..63feb4b 100644 --- a/src/test/java/features/EpubOverdrive.feature +++ b/src/test/java/features/EpubOverdrive.feature @@ -17,17 +17,10 @@ Feature: Read EPUB from Overdrive in A1QA When Open Catalog And Switch to "eBooks" catalog tab Then Catalog screen is opened - When Open categories by chain and chain starts from CategoryScreen: - | OverDrive | - Then Subcategory screen is opened @logout @tier2 Scenario: Epub: Open book to last page read - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' + When Get EBOOK book from "OverDrive" category and save it 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 @@ -54,10 +47,7 @@ Feature: Read EPUB from Overdrive in A1QA @logout @tier2 Scenario: Epub: Navigate by Page - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' + When Get EBOOK book from "OverDrive" category and save it 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 @@ -76,11 +66,7 @@ Feature: Read EPUB from Overdrive in A1QA @logout @returnBooks @tier2 Scenario: Epub: Navigate by bookmarks - When Swipe down - And Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' + When Get EBOOK book from "OverDrive" category and save it 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 @@ -105,10 +91,7 @@ Feature: Read EPUB from Overdrive in A1QA @logout @returnBooks @tier2 Scenario: Epub: Delete bookmarks - When Get names of books on Catalog books screen and save them as "bookList" - And Open Catalog - And Open search modal - And Search a book from the list "bookList" and save book name as 'bookNameInfo' + When Get EBOOK book from "OverDrive" category and save it 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 diff --git a/src/test/java/stepdefinitions/CatalogSteps.java b/src/test/java/stepdefinitions/CatalogSteps.java index db68fc4..03119b3 100644 --- a/src/test/java/stepdefinitions/CatalogSteps.java +++ b/src/test/java/stepdefinitions/CatalogSteps.java @@ -8,6 +8,7 @@ import enums.localization.catalog.ActionButtonsForBooksAndAlertsKeys; import enums.localization.sortoptions.AvailabilityKeys; import enums.localization.sortoptions.SortByKeys; +import framework.utilities.ActionProcessorUtils; import framework.utilities.ScenarioContext; import framework.utilities.swipe.SwipeElementUtils; import io.cucumber.java.en.Then; @@ -35,6 +36,8 @@ public class CatalogSteps { private final CatalogBooksScreen catalogBooksScreen; private final SortOptionsScreen sortOptionsScreen; private final SearchScreen searchScreen; + private final SettingsScreen settingsScreen; + private final LibrariesScreen librariesScreen; private final ScenarioContext context; private static final SecureRandom random = new SecureRandom(); @@ -48,6 +51,8 @@ public CatalogSteps(ScenarioContext context){ catalogBooksScreen = new CatalogBooksScreen(); sortOptionsScreen = new SortOptionsScreen(); searchScreen = new SearchScreen(); + settingsScreen = new SettingsScreen(); + librariesScreen = new LibrariesScreen(); } @When("Open Catalog") @@ -62,7 +67,13 @@ public void isCatalogScreenOpened() { @Then("Library {string} is opened on Catalog screen") public void isLibraryOpenedInCatalog(String libraryName){ - Assert.assertTrue("Library is not opened on the Catalog screen!", catalogScreen.isLibraryOnTheCatalogDisplayed(libraryName)); + ActionProcessorUtils.doForAndroid(() -> Assert.assertTrue("Library is not opened on the Catalog screen!", catalogScreen.isLibraryOnTheCatalogDisplayed(libraryName))); + ActionProcessorUtils.doForIos(() -> { + menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); + menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); + settingsScreen.openLibraries(); + Assert.assertTrue(libraryName + " is not present on Libraries screen", librariesScreen.isLibraryPresent(libraryName)); + }); } @Then("Count of books in first category is more than {int}") @@ -307,6 +318,7 @@ public void getABookAndSave(BookType bookType, String categoryName, String bookN bookName = StringUtils.substringBefore(bookName, ". Audiobook."); } + menuBarScreen.openBottomMenuTab(MenuBar.CATALOG); mainToolBarScreen.openSearchModal(); searchScreen.setSearchedText(bookName); searchScreen.applySearch(); diff --git a/src/test/java/stepdefinitions/SearchSteps.java b/src/test/java/stepdefinitions/SearchSteps.java index fa04568..5b970f9 100644 --- a/src/test/java/stepdefinitions/SearchSteps.java +++ b/src/test/java/stepdefinitions/SearchSteps.java @@ -11,13 +11,11 @@ import org.junit.Assert; import screens.*; -import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; public class SearchSteps { - private static final SecureRandom random = new SecureRandom(); private final MainToolBarScreen mainToolBarScreen; private final SearchScreen searchScreen; private final CatalogScreen catalogScreen; @@ -138,14 +136,4 @@ public void searchSeveralBooks(String listKey, List listOfBooks) { public void returnBack() { searchScreen.closeSearchScreen(); } - - @When("Search a book from the list {string} and save book name as {string}") - public void searchFromList(String listNameKey, String bookNameInfoKey) { - List bookList = context.get(listNameKey); - int bookIndex = random.nextInt(bookList.size()); - String bookName = bookList.get(bookIndex); - searchScreen.setSearchedText(bookName); - searchScreen.applySearch(); - context.add(bookNameInfoKey, bookName); - } }