From 2f3046add25ef39ad9f5e7d36c976dcf9a727726 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Mon, 26 Feb 2024 22:52:09 +0400 Subject: [PATCH 1/9] updated pdf palace ios --- src/test/java/features/PdfPalaceIos.feature | 19 +++++------- src/test/java/features/Search.feature | 16 ---------- .../utilities/swipe/SwipeElementUtils.java | 16 +++++++++- src/test/java/screens/CatalogBooksScreen.java | 4 +-- .../java/screens/pdf/BookmarksPdfScreen.java | 15 +++++++--- .../java/screens/pdf/ChaptersPdfScreen.java | 18 +++++++---- .../screens/pdf/NavigationBarPdfScreen.java | 2 +- .../java/screens/pdf/ReaderPdfScreen.java | 10 ++++++- .../java/screens/pdf/SearchPdfScreen.java | 15 ++++------ .../screens/pdf/TocBookmarksPdfScreen.java | 2 +- src/test/java/stepdefinitions/PdfSteps.java | 30 +++++++++++++++---- .../epubsteps/EpubReaderSteps.java | 2 +- 12 files changed, 91 insertions(+), 58 deletions(-) diff --git a/src/test/java/features/PdfPalaceIos.feature b/src/test/java/features/PdfPalaceIos.feature index 05be699..6d95e0c 100644 --- a/src/test/java/features/PdfPalaceIos.feature +++ b/src/test/java/features/PdfPalaceIos.feature @@ -65,9 +65,9 @@ Feature: Read PDF in Palace Bookshelf on IOS @tier2 @exclude_android Scenario: Navigate by Pdf Search Results When Open search pdf screen - And Search for 'try' text on search pdf screen - And Open random found text and save page number as 'pageNumber' on search pdf screen - Then Page number is equal to 'pageNumber' on pdf reader screen in "LYRASIS Reads" + And Search for 'try' text on search pdf screen and save word as 'foundText' + And Open the found text with 'foundText' word and save page number as 'pageNumber' on search pdf screen + Then Current page number is equal to 'pageNumber' on pdf reader screen @tier2 @exclude_android Scenario: Navigate by Page slider @@ -83,22 +83,19 @@ Feature: Read PDF in Palace Bookshelf on IOS Scenario: Navigate by pdf bookmarks When Open bookmarks pdf screen Then Bookmarks pdf screen is opened - And Amount of bookmarks is 0 on bookmarks pdf screen + And There are no bookmarks on bookmarks pdf screen When Close toc bookmarks pdf screen And Go to next page on reader pdf screen And Add bookmark on reader pdf screen -# Then Bookmark is displayed on reader pdf screen And Save page number as 'pageNumberInfo' on pdf reader screen in "LYRASIS Reads" And Go to next page on reader pdf screen And Add bookmark on reader pdf screen And Save page number as 'pageNumberInfo2' on pdf reader screen in "LYRASIS Reads" And Go to next page on reader pdf screen And Add bookmark on reader pdf screen -# And Delete bookmark on reader pdf screen -# Then Bookmark is not displayed on reader pdf screen And Open bookmarks pdf screen - Then Amount of bookmarks is 2 on bookmarks pdf screen - When Open the 0 bookmark on bookmarks pdf screen + Then Amount of bookmarks is 3 on bookmarks pdf screen + When Open the 1 bookmark on bookmarks pdf screen Then Page number is equal to 'pageNumberInfo' on pdf reader screen in "LYRASIS Reads" @tier2 @exclude_android @@ -113,5 +110,5 @@ Feature: Read PDF in Palace Bookshelf on IOS Scenario: Navigate by Chapters When Open TOC on pdf reader screen And Open text chapter content on pdf toc screen - And Open random chapter and save the number as 'pageNumberInfo' on pdf toc screen in "LYRASIS Reads" - Then Page number is equal to 'pageNumberInfo' on pdf reader screen in "LYRASIS Reads" \ No newline at end of file + And Open the 4 chapter and save the number as 'pageNumberInfo' on pdf toc screen + Then Current page number is equal to 'pageNumberInfo' on pdf reader screen \ No newline at end of file diff --git a/src/test/java/features/Search.feature b/src/test/java/features/Search.feature index d0350af..03fc4b5 100644 --- a/src/test/java/features/Search.feature +++ b/src/test/java/features/Search.feature @@ -40,22 +40,6 @@ Feature: Search module |@ | |$! | - @tier2 - Scenario Outline: Check that books from search result contain one or more entered latin letters or numeric in Palace Bookshelf - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "Palace Bookshelf" on Add library screen - And Open search modal - And Search for word and save as 'info' on Catalog books screen - Then Books contain word 'info' on Catalog books screen - - Scenarios: - | word | - | cat | - | a | - @tier2 Scenario Outline: Find a book with name in different font cases in Palace Bookshelf When Close tutorial screen diff --git a/src/test/java/framework/utilities/swipe/SwipeElementUtils.java b/src/test/java/framework/utilities/swipe/SwipeElementUtils.java index 385a16f..f489f32 100644 --- a/src/test/java/framework/utilities/swipe/SwipeElementUtils.java +++ b/src/test/java/framework/utilities/swipe/SwipeElementUtils.java @@ -53,11 +53,25 @@ public static void swipeDown() { public static void swipeUp() { double x = AqualityServices.getApplication().getDriver().manage().window().getSize().getWidth() * 0.5; - double fromY = 260; + double fromY = AqualityServices.getApplication().getDriver().manage().window().getSize().getHeight() * 0.15; double toY = AqualityServices.getApplication().getDriver().manage().window().getSize().getHeight() * 0.8; AqualityServices.getTouchActions().swipe(new Point((int) x, (int) fromY), new Point((int) x, (int) toY)); } + public static void swipeLeft() { + double fromX = AqualityServices.getApplication().getDriver().manage().window().getSize().getWidth() * 0.9; + double y = AqualityServices.getApplication().getDriver().manage().window().getSize().getHeight() * 0.5; + double toX = AqualityServices.getApplication().getDriver().manage().window().getSize().getWidth() * 0.2; + AqualityServices.getTouchActions().swipe(new Point((int) fromX, (int) y), new Point((int) toX, (int) y)); + } + + public static void swipeRight() { + double fromX = AqualityServices.getApplication().getDriver().manage().window().getSize().getWidth() * 0.15; + double y = AqualityServices.getApplication().getDriver().manage().window().getSize().getHeight() * 0.5; + double toX = AqualityServices.getApplication().getDriver().manage().window().getSize().getWidth() * 0.9; + AqualityServices.getTouchActions().swipe(new Point((int) fromX, (int) y), new Point((int) toX, (int) y)); + } + public static void swipeByCoordinates(double fromX, double fromY, double toX, double toY) { AqualityServices.getTouchActions().swipe(new Point((int) fromX, (int) fromY), new Point((int) toX, (int) toY)); } diff --git a/src/test/java/screens/CatalogBooksScreen.java b/src/test/java/screens/CatalogBooksScreen.java index 4c08150..c49dad8 100644 --- a/src/test/java/screens/CatalogBooksScreen.java +++ b/src/test/java/screens/CatalogBooksScreen.java @@ -35,7 +35,7 @@ public class CatalogBooksScreen extends Screen { private static final String BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_ANDROID = "//android.widget.TextView[@text=\"%s\"]/following-sibling::android.widget.LinearLayout/android.widget.Button[@text=\"%s\"]"; private static final String BOOK_BY_BOOK_NAME_AND_BUTTON_LOC_ANDROID = BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_ANDROID + "/ancestor::android.view.ViewGroup/android.widget.TextView[1]"; - private static final String BOOK_NAME_LOCATOR_ANDROID = "//android.view.ViewGroup[contains(@resource-id, \"bookCellIdle\")]/android.widget.TextView[contains(@resource-id, \"bookCellIdleTitle\")]"; + private static final String BOOK_NAME_LOCATOR_ANDROID = "//androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView[contains(@resource-id, \"bookCellIdleTitle\")]"; private static final String AUTHOR_BY_BOOK_NAME_AND_BUTTON_LOCATOR_ANDROID = BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_ANDROID + "/ancestor::android.view.ViewGroup/android.widget.TextView[contains(@resource-id, \"bookCellIdleAuthor\")]"; private static final String PROGRESS_BAR_BY_BOOK_NAME_LOC_ANDROID = "//android.widget.TextView[@text=\"%s\"]/following-sibling::android.widget.ProgressBar"; private static final String BUTTON_ON_THE_FIRST_BOOK_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_ANDROID = "//android.widget.TextView/following-sibling::android.widget.LinearLayout//*[@text=\"%s\"]"; @@ -44,7 +44,7 @@ public class CatalogBooksScreen extends Screen { private static final String BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/following-sibling::XCUIElementTypeOther/XCUIElementTypeButton[contains(@name,\"%s\")]"; private static final String BOOK_BY_BOOK_NAME_AND_BUTTON_LOC_IOS = BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_IOS + "/ancestor::XCUIElementTypeOther/XCUIElementTypeStaticText[1]"; - private static final String BOOK_NAME_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeOther/XCUIElementTypeStaticText[1]"; + private static final String BOOK_NAME_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther/XCUIElementTypeStaticText[1]"; private static final String AUTHOR_BY_BOOK_NAME_AND_BUTTON_LOCATOR_IOS = BUTTON_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_IOS + "/ancestor::XCUIElementTypeOther[2]/XCUIElementTypeStaticText[2]"; private static final String PROGRESS_BAR_BY_BOOK_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/following-sibling::XCUIElementTypeProgressIndicator"; private static final String BUTTON_ON_THE_FIRST_BOOK_BY_BOOK_NAME_AND_BUTTON_NAME_LOC_IOS = "//XCUIElementTypeStaticText/following-sibling::XCUIElementTypeOther/XCUIElementTypeButton[contains(@name,\"%s\")]"; diff --git a/src/test/java/screens/pdf/BookmarksPdfScreen.java b/src/test/java/screens/pdf/BookmarksPdfScreen.java index 5adf719..45704f4 100644 --- a/src/test/java/screens/pdf/BookmarksPdfScreen.java +++ b/src/test/java/screens/pdf/BookmarksPdfScreen.java @@ -12,12 +12,19 @@ public class BookmarksPdfScreen extends Screen { - private static final String BOOKMARK_LOC_IOS = "//XCUIElementTypeCell"; + private final ILabel noBookmarks = getElementFactory().getLabel(By.xpath("//XCUIElementTypeStaticText[contains(@name, \"no bookmarks\")]"), "No bookmarks label"); + + private static final String BOOKMARK_LOC_IOS = "//XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell"; + private static final String CURRENT_BOOKMARK_LOC_IOS = "//XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]"; public BookmarksPdfScreen() { super(LocatorUtils.getLocator( new AndroidLocator(By.xpath("")), - new IosLocator(By.xpath("//XCUIElementTypeStaticText[contains(@name=\"no bookmarks\")]"))), "Bookmarks screen"); + new IosLocator(By.xpath("//XCUIElementTypeStaticText[contains(@name, \"no bookmarks\")]"))), "Bookmarks screen"); + } + + public boolean isScreenEmpty() { + return noBookmarks.state().waitForDisplayed(); } public int getCountOfBookmarks() { @@ -25,8 +32,8 @@ public int getCountOfBookmarks() { } public void openBookmark(int bookmarkNumber) { - ILabel lblBookmarks = getListOfBookmarks().get(bookmarkNumber); - lblBookmarks.click(); + ILabel lblBookmark = getElementFactory().getLabel(By.xpath(String.format(CURRENT_BOOKMARK_LOC_IOS, bookmarkNumber)), "Bookmark"); + lblBookmark.click(); } private List getListOfBookmarks() { diff --git a/src/test/java/screens/pdf/ChaptersPdfScreen.java b/src/test/java/screens/pdf/ChaptersPdfScreen.java index b31e9d2..d6c5d65 100644 --- a/src/test/java/screens/pdf/ChaptersPdfScreen.java +++ b/src/test/java/screens/pdf/ChaptersPdfScreen.java @@ -18,7 +18,8 @@ public class ChaptersPdfScreen extends Screen { private static final String CHAPTER_NUMBER_LOCATOR_ANDROID = "//android.view.View[contains(@resource-id, \"outlineView\")]/android.view.View[%d]/android.view.View"; private static final String CHAPTER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther[2]"; - private static final String CHAPTER_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeOther[2]"; + private static final String CHAPTER_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeOther[2]//XCUIElementTypeStaticText[1]"; + private static final String CHAPTER_NUMBER_BY_PAGE_LOCATOR_IOS = "//XCUIElementTypeStaticText[@name=\"%d\"]"; public ChaptersPdfScreen () { super(LocatorUtils.getLocator( @@ -30,10 +31,11 @@ public boolean areChaptersDisplayed() { return getChapters().size() == 0 || getChapters().size() != 0; } - private List getChapters() { - return getElementFactory().findElements(LocatorUtils.getLocator( - new AndroidLocator(By.xpath(CHAPTER_LOCATOR_ANDROID)), - new IosLocator(By.xpath(CHAPTER_LOCATOR_IOS))), ElementType.LABEL, ElementsCount.ANY, ElementState.EXISTS_IN_ANY_STATE); + public void openChapter(int chapterNumber){ + ILabel chapter = getElementFactory().getLabel(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(String.format(CHAPTER_NUMBER_LOCATOR_ANDROID, chapterNumber))), + new IosLocator(By.xpath(String.format(CHAPTER_NUMBER_BY_PAGE_LOCATOR_IOS, chapterNumber)))), "Chapter"); + chapter.click(); } public void openRandomChapter() { @@ -43,4 +45,10 @@ public void openRandomChapter() { new IosLocator(By.xpath(String.format(CHAPTER_NUMBER_LOCATOR_IOS, chapterNumber)))), "Chapter"); chapter.click(); } + + private List getChapters() { + return getElementFactory().findElements(LocatorUtils.getLocator( + new AndroidLocator(By.xpath(CHAPTER_LOCATOR_ANDROID)), + new IosLocator(By.xpath(CHAPTER_LOCATOR_IOS))), ElementType.LABEL, ElementsCount.ANY, ElementState.EXISTS_IN_ANY_STATE); + } } diff --git a/src/test/java/screens/pdf/NavigationBarPdfScreen.java b/src/test/java/screens/pdf/NavigationBarPdfScreen.java index 8ffc685..3f1cdaa 100644 --- a/src/test/java/screens/pdf/NavigationBarPdfScreen.java +++ b/src/test/java/screens/pdf/NavigationBarPdfScreen.java @@ -21,7 +21,7 @@ public class NavigationBarPdfScreen extends Screen { private final IButton btnSettings = getElementFactory().getButton(By.xpath("//android.widget.Button[@content-desc=\"Settings\"]"), "Settings button"); private final IButton btnBookmark = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("")), - new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"Bookmark\"]"))), "Bookmark button"); + new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeButton[@name=\"Bookmark\"]"))), "Bookmark button"); public NavigationBarPdfScreen() { super(LocatorUtils.getLocator( diff --git a/src/test/java/screens/pdf/ReaderPdfScreen.java b/src/test/java/screens/pdf/ReaderPdfScreen.java index 8358d8b..4af7585 100644 --- a/src/test/java/screens/pdf/ReaderPdfScreen.java +++ b/src/test/java/screens/pdf/ReaderPdfScreen.java @@ -76,6 +76,14 @@ public int getPageNumber(String libraryName) { return pageNumber; } + public String getCurrentPageNumber() { + + return ActionProcessorUtils.doForIos(() ->{ + openNavigationBar(); + return StringUtils.substringBefore(lblPageNumber.getAttribute(IosAttributes.NAME), " ("); + }); + } + public void openNavigationBar() { if (!navigationBarPdfScreen.state().waitForDisplayed()) { CoordinatesClickUtils.clickAtCenterOfScreen(); @@ -83,7 +91,7 @@ public void openNavigationBar() { } public void goToNextPage() { - SwipeElementUtils.swipeThroughEntireElement(lblPage, EntireElementSwipeDirection.RIGHT); + SwipeElementUtils.swipeLeft(); } public void goToPreviousPage() { diff --git a/src/test/java/screens/pdf/SearchPdfScreen.java b/src/test/java/screens/pdf/SearchPdfScreen.java index a77cf10..6aaf408 100644 --- a/src/test/java/screens/pdf/SearchPdfScreen.java +++ b/src/test/java/screens/pdf/SearchPdfScreen.java @@ -20,8 +20,8 @@ public class SearchPdfScreen extends Screen { private final IButton btnDone = getElementFactory().getButton(By.xpath("//XCUIElementTypeWindow/XCUIElementTypeOther[2]//XCUIElementTypeButton"), "Apply search"); private final IButton returnKey = getElementFactory().getButton(By.xpath("//XCUIElementTypeButton[@name=\"Return\"]"), "Return key"); - private static final String NUMBER_OF_FOUND_TEXT_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeStaticText[2]"; - private static final String FOUND_TEXT_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCell[%d]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeStaticText[2]"; + private static final String FOUND_TEXT_WITH_TEXT_LOCATOR_IOS = "//XCUIElementTypeStaticText[contains(@name, \"%s\")]"; + private static final String FOUND_TEXT_NUMBER_BY_FOUND_TEXT_LOCATOR_IOS = FOUND_TEXT_WITH_TEXT_LOCATOR_IOS + "/following-sibling::XCUIElementTypeStaticText"; private static final String FOUND_TEXT_LOCATOR_IOS = "//XCUIElementTypeCell/XCUIElementTypeStaticText[1]"; public SearchPdfScreen() { @@ -41,17 +41,14 @@ public String getTextFromSearchTxb() { return txbSearchLine.getText(); } - public int openRandomFoundText() { - int pageNumber = (int) (Math.random() * (getNumbersOfFoundTexts().size()) + 1); - ILabel foundText = getElementFactory().getLabel(By.xpath(String.format(FOUND_TEXT_NUMBER_LOCATOR_IOS, pageNumber)), "Found text"); + public String openFoundText(String text) { + ILabel foundText = getElementFactory().getLabel(By.xpath(String.format(FOUND_TEXT_WITH_TEXT_LOCATOR_IOS,text)), text); + ILabel foundTextNumber = getElementFactory().getLabel(By.xpath(String.format(FOUND_TEXT_NUMBER_BY_FOUND_TEXT_LOCATOR_IOS, text)), "Page number"); + String pageNumber = foundTextNumber.getText(); foundText.click(); return pageNumber; } - private List getNumbersOfFoundTexts() { - return getElementFactory().findElements(By.xpath(NUMBER_OF_FOUND_TEXT_LOCATOR_IOS), ElementType.LABEL); - } - public void deleteText() { txbSearchLine.clear(); } diff --git a/src/test/java/screens/pdf/TocBookmarksPdfScreen.java b/src/test/java/screens/pdf/TocBookmarksPdfScreen.java index 4c4f3ab..980c1bf 100644 --- a/src/test/java/screens/pdf/TocBookmarksPdfScreen.java +++ b/src/test/java/screens/pdf/TocBookmarksPdfScreen.java @@ -23,7 +23,7 @@ public class TocBookmarksPdfScreen extends Screen { private final IButton btnBookmarks = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeSegmentedControl/XCUIElementTypeButton[3]"))), "Bookmarks button"); - private final IButton btnResume = getElementFactory().getButton(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeOther//XCUIElementTypeButton[1]"), "Resume button"); + private final IButton btnResume = getElementFactory().getButton(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeOther[2]//XCUIElementTypeButton[1]"), "Resume button"); public TocBookmarksPdfScreen() { super(LocatorUtils.getLocator( diff --git a/src/test/java/stepdefinitions/PdfSteps.java b/src/test/java/stepdefinitions/PdfSteps.java index 7d17c19..4855910 100644 --- a/src/test/java/stepdefinitions/PdfSteps.java +++ b/src/test/java/stepdefinitions/PdfSteps.java @@ -121,16 +121,16 @@ public void enterSearchedText(String text) { readerPdfScreen.getSearchPdfScreen().enterText(text); } - @When("Search for {string} text on search pdf screen") - public void searchText(String text) { + @When("Search for {string} text on search pdf screen and save word as {string}") + public void searchText(String text, String textKey) { readerPdfScreen.getSearchPdfScreen().enterText(text); readerPdfScreen.getSearchPdfScreen().applySearch(); - + context.add(textKey, text); } - @When("Open random found text and save page number as {string} on search pdf screen") - public void openRandomTextAndSavePageNumber(String pageNumberKey) { - context.add(pageNumberKey, readerPdfScreen.getSearchPdfScreen().openRandomFoundText()); + @When("Open the found text with {string} word and save page number as {string} on search pdf screen") + public void openFirstTextAndSavePage(String textKey, String pageNumberKey) { + context.add(pageNumberKey, readerPdfScreen.getSearchPdfScreen().openFoundText(context.get(textKey))); } @Then("Page number is equal to {string} on pdf reader screen in {string}") @@ -139,6 +139,12 @@ public void comparePageNumbers(String pageInfoKey, String libraryName) { Assert.assertEquals("Page number is wrong", pageNumber, readerPdfScreen.getPageNumber(libraryName)); } + @Then("Current page number is equal to {string} on pdf reader screen") + public void checkPageNumber(String pageNumberKey) { + String pageNumber = Integer.toString(context.get(pageNumberKey)); + Assert.assertEquals("Page number is wrong", pageNumber, readerPdfScreen.getCurrentPageNumber()); + } + @When("Delete text in search line on search pdf screen") public void deleteTextFromSearchLine() { readerPdfScreen.getSearchPdfScreen().deleteText(); @@ -180,6 +186,12 @@ public void openRandomChapter(String pageInfoKey, String libraryName){ context.add(pageInfoKey, readerPdfScreen.getPageNumber(libraryName)); } + @When("Open the {int} chapter and save the number as {string} on pdf toc screen") + public void openChapter(int chapterNumber, String pageInfoKey) { + chaptersPdfScreen.openChapter(chapterNumber); + context.add(pageInfoKey, chapterNumber); + } + @When("Open pdf settings screen on pdf reader screen") public void openSettings() { readerPdfScreen.getNavigationBarScreen().tapSettingsButton(); @@ -334,6 +346,11 @@ public void checkThatAmountOfBookmarksIsCorrect(int expectedAmountOfBookmarks) { Assert.assertEquals(String.format("Amount of bookmarks is not correct on bookmarks pdf screen. ExpectedAmountOfBookmarks-%d, actualAmountOfBookmarks-%d", expectedAmountOfBookmarks, actualAmountOfBookmarks), expectedAmountOfBookmarks, actualAmountOfBookmarks); } + @Then("There are no bookmarks on bookmarks pdf screen") + public void isScreeEmpty() { + Assert.assertTrue("Bookmarks screen is not empty!", tocBookmarksPdfScreen.getBookmarksPdfScreen().isScreenEmpty()); + } + @When("Close toc bookmarks pdf screen") public void closeTocBookmarksGalleryScreen() { tocBookmarksPdfScreen.tapResumeButton(); @@ -341,6 +358,7 @@ public void closeTocBookmarksGalleryScreen() { @When("Add bookmark on reader pdf screen") public void addBookmarkOnReaderPdfScreen() { + readerPdfScreen.openNavigationBar(); readerPdfScreen.getNavigationBarScreen().tapBookmarkButton(); } diff --git a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java index 4d702fc..bae7ddb 100644 --- a/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java +++ b/src/test/java/stepdefinitions/epubsteps/EpubReaderSteps.java @@ -266,7 +266,7 @@ public void isSearchResultEmpty() { } @When("Apply search on search epub screen") - public void apllySearch() { + public void applySearch() { readerEpubScreen.getSearchEpubScreen().applySearch(); } } \ No newline at end of file From 6df40005f4a5f54073240052496dbb441449e2cd Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 02:10:56 +0400 Subject: [PATCH 2/9] updated sorting options locator --- src/test/java/screens/SortOptionsScreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index c4490c0..f1f137b 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -19,7 +19,7 @@ public class SortOptionsScreen extends Screen { new AndroidLocator(By.xpath("//android.widget.Button[@index=\"5\"]")), new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnSortByPalace = getElementFactory().getButton(LocatorUtils.getLocator( - new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout/android.widget.Button[2]")), + new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout/android.widget.Button")), new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnAvailability = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"feedHeaderFacets\")]/android.widget.Button[1]")), From 61a45ec018b33d7419e24d41ed821b9aaf3579f3 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 17:53:47 +0400 Subject: [PATCH 3/9] updated manage libraries module --- .../java/features/ManageLibraries.feature | 32 +------------------ src/test/java/screens/CatalogScreen.java | 4 +-- src/test/java/screens/LibrariesScreen.java | 3 +- src/test/java/screens/MainToolBarScreen.java | 2 +- .../java/stepdefinitions/SettingsSteps.java | 1 + 5 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/test/java/features/ManageLibraries.feature b/src/test/java/features/ManageLibraries.feature index d04a473..9ebe0e1 100644 --- a/src/test/java/features/ManageLibraries.feature +++ b/src/test/java/features/ManageLibraries.feature @@ -13,7 +13,6 @@ Feature: Manage Libraries Then Button Add Library is displayed on libraries screen When Click Add library button on libraries screen Then Add library screen is opened - And Libraries are sorted in alphabetical order on add account screen @tier2 Scenario: Navigate by Tutorial @@ -79,7 +78,7 @@ Feature: Manage Libraries And Open Catalog And Switch to 'Palace Bookshelf' from side menu And Open categories by chain and chain starts from CategoryScreen: - | Open Textbooks | + | DPLA Publications | And Click GET action button on the first EBOOK book on catalog books screen and save book as 'bookInfo' And Open Books Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on books screen @@ -112,35 +111,6 @@ Feature: Manage Libraries And Open Books Then There are not books on books screen - @logout @returnBooks @tier2 - Scenario: Switch Library Reservations - When Close tutorial screen - Then Welcome screen is opened - When Close welcome screen - Then Add library screen is opened - When Add library "Plumas County Library" on Add library screen - Then Library "Plumas County Library" is opened on Libraries screen - When Add 'LYRASIS Reads' library in Libraries screen - And 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 'EBOOK' and save as 'bookNameInfo' - And Switch to 'eBooks' catalog tab - Then Subcategory screen is opened - When Open EBOOK book with RESERVE action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' - Then Book 'bookInfo' is opened on book details screen - And Click RESERVE action button on Book details screen - Then Check that book contains REMOVE action button on Book details screen - When Open Reservations - Then EBOOK book with REMOVE action button and 'bookInfo' bookInfo is present on Reservations screen - When Open Catalog - And Open Catalog - And Switch to 'Plumas County Library' from side menu - And Open Reservations - Then There are not books on Reservations screen - @logout @tier2 Scenario: Store library card When Close tutorial screen diff --git a/src/test/java/screens/CatalogScreen.java b/src/test/java/screens/CatalogScreen.java index 78818ef..981a9a0 100644 --- a/src/test/java/screens/CatalogScreen.java +++ b/src/test/java/screens/CatalogScreen.java @@ -52,7 +52,7 @@ public class CatalogScreen extends Screen { private static final String CATEGORY_NAME_LOCATOR_IOS = "(//XCUIElementTypeOther[.//XCUIElementTypeButton[@name=\"%1$s\"]]/following-sibling::XCUIElementTypeCell)[1]"; private static final String CATEGORY_LOCATOR_IOS = "//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[1]"; private static final String BOOK_COVER_IN_CATEGORY_LOCATOR_IOS = "/XCUIElementTypeButton"; - private static final String BOOK_NAME_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther/XCUIElementTypeStaticText[1]"; + private static final String BOOK_NAME_LOCATOR_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeButton"; private static final String CURRENT_CATEGORY_LOCATOR_IOS = "//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[contains(@name, \"%s\")]"; private static final String MORE_BUTTON_LOCATOR_IOS = "//XCUIElementTypeTable/XCUIElementTypeOther/XCUIElementTypeButton[contains(@name,\"More\")]"; private static final String CURRENT_SECTION_LOCATOR_IN_CATALOG_IOS = "//XCUIElementTypeTable/XCUIElementTypeButton[%d]"; @@ -60,7 +60,7 @@ public class CatalogScreen extends Screen { private static final String CATALOG_TAB_LOCATOR_IOS = "//XCUIElementTypeButton[@name=\"%1$s\"]"; private static final String LIBRARY_BUTTON_LOCATOR_PATTERN_IOS = "//XCUIElementTypeButton[@name=\"%1$s\"]"; private static final String LIBRARY_LOGO_LOCATOR_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]"; - private static final int COUNT_OF_CATEGORIES_TO_WAIT_FOR = 5; + private static final int COUNT_OF_CATEGORIES_TO_WAIT_FOR = 7; public CatalogScreen() { super(LocatorUtils.getLocator( diff --git a/src/test/java/screens/LibrariesScreen.java b/src/test/java/screens/LibrariesScreen.java index 5caae25..4e49f91 100644 --- a/src/test/java/screens/LibrariesScreen.java +++ b/src/test/java/screens/LibrariesScreen.java @@ -29,6 +29,7 @@ public class LibrariesScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeButton[@label=\"Delete\"]"))), "Delete library button"); private static final String LIBRARY_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/parent::XCUIElementTypeCell"; + private static final String LIBRARY_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell"; private static final String LIBRARY_NAME_ON_LIBRARY_SETTINGS_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]"; private static final String LIBRARY_CELL_BY_LIBRARY_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/parent::XCUIElementTypeCell"; @@ -112,7 +113,7 @@ private IButton getLibraryButton(String libraryName) { private List getLibrariesNames() { List libraries = getElementFactory().findElements(LocatorUtils.getLocator( new AndroidLocator(By.xpath(LIBRARY_NAME_LOC_ANDROID)), - new IosLocator(By.xpath(LIBRARY_NAME_LOC_IOS))), ElementType.LABEL); + new IosLocator(By.xpath(LIBRARY_LOC_IOS))), ElementType.LABEL); List names = new ArrayList<>(); libraries.forEach(library -> names.add(library.getText().toLowerCase())); return names; diff --git a/src/test/java/screens/MainToolBarScreen.java b/src/test/java/screens/MainToolBarScreen.java index 02d0480..6db0d1d 100644 --- a/src/test/java/screens/MainToolBarScreen.java +++ b/src/test/java/screens/MainToolBarScreen.java @@ -18,7 +18,7 @@ public class MainToolBarScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[1]/following-sibling::*"))), "Category name"); private final IButton btnChooseAnotherLibrary = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"mainToolbar\")]/android.widget.ImageView")), - new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeButton[@name=\"Change Library Account\"]"))), "Change library account"); + new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"librarySwitchButton\"]"))), "Change library account"); public MainToolBarScreen(){ super(LocatorUtils.getLocator( diff --git a/src/test/java/stepdefinitions/SettingsSteps.java b/src/test/java/stepdefinitions/SettingsSteps.java index 49c99e9..a674d8f 100644 --- a/src/test/java/stepdefinitions/SettingsSteps.java +++ b/src/test/java/stepdefinitions/SettingsSteps.java @@ -30,6 +30,7 @@ public SettingsSteps(){ @When("Open Settings") public void openSettings() { menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); + menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); } @Then("Settings screen is opened") From b8b930e7e98aa176aa18e987ab0c9829a9739e39 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 19:49:45 +0400 Subject: [PATCH 4/9] updated distributors --- src/test/java/features/Distributors.feature | 60 ++++--------------- src/test/java/screens/LibrariesScreen.java | 13 +--- .../stepdefinitions/ApplicationSteps.java | 1 + 3 files changed, 14 insertions(+), 60 deletions(-) diff --git a/src/test/java/features/Distributors.feature b/src/test/java/features/Distributors.feature index 90fc939..0e981d6 100644 --- a/src/test/java/features/Distributors.feature +++ b/src/test/java/features/Distributors.feature @@ -63,23 +63,12 @@ Feature: Distributors | Biblioboard | EBOOK | eBooks | READ | | Biblioboard | AUDIOBOOK | Audiobooks | LISTEN | - @logout @returnBooks @tier2 - Scenario: Getting and returning a book from Book Detail View for Overdrive + @tier2 @exclude_ios + Scenario: Getting and returning a book from Book Detail View for Palace Bookshelf (Android) When Add library "Palace Bookshelf" on Add library screen Then Library "Palace Bookshelf" is opened on Catalog screen - When Turn on test mode - And Enable hidden libraries - And Open Catalog - And Add "A1QA Test Library" account by the logo - Then Library "A1QA Test Library" is opened on Catalog screen - When Enter credentials for "A1QA Test Library" library - Then Login is performed successfully - When Swipe down - And Activate sync bookmarks on Sign in screen - And Open Catalog - And Switch to "eBooks" catalog tab - Then Catalog screen is opened - When Get EBOOK book from "OverDrive" category and save it as 'bookNameInfo' + When Open search modal + And Search for "Jane Eyre" 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' And Click GET action button on Book details screen Then Check that book contains READ action button on Book details screen @@ -89,39 +78,10 @@ Feature: Distributors Then Check that book contains READ action button on Book details screen When Click READ action button on Book details screen And Wait for 3 seconds - Then Book 'bookInfo' with EBOOK type is present on epub or pdf or audiobook screen - When Return to previous screen for epub and pdf - And Click RETURN action button on Book details screen - Then Check that book contains GET action button on Book details screen - - @logout @returnBooks @tier2 - Scenario: Getting and returning an audiobook from Book Detail View for Overdrive - When Add library "Palace Bookshelf" on Add library screen - Then Library "Palace Bookshelf" is opened on Catalog screen - When Turn on test mode - And Enable hidden libraries - And Open Catalog - And Add "A1QA Test Library" account by the logo - Then Library "A1QA Test Library" is opened on Catalog screen - When Enter credentials for "A1QA Test Library" library - Then Login is performed successfully - When Activate sync bookmarks on Sign in screen - And Open Catalog - And Open search modal - And Search for "We Are Water" and save bookName 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 - When Click RETURN action button on Book details screen - Then Check that book contains GET action button on Book details screen - When Click GET action button on Book details screen - Then Check that book contains LISTEN action button on Book details screen - When Click LISTEN action button on Book details screen - And Wait for 3 seconds Then Book 'bookInfo' with AUDIOBOOK type is present on epub or pdf or audiobook screen - @tier2 - Scenario: Getting and returning a book from Book Detail View for Palace Bookshelf + @tier2 @exclude_android + Scenario: Getting and returning a book from Book Detail View for Palace Bookshelf (iOS) When Add library "Palace Bookshelf" on Add library screen Then Library "Palace Bookshelf" is opened on Catalog screen When Open search modal @@ -129,7 +89,7 @@ Feature: Distributors 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 - When Click RETURN action button on Book details screen + When Click DELETE action button on Book details screen Then Check that book contains GET action button on Book details screen When Click GET action button on Book details screen Then Check that book contains READ action button on Book details screen @@ -164,7 +124,7 @@ Feature: Distributors | Biblioboard | EBOOK | eBooks | | Biblioboard | AUDIOBOOK | Audiobooks | - @logout @returnBooks @tier2 @exclude_android + @logout @tier2 @exclude_android Scenario: Check of canceling the downloading from book details view for Overdrive When Add library "Palace Bookshelf" on Add library screen Then Library "Palace Bookshelf" is opened on Catalog screen @@ -182,4 +142,6 @@ Feature: Distributors 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 and cancel downloading by click CANCEL button on book detail screen Then Check that book contains DOWNLOAD action button on Book details screen - And Check that book contains RETURN action button on Book details screen \ No newline at end of file + And Check that book contains RETURN action button on Book details screen + When Click RETURN action button on Book details screen + Then Check that book contains GET action button on Book details screen \ No newline at end of file diff --git a/src/test/java/screens/LibrariesScreen.java b/src/test/java/screens/LibrariesScreen.java index 4e49f91..435f2bf 100644 --- a/src/test/java/screens/LibrariesScreen.java +++ b/src/test/java/screens/LibrariesScreen.java @@ -1,6 +1,5 @@ package screens; -import aquality.appium.mobile.application.AqualityServices; import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.elements.interfaces.ILabel; @@ -9,12 +8,9 @@ import framework.utilities.ActionProcessorUtils; import framework.utilities.LocatorUtils; import framework.utilities.swipe.SwipeElementUtils; -import io.appium.java_client.TouchAction; -import io.appium.java_client.touch.offset.PointOption; import models.AndroidLocator; import models.IosLocator; import org.openqa.selenium.By; -import org.openqa.selenium.Point; import java.util.ArrayList; import java.util.List; @@ -28,7 +24,7 @@ public class LibrariesScreen extends Screen { new AndroidLocator(By.xpath("//android.widget.Button[@text=\"Remove\"]")), new IosLocator(By.xpath("//XCUIElementTypeButton[@label=\"Delete\"]"))), "Delete library button"); - private static final String LIBRARY_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/parent::XCUIElementTypeCell"; + private static final String LIBRARY_NAME_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeStaticText[@name=\"%s\"]"; private static final String LIBRARY_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell"; private static final String LIBRARY_NAME_ON_LIBRARY_SETTINGS_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]"; private static final String LIBRARY_CELL_BY_LIBRARY_NAME_LOC_IOS = "//XCUIElementTypeStaticText[@name=\"%s\"]/parent::XCUIElementTypeCell"; @@ -59,12 +55,7 @@ public void addLibrary() { } public void openLibrary(String libraryName) { - ActionProcessorUtils.doForAndroid(() -> getLibraryButton(libraryName).click()); - ActionProcessorUtils.doForIos(() -> { - Point point = getLibraryButton(libraryName).getElement().getCenter(); - TouchAction action = new TouchAction(AqualityServices.getApplication().getDriver()); - action.tap(PointOption.point(point)).perform(); - }); + getLibraryButton(libraryName).click(); } public boolean isAddLibraryBtnDisplayed() { diff --git a/src/test/java/stepdefinitions/ApplicationSteps.java b/src/test/java/stepdefinitions/ApplicationSteps.java index 94dd8ab..0089e56 100644 --- a/src/test/java/stepdefinitions/ApplicationSteps.java +++ b/src/test/java/stepdefinitions/ApplicationSteps.java @@ -139,6 +139,7 @@ public void waitSeveralSeconds(Integer secondsCount) { @When("Turn on test mode") public void turnOnTestMode() { + menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); menuBarScreen.openBottomMenuTab(MenuBar.SETTINGS); settingsScreen.openTestMode(); } From 5e8bd08294a4e4600029b20f6795eb1442931c56 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 22:51:32 +0400 Subject: [PATCH 5/9] updated Catalog iOS --- .../java/features/CatalogNavigation.feature | 19 +------------------ src/test/java/screens/CatalogScreen.java | 2 +- src/test/java/screens/MainToolBarScreen.java | 2 +- src/test/java/screens/SortOptionsScreen.java | 4 ++-- src/test/java/screens/SubcategoryScreen.java | 2 +- .../java/stepdefinitions/CatalogSteps.java | 2 +- 6 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/test/java/features/CatalogNavigation.feature b/src/test/java/features/CatalogNavigation.feature index e815f29..be77aa3 100644 --- a/src/test/java/features/CatalogNavigation.feature +++ b/src/test/java/features/CatalogNavigation.feature @@ -16,23 +16,6 @@ Feature: Catalog Navigation module Then Catalog screen is opened And Category names are loaded on Catalog screen - @tier2 - Scenario: Browse Categories in Palace Bookshelf - When Add library "Palace Bookshelf" on Add library screen - Then Catalog screen is opened - And Library "Palace Bookshelf" is opened on Catalog screen - And Catalog screen is opened - When Swipe up - And Count of books in first category is more than 1 - When Get names of books on screen and save them as 'listOfBooksOnMainPage' - And Open categories by chain and chain starts from CategoryScreen: - | Nonfiction | - | Biography & Memoir | - Then Subcategory name is 'Biography & Memoir' - And List of books on screen is not equal to list of books saved as 'listOfBooksOnMainPage' - When Open first book in Subcategory List and save it as 'bookInfo' - Then Book 'bookInfo' is opened on book details screen - @tier2 Scenario: Check of the titles of books sections in Palace Bookshelf When Add library "Palace Bookshelf" on Add library screen @@ -46,7 +29,7 @@ Feature: Catalog Navigation module Then Library "Palace Bookshelf" is opened on Catalog screen And Catalog screen is opened When Open categories by chain and chain starts from CategoryScreen: - | Big Ten Open Books | + | DPLA Publications | Then Books are sorted by Author by default on subcategory screen in 'Palace Bookshelf' And There are sorting by '', '' and '' on Subcategory screen in 'Palace Bookshelf' diff --git a/src/test/java/screens/CatalogScreen.java b/src/test/java/screens/CatalogScreen.java index 981a9a0..df10a3d 100644 --- a/src/test/java/screens/CatalogScreen.java +++ b/src/test/java/screens/CatalogScreen.java @@ -65,7 +65,7 @@ public class CatalogScreen extends Screen { public CatalogScreen() { super(LocatorUtils.getLocator( new AndroidLocator(By.id("feedContentLogoHeader")), - new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[contains(@name, \"AccessibilitySwitchLibrary\")]"))), "Catalog screen"); + new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[contains(@name, \"librarySwitchButton\")]"))), "Catalog screen"); } public boolean isLibraryOnTheCatalogDisplayed(String libraryName) { diff --git a/src/test/java/screens/MainToolBarScreen.java b/src/test/java/screens/MainToolBarScreen.java index 6db0d1d..8f6e1d8 100644 --- a/src/test/java/screens/MainToolBarScreen.java +++ b/src/test/java/screens/MainToolBarScreen.java @@ -15,7 +15,7 @@ public class MainToolBarScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[2]"))), "Search button"); private final ILabel lblCategoryName = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"mainToolbar\")]/android.widget.TextView")), - new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[1]/following-sibling::*"))), "Category name"); + new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeStaticText"))), "Category name"); private final IButton btnChooseAnotherLibrary = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"mainToolbar\")]/android.widget.ImageView")), new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[@name=\"librarySwitchButton\"]"))), "Change library account"); diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index f1f137b..894b31c 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -17,10 +17,10 @@ public class SortOptionsScreen extends Screen { private final IButton btnSortBy = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.Button[@index=\"5\"]")), - new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); + new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort by:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnSortByPalace = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView/android.widget.LinearLayout/android.widget.Button")), - new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort By:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); + new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort by:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnAvailability = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//*[contains(@resource-id,\"feedHeaderFacets\")]/android.widget.Button[1]")), new IosLocator(By.xpath("//XCUIElementTypeScrollView//XCUIElementTypeButton[2]"))), "Availability button"); diff --git a/src/test/java/screens/SubcategoryScreen.java b/src/test/java/screens/SubcategoryScreen.java index 5ff41ab..02b83e1 100644 --- a/src/test/java/screens/SubcategoryScreen.java +++ b/src/test/java/screens/SubcategoryScreen.java @@ -35,7 +35,7 @@ public class SubcategoryScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeScrollView//XCUIElementTypeButton[1]"))), "Sort by button in Palace"); private final IButton btnSorting = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.Button[@index=\"5\"]")), - new IosLocator(By.xpath("//XCUIElementTypeScrollView//XCUIElementTypeButton[1]"))), "Sort by button"); + new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"Sort by:\"]/following-sibling::XCUIElementTypeButton"))), "Sort by button"); private final IButton btnAvailability = getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath("//android.widget.HorizontalScrollView//android.widget.Button[1]")), new IosLocator(By.xpath("//XCUIElementTypeScrollView//XCUIElementTypeButton[2]"))), "Availability btn"); diff --git a/src/test/java/stepdefinitions/CatalogSteps.java b/src/test/java/stepdefinitions/CatalogSteps.java index 645df9c..9925c0b 100644 --- a/src/test/java/stepdefinitions/CatalogSteps.java +++ b/src/test/java/stepdefinitions/CatalogSteps.java @@ -109,7 +109,7 @@ public void openCategoriesByChainAndChainStartsFromCategoryScreen(List c @Then("Subcategory name is {string}") public void checkCurrentCategoryName(String expectedCategoryName) { - Assert.assertTrue(String.format("Current category name is not correct! Expected '%1$s' but found '%2$s'", expectedCategoryName, mainToolBarScreen.getCategoryName()), AqualityServices.getConditionalWait().waitFor(() -> mainToolBarScreen.getCategoryName().equals(expectedCategoryName), "Wait while category become correct.")); + Assert.assertEquals(String.format("Current category name is not correct! Expected '%1$s' but found '%2$s'", expectedCategoryName, mainToolBarScreen.getCategoryName()), mainToolBarScreen.getCategoryName(), expectedCategoryName); } @Then("List of books on screen is not equal to list of books saved as {string}") From aea87434fab6df93f66a77136bf436495436b419 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 23:21:18 +0400 Subject: [PATCH 6/9] updated books transactions iOS --- src/test/java/features/BooksTransactions.feature | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/java/features/BooksTransactions.feature b/src/test/java/features/BooksTransactions.feature index 4643e39..eedf195 100644 --- a/src/test/java/features/BooksTransactions.feature +++ b/src/test/java/features/BooksTransactions.feature @@ -10,13 +10,20 @@ Feature: Books transactions in Palace Bookshelf When Open search modal And Search for 'Flower Fables' and save bookName as 'bookNameInfo' - @tier2 - Scenario: Check of GET button + @tier2 @exclude_ios + Scenario: Check of GET button (Android) 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_android + Scenario: Check of GET button (iOS) + 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 DELETE action button on catalog book screen + @tier2 @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' From 389666b30cbb7167b0b03aeb1366ea9a0d33bd82 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 23:23:46 +0400 Subject: [PATCH 7/9] deleted unuseful methods --- src/test/java/screens/SortOptionsScreen.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index 894b31c..038ca23 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -74,16 +74,6 @@ public void openCollection() { btnCollection.click(); } - public List getOptionsInTabs() { - List options = new ArrayList<>(); - getElementFactory().findElements(By.xpath(OPTIONS_IN_TABS_LOCATOR_IOS), ElementType.BUTTON).forEach(option -> options.add(option.getText())); - return options; - } - - public boolean isSortOptionDisplayed(String sortOption) { - return getElementFactory().getButton(By.xpath(String.format(SORT_OPTION_LOCATOR_ANDROID, sortOption)), "Sort option").state().waitForDisplayed(); - } - private void setSortSelection(String value) { getElementFactory().getButton(LocatorUtils.getLocator( new AndroidLocator(By.xpath(String.format(SORT_SELECTION_LOCATOR_ANDROID, value))), From ff7d8e7e011493ee482306f0d76ff57e8356978e Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 23:24:16 +0400 Subject: [PATCH 8/9] deleted imports --- src/test/java/screens/SortOptionsScreen.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index 038ca23..99aadb2 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -1,6 +1,5 @@ package screens; -import aquality.appium.mobile.elements.ElementType; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.screens.Screen; import enums.localization.sortoptions.SortByKeys; @@ -10,9 +9,6 @@ import models.IosLocator; import org.openqa.selenium.By; -import java.util.ArrayList; -import java.util.List; - public class SortOptionsScreen extends Screen { private final IButton btnSortBy = getElementFactory().getButton(LocatorUtils.getLocator( From 682e7d3175bf35b73888c5cae13d1093c0c5ef83 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 27 Feb 2024 23:24:43 +0400 Subject: [PATCH 9/9] deleted fields --- src/test/java/screens/SortOptionsScreen.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/screens/SortOptionsScreen.java b/src/test/java/screens/SortOptionsScreen.java index 99aadb2..db01d34 100644 --- a/src/test/java/screens/SortOptionsScreen.java +++ b/src/test/java/screens/SortOptionsScreen.java @@ -25,9 +25,7 @@ public class SortOptionsScreen extends Screen { new IosLocator(By.xpath("//XCUIElementTypeScrollView//XCUIElementTypeButton[3]"))), "Collection button"); private static final String SORT_SELECTION_LOCATOR_ANDROID = "//*[contains(@resource-id,\"select_dialog_listview\")]//*[@text=\"%1$s\"]"; - private static final String SORT_OPTION_LOCATOR_ANDROID = "//android.widget.TextView[@text=\"%1$s\"]"; private static final String SORT_SELECTION_LOCATOR_IOS = "//XCUIElementTypeButton[@name=\"%1$s\"]"; - private static final String OPTIONS_IN_TABS_LOCATOR_IOS = "//XCUIElementTypeWindow/XCUIElementTypeOther[2]//XCUIElementTypeScrollView//XCUIElementTypeButton"; private final BtnGetVariantsOfSorting btnVariantOfSorting = (button -> getElementFactory().getButton(LocatorUtils.getLocator(