From 43612707150fdd6b338fdbf356da83fe61398dfe Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Fri, 2 Feb 2024 14:31:25 +0400 Subject: [PATCH 1/2] changed step to add Overdrive books --- .../java/features/AudiobookOverdrive.feature | 62 +++---------------- src/test/java/features/Distributors.feature | 8 +-- src/test/java/features/EpubOverdrive.feature | 25 ++------ .../java/stepdefinitions/CatalogSteps.java | 1 + .../java/stepdefinitions/SearchSteps.java | 12 ---- 5 files changed, 15 insertions(+), 93 deletions(-) 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..0303931 100644 --- a/src/test/java/stepdefinitions/CatalogSteps.java +++ b/src/test/java/stepdefinitions/CatalogSteps.java @@ -307,6 +307,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); - } } From 1af05e42b9506f477554eb4844355ccbac4c6273 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Wed, 7 Feb 2024 00:19:44 +0400 Subject: [PATCH 2/2] changed step to check library on iOS --- src/test/java/stepdefinitions/CatalogSteps.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/stepdefinitions/CatalogSteps.java b/src/test/java/stepdefinitions/CatalogSteps.java index 0303931..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}")