From c103f9dae07a4b2d14729213a6465e70605a9df3 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Wed, 10 Jan 2024 03:15:23 +0400 Subject: [PATCH 1/8] updated smoke for pdf --- src/test/java/screens/pdf/ChaptersPdfScreen.java | 3 +-- src/test/java/stepdefinitions/AccountSteps.java | 7 ++----- src/test/java/stepdefinitions/PdfSteps.java | 3 ++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/java/screens/pdf/ChaptersPdfScreen.java b/src/test/java/screens/pdf/ChaptersPdfScreen.java index 99ab242..d6c7b91 100644 --- a/src/test/java/screens/pdf/ChaptersPdfScreen.java +++ b/src/test/java/screens/pdf/ChaptersPdfScreen.java @@ -36,12 +36,11 @@ private List getChapters() { new IosLocator(By.xpath(CHAPTER_LOCATOR_IOS))), ElementType.LABEL, ElementsCount.ANY, ElementState.EXISTS_IN_ANY_STATE); } - public int openRandomChapter() { + public void openRandomChapter() { int chapterNumber = (int) (Math.random() * (getChapters().size()) + 1); 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_LOCATOR_IOS, chapterNumber)))), "Chapter"); chapter.click(); - return chapterNumber; } } diff --git a/src/test/java/stepdefinitions/AccountSteps.java b/src/test/java/stepdefinitions/AccountSteps.java index da529de..3ff527f 100644 --- a/src/test/java/stepdefinitions/AccountSteps.java +++ b/src/test/java/stepdefinitions/AccountSteps.java @@ -1,10 +1,9 @@ package stepdefinitions; -import aquality.appium.mobile.application.AqualityServices; -import aquality.appium.mobile.application.PlatformName; import com.google.inject.Inject; import enums.keysforcontext.ContextLibrariesKeys; import enums.localization.catalog.ActionButtonsForBooksAndAlertsKeys; +import framework.utilities.ActionProcessorUtils; import framework.utilities.ScenarioContext; import framework.utilities.swipe.SwipeElementUtils; import io.cucumber.java.en.Then; @@ -127,9 +126,7 @@ public void checkAllFieldsAndLinks() { @When("Open Content Licenses on Account screen") public void openAccountLicenses() { - if(AqualityServices.getApplication().getPlatformName()== PlatformName.ANDROID) { - SwipeElementUtils.swipeDown(); - } + ActionProcessorUtils.doForAndroid(SwipeElementUtils::swipeDown); accountScreen.openContentLicenses(); } diff --git a/src/test/java/stepdefinitions/PdfSteps.java b/src/test/java/stepdefinitions/PdfSteps.java index f113366..acaf845 100644 --- a/src/test/java/stepdefinitions/PdfSteps.java +++ b/src/test/java/stepdefinitions/PdfSteps.java @@ -173,7 +173,8 @@ public void returnToReaderFromTOC() { @When("Open random chapter and save the number as {string} on pdf toc screen") public void openRandomChapter(String pageInfoKey){ - context.add(pageInfoKey, chaptersPdfScreen.openRandomChapter()); + chaptersPdfScreen.openRandomChapter(); + context.add(pageInfoKey, readerPdfScreen.getPageNumber()); } @When("Open pdf settings screen on pdf reader screen") From 22bf4b7a7174810659e25594e0c7e05b7d0de9c5 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Wed, 10 Jan 2024 03:36:40 +0400 Subject: [PATCH 2/8] changed book names in epub tests --- src/test/java/features/EpubLyrasis.feature | 8 ++++---- src/test/java/stepdefinitions/PdfSteps.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/features/EpubLyrasis.feature b/src/test/java/features/EpubLyrasis.feature index 3268f75..93c143d 100644 --- a/src/test/java/features/EpubLyrasis.feature +++ b/src/test/java/features/EpubLyrasis.feature @@ -365,7 +365,7 @@ Feature: Read EPUB in Lyrasis Reads @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' + When Search for "Quicksand" 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 @@ -375,7 +375,7 @@ Feature: Read EPUB in Lyrasis Reads @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' + When Search for "The Perishing" 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 @@ -386,7 +386,7 @@ Feature: Read EPUB in Lyrasis Reads @logout @returnBooks @smoke Scenario: Read ebooks: Search: Perform check of finding an existing word - When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + When Search for "Tell A Thousand Lies" 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 @@ -397,7 +397,7 @@ Feature: Read EPUB in Lyrasis Reads @logout @returnBooks @smoke Scenario: Read ebooks: Search: Perform check of the "Delete" button - When Search for "Make for the Hills" and save bookName as 'bookNameInfo' + When Search for "Writing Wild" 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 diff --git a/src/test/java/stepdefinitions/PdfSteps.java b/src/test/java/stepdefinitions/PdfSteps.java index acaf845..0fc5f1a 100644 --- a/src/test/java/stepdefinitions/PdfSteps.java +++ b/src/test/java/stepdefinitions/PdfSteps.java @@ -158,7 +158,7 @@ public void openRandomThumbnail(String pageInfoKey) { context.add(pageInfoKey, tocBookmarksPdfScreen.getThumbnailsPdfScreen().openRandomThumbnail()); } - @When("Open {} thumbnail and save the number as {string} on pdf toc screen") + @When("Open {int} thumbnail and save the number as {string} on pdf toc screen") public void openCurrentThumbnail(int thumbnailNumber, String pageNumberKey) { context.add(pageNumberKey, thumbnailNumber); tocBookmarksPdfScreen.getThumbnailsPdfScreen().openThumbnail(thumbnailNumber); From d88fb3be2d08342755f5dc4f472c10760c89ca4f Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Wed, 10 Jan 2024 04:39:50 +0400 Subject: [PATCH 3/8] changed book names in smoke tests --- src/test/java/features/AudiobookLyrasis.feature | 2 +- src/test/java/features/BookDetailView.feature | 2 +- src/test/java/features/PdfLyrasisIos.feature | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/java/features/AudiobookLyrasis.feature b/src/test/java/features/AudiobookLyrasis.feature index abc3843..a9e391c 100644 --- a/src/test/java/features/AudiobookLyrasis.feature +++ b/src/test/java/features/AudiobookLyrasis.feature @@ -342,7 +342,7 @@ Feature: Audiobooks in LYRASIS Reads @smoke @logout @returnBooks Scenario: Audiobooks: Perform check of Play button and Pause buttons - When Search for "Down the Hatch" and save bookName as 'bookNameInfo' + When Search for "The Wizard of Oz" and save bookName 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 diff --git a/src/test/java/features/BookDetailView.feature b/src/test/java/features/BookDetailView.feature index 38e8aee..88d75b4 100644 --- a/src/test/java/features/BookDetailView.feature +++ b/src/test/java/features/BookDetailView.feature @@ -435,7 +435,7 @@ Feature: Book detail view screen Then Library "LYRASIS Reads" is opened on Libraries screen When Open Catalog And Open search modal - And Search for "Renaissance Futurities" and save bookName as 'bookNameInfo' + And Search for "Friended" and save bookName as 'bookNameInfo' And Open book with GET action button and 'bookNameInfo' bookName on catalog books screen And Click GET action button on Book details screen Then Sing in screen is opened diff --git a/src/test/java/features/PdfLyrasisIos.feature b/src/test/java/features/PdfLyrasisIos.feature index ba2b606..1ea7814 100644 --- a/src/test/java/features/PdfLyrasisIos.feature +++ b/src/test/java/features/PdfLyrasisIos.feature @@ -155,7 +155,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: IOS: Read pdfs: Pages: Perform check of reader navigating (swiping left and right) When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -171,7 +171,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Search: Perform check that the field allows you to enter characters and delete them When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -186,7 +186,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Search: Perform check of finding a word in the book When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "A Queen From the North" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -200,7 +200,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Perform check of navigation When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "Being Plumville" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -216,7 +216,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Perform check of back button When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "Being Plumville" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -228,7 +228,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Contents with thumbnails: Perform check of navigation When Open search modal - And Search for "Friended" and save bookName as 'bookNameInfo' + And Search for "The Art of Three" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' @@ -244,7 +244,7 @@ Feature: Read PDF in LYRARIS Reads on IOS @smoke @logout @returnBooks @exclude_android Scenario: iOS: Read pdfs: Table of contents: Chapter content: Perform check of navigation When Open search modal - And Search for "Tell A Thousand Lies" and save bookName as 'bookNameInfo' + And Search for "The Art of Three" and save bookName as 'bookNameInfo' And Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' Then EBOOK book with READ action button and 'bookInfo' bookInfo is present on Catalog books screen When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' From d84bd1f4008a337362f08c0e15911bb8ee994ca4 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Thu, 11 Jan 2024 00:31:14 +0400 Subject: [PATCH 4/8] deleted biblioboard from audiobooks --- .../java/features/AudiobookLyrasis.feature | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/test/java/features/AudiobookLyrasis.feature b/src/test/java/features/AudiobookLyrasis.feature index a9e391c..db29b46 100644 --- a/src/test/java/features/AudiobookLyrasis.feature +++ b/src/test/java/features/AudiobookLyrasis.feature @@ -59,7 +59,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Navigate by Audiobook @@ -87,7 +86,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Check end of chapter sleep timer @@ -116,7 +114,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 @exclude_android Scenario Outline: Check of line for time remaining @@ -134,7 +131,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Check of switching to the next time @@ -156,7 +152,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Check playback speed and sleep timer @@ -185,7 +180,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 @exlude_ios Scenario Outline: Check time tracking line @@ -214,7 +208,6 @@ Feature: Audiobooks in LYRASIS Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | - | Biblioboard | @logout @returnBooks @tier1 @exclude_ios Scenario Outline: Check of not rewinding forward and back by tapping on time bar @@ -244,7 +237,6 @@ Feature: Audiobooks in LYRASIS Reads | Palace Marketplace | | Axis 360 | | Bibliotheca | - | Biblioboard | @logout @returnBooks @tier1 Scenario Outline: Playback speed: Check of playback speed @@ -283,13 +275,9 @@ Feature: Audiobooks in LYRASIS Reads | Axis 360 | 1.25 | 8 | 10 | | Axis 360 | 1.50 | 6 | 9 | | Axis 360 | 2.0 | 5 | 10 | - | Biblioboard | 0.75 | 8 | 6 | - | Biblioboard | 1.25 | 8 | 10 | - | Biblioboard | 1.50 | 6 | 9 | - | Biblioboard | 2.0 | 5 | 10 | - | Bibliotheca | 0.75 | 8 | 6 | - | Bibliotheca | 1.25 | 8 | 10 | - | Bibliotheca | 1.50 | 6 | 9 | + | Bibliotheca | 2.0 | 5 | 10 | + | Bibliotheca | 2.0 | 5 | 10 | + | Bibliotheca | 2.0 | 5 | 10 | | Bibliotheca | 2.0 | 5 | 10 | @logout @returnBooks @tier1 From c55c8a30fe80962fed7db70cf6b7f41c395b353d Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Thu, 11 Jan 2024 03:26:45 +0400 Subject: [PATCH 5/8] updated pdf iOS --- src/test/java/features/PdfPalaceIos.feature | 4 ++-- src/test/java/screens/pdf/ChaptersPdfScreen.java | 4 ++-- src/test/java/screens/pdf/ReaderPdfScreen.java | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/test/java/features/PdfPalaceIos.feature b/src/test/java/features/PdfPalaceIos.feature index 4f9fe78..4192030 100644 --- a/src/test/java/features/PdfPalaceIos.feature +++ b/src/test/java/features/PdfPalaceIos.feature @@ -74,10 +74,10 @@ Feature: Read PDF in Palace Bookshelf on IOS Scenario: Navigate by Page slider When Swipe pdf page forward from 4 to 6 times on reader pdf screen And Save page number as 'pageNumber' on pdf reader screen - And Slide page slider RIGHT on reader pdf screen + And Slide page slider LEFT on reader pdf screen Then The 'pageNumber' saved page number is less than the current page number on the reader pdf screen When Save page number as 'pageNumber' on pdf reader screen - And Slide page slider LEFT on reader pdf screen + And Slide page slider RIGHT on reader pdf screen Then The 'pageNumber' saved page number is greater than the current page number on the reader pdf screen @tier2 @exclude_android diff --git a/src/test/java/screens/pdf/ChaptersPdfScreen.java b/src/test/java/screens/pdf/ChaptersPdfScreen.java index d6c7b91..b31e9d2 100644 --- a/src/test/java/screens/pdf/ChaptersPdfScreen.java +++ b/src/test/java/screens/pdf/ChaptersPdfScreen.java @@ -17,8 +17,8 @@ public class ChaptersPdfScreen extends Screen { private static final String CHAPTER_LOCATOR_ANDROID = "//android.view.View[contains(@resource-id, \"outlineView\")]/android.view.View"; 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 = "//XCUIElementTypeTable//XCUIElementTypeCell/XCUIElementTypeStaticText[1]"; - private static final String CHAPTER_NUMBER_LOCATOR_IOS = "//XCUIElementTypeTable//XCUIElementTypeCell/XCUIElementTypeStaticText[@name=\"%d\"]"; + private static final String CHAPTER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell/XCUIElementTypeOther[2]"; + private static final String CHAPTER_NUMBER_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeOther[2]"; public ChaptersPdfScreen () { super(LocatorUtils.getLocator( diff --git a/src/test/java/screens/pdf/ReaderPdfScreen.java b/src/test/java/screens/pdf/ReaderPdfScreen.java index 07767f6..b88b4c8 100644 --- a/src/test/java/screens/pdf/ReaderPdfScreen.java +++ b/src/test/java/screens/pdf/ReaderPdfScreen.java @@ -52,7 +52,10 @@ public boolean isReaderOpened() { public int getPageNumber() { Integer pageNumber = ActionProcessorUtils.doForIos(() -> { openNavigationBar(); - return Integer.parseInt(StringUtils.substringBefore(lblPageNumber.getAttribute(IosAttributes.NAME), "/")); + String pageNumberStr = StringUtils.substringBetween(lblPageNumber.getAttribute(IosAttributes.NAME), "(", "/"); + if(StringUtils.isEmpty(pageNumberStr)) + pageNumberStr = StringUtils.substringBefore(lblPageNumber.getAttribute(IosAttributes.NAME), "/"); + return Integer.parseInt(pageNumberStr); }); if(pageNumber == null) { From aab03d40fdec71cf478d8d877d729855fb2705f2 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Thu, 11 Jan 2024 04:15:44 +0400 Subject: [PATCH 6/8] added biblioboard to epubs --- src/test/java/features/EpubLyrasis.feature | 3 +++ src/test/java/screens/epub/ReaderEpubScreen.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/features/EpubLyrasis.feature b/src/test/java/features/EpubLyrasis.feature index 93c143d..ae6de36 100644 --- a/src/test/java/features/EpubLyrasis.feature +++ b/src/test/java/features/EpubLyrasis.feature @@ -174,6 +174,7 @@ Feature: Read EPUB in Lyrasis Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | + | BiblioBoard | @logout @returnBooks @tier1 Scenario Outline: Navigate by bookmarks @@ -203,6 +204,7 @@ Feature: Read EPUB in Lyrasis Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | + | BiblioBoard | @logout @returnBooks @tier1 Scenario Outline: Delete bookmarks @@ -232,6 +234,7 @@ Feature: Read EPUB in Lyrasis Reads | Bibliotheca | | Palace Marketplace | | Axis 360 | + | BiblioBoard | @logout @returnBooks @tier1 Scenario: Read ebooks: Search: Perform check of the placeholder diff --git a/src/test/java/screens/epub/ReaderEpubScreen.java b/src/test/java/screens/epub/ReaderEpubScreen.java index 5aaef0a..4b834b7 100644 --- a/src/test/java/screens/epub/ReaderEpubScreen.java +++ b/src/test/java/screens/epub/ReaderEpubScreen.java @@ -88,7 +88,7 @@ public void hideNavigationBar() { public String getPageNumber() { String pageNumber = ActionProcessorUtils.doForIos(() -> { String number = lblPageNumber.getAttribute(IosAttributes.NAME); - return StringUtils.substringBetween(number, "Page", "of"); + return StringUtils.substringBetween(number, "Page ", " of"); }); if ((pageNumber == null)) { @@ -104,8 +104,9 @@ public String getPageNumber() { public String getChapterName() { String chapterName = ActionProcessorUtils.doForIos(() -> { String chapter = lblChapterName.getAttribute(IosAttributes.NAME); - chapter = RegExUtil.deleteBracketsFromText(chapter); - return RegExUtil.getStringFromThirdGroup(chapter, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); +// chapter = RegExUtil.deleteBracketsFromText(chapter); +// return RegExUtil.getStringFromThirdGroup(chapter, RegEx.PAGE_NUMBER_AND_CHAPTER_NAME_REGEX_FOR_IOS); + return StringUtils.substringAfter(chapter, "("); }); if(chapterName == null) { From 61832a09aff3f38c05935bd5b1fea7190523a53a Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Fri, 12 Jan 2024 04:16:51 +0400 Subject: [PATCH 7/8] added pdfs on Android --- src/test/java/features/PdfPalaceAndroid.feature | 9 ++------- src/test/java/screens/pdf/ThumbnailsPdfScreen.java | 5 ++--- src/test/java/screens/pdf/TocBookmarksPdfScreen.java | 2 -- src/test/java/stepdefinitions/PdfSteps.java | 7 +++++-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/test/java/features/PdfPalaceAndroid.feature b/src/test/java/features/PdfPalaceAndroid.feature index 708ad60..7eb4ddb 100644 --- a/src/test/java/features/PdfPalaceAndroid.feature +++ b/src/test/java/features/PdfPalaceAndroid.feature @@ -1,7 +1,5 @@ Feature: Read PDF in Palace Bookshelf on Android - #there is an issue with TOC - Background: Given Close tutorial screen Then Welcome screen is opened @@ -31,7 +29,6 @@ Feature: Read PDF in Palace Bookshelf on Android When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click READ action button on Book details screen Then Reader pdf screen is opened - When Open TOC on pdf reader screen And There are content list with thumbnails and chapter content on pdf toc screen When Return to pdf reader screen from pdf toc screen Then PDF toc screen is closed @@ -49,8 +46,7 @@ Feature: Read PDF in Palace Bookshelf on Android When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click READ action button on Book details screen Then Reader pdf screen is opened - When Open TOC on pdf reader screen - And Open content with thumbnails on pdf toc screen + When Open content with thumbnails on pdf toc screen Then Thumbnails of the book pages are displayed When Open random thumbnail and save the number as 'pageInfo' on pdf toc screen And Return to pdf reader screen from pdf toc screen @@ -63,8 +59,7 @@ Feature: Read PDF in Palace Bookshelf on Android When Open EBOOK book with READ action button and 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo' And Click READ action button on Book details screen Then Reader pdf screen is opened - When Open TOC on pdf reader screen - And Open text chapter content on pdf toc screen + When Open text chapter content on pdf toc screen Then Text chapter content is opened on pdf toc screen When Open random chapter and save the number as 'pageInfo' on pdf toc screen And Return to pdf reader screen from pdf toc screen diff --git a/src/test/java/screens/pdf/ThumbnailsPdfScreen.java b/src/test/java/screens/pdf/ThumbnailsPdfScreen.java index 974a351..513b4c2 100644 --- a/src/test/java/screens/pdf/ThumbnailsPdfScreen.java +++ b/src/test/java/screens/pdf/ThumbnailsPdfScreen.java @@ -15,7 +15,7 @@ public class ThumbnailsPdfScreen extends Screen { private static final String THUMBNAIL_LOCATOR_ANDROID = "//android.view.View[contains(@content-desc, \"Thumbnail of Page\")]"; - private static final String THUMBNAIL_NUMBER_LOCATOR_ANDROID = "//android.view.View[@content-desc=\"Thumbnail of Page %d\"]"; + private static final String THUMBNAIL_NUMBER_LOCATOR_ANDROID = "//android.view.View[@resource-id=\"thumbnailView\"]/android.view.View[%d]"; private static final String THUMBNAIL_LOCATOR_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell"; private static final String THUMBNAIL_NUMBER_LOCATOR_IOS = "//XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]/XCUIElementTypeStaticText"; @@ -36,13 +36,12 @@ private List getThumbnails(){ new IosLocator(By.xpath(THUMBNAIL_LOCATOR_IOS))), ElementType.LABEL, ElementsCount.ANY, ElementState.EXISTS_IN_ANY_STATE); } - public int openRandomThumbnail() { + public void openRandomThumbnail() { int thumbnailNumber = (int) (Math.random() * (getThumbnails().size()) + 1); ILabel thumbnail = getElementFactory().getLabel(LocatorUtils.getLocator( new AndroidLocator(By.xpath(String.format(THUMBNAIL_NUMBER_LOCATOR_ANDROID, thumbnailNumber))), new IosLocator(By.xpath(String.format(THUMBNAIL_NUMBER_LOCATOR_IOS, thumbnailNumber)))), "Thumbnail"); thumbnail.click(); - return thumbnailNumber; } public void openThumbnail(int thumbnailNumber) { diff --git a/src/test/java/screens/pdf/TocBookmarksPdfScreen.java b/src/test/java/screens/pdf/TocBookmarksPdfScreen.java index d224de9..4c4f3ab 100644 --- a/src/test/java/screens/pdf/TocBookmarksPdfScreen.java +++ b/src/test/java/screens/pdf/TocBookmarksPdfScreen.java @@ -1,6 +1,5 @@ package screens.pdf; -import aquality.appium.mobile.application.AqualityServices; import aquality.appium.mobile.elements.interfaces.IButton; import aquality.appium.mobile.screens.Screen; import framework.utilities.ActionProcessorUtils; @@ -61,7 +60,6 @@ public ThumbnailsPdfScreen getThumbnailsPdfScreen() { public void returnToReaderPdfScreen() { ActionProcessorUtils.doForIos(btnResume::click); - ActionProcessorUtils.doForAndroid(() -> AqualityServices.getApplication().getDriver().navigate().back()); } public void tapBookmarksButton() { diff --git a/src/test/java/stepdefinitions/PdfSteps.java b/src/test/java/stepdefinitions/PdfSteps.java index 0fc5f1a..1eb519a 100644 --- a/src/test/java/stepdefinitions/PdfSteps.java +++ b/src/test/java/stepdefinitions/PdfSteps.java @@ -2,6 +2,7 @@ import aquality.appium.mobile.application.AqualityServices; import com.google.inject.Inject; +import framework.utilities.ActionProcessorUtils; import framework.utilities.ScenarioContext; import framework.utilities.swipe.directions.EntireScreenDragDirection; import io.cucumber.java.en.Then; @@ -155,7 +156,8 @@ public void closePdfReader() { @When("Open random thumbnail and save the number as {string} on pdf toc screen") public void openRandomThumbnail(String pageInfoKey) { - context.add(pageInfoKey, tocBookmarksPdfScreen.getThumbnailsPdfScreen().openRandomThumbnail()); + tocBookmarksPdfScreen.getThumbnailsPdfScreen().openRandomThumbnail(); + context.add(pageInfoKey, readerPdfScreen.getPageNumber()); } @When("Open {int} thumbnail and save the number as {string} on pdf toc screen") @@ -167,7 +169,8 @@ public void openCurrentThumbnail(int thumbnailNumber, String pageNumberKey) { @When("Return to pdf reader screen from pdf toc screen") public void returnToReaderFromTOC() { if (tocBookmarksPdfScreen.getThumbnailsPdfScreen().areThumbnailsDisplayed() || tocBookmarksPdfScreen.getChaptersPdfScreen().areChaptersDisplayed()) { - tocBookmarksPdfScreen.returnToReaderPdfScreen(); + ActionProcessorUtils.doForIos(tocBookmarksPdfScreen::returnToReaderPdfScreen); + ActionProcessorUtils.doForAndroid(() -> readerPdfScreen.getNavigationBarScreen().tapTocBookmarksBarButton()); } } From 7c984d34fd9ccf68ac0b0f865ed71947952ba254 Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Sat, 13 Jan 2024 04:01:52 +0400 Subject: [PATCH 8/8] updated getting books from overdrive --- .../java/features/AudiobookOverdrive.feature | 38 +++++++++---------- src/test/java/screens/CatalogBooksScreen.java | 2 +- .../java/stepdefinitions/CatalogSteps.java | 32 ++++++++++++++++ .../stepdefinitions/GettingBooksStep.java | 2 +- 4 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/test/java/features/AudiobookOverdrive.feature b/src/test/java/features/AudiobookOverdrive.feature index 4f10a4f..28364a4 100644 --- a/src/test/java/features/AudiobookOverdrive.feature +++ b/src/test/java/features/AudiobookOverdrive.feature @@ -15,12 +15,11 @@ Feature: Audiobooks in A1QA library When Enter credentials for "A1QA Test Library" library Then Login is performed successfully When Open Catalog - And Open search modal @logout @returnBooks @tier2 Scenario: Audiobooks: Open the audiobook at the last open chapter and check time code - When Search for "Catching Fire" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -58,8 +57,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Navigate by Audiobook - When Search for "The Hunger Games" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -84,8 +83,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check end of chapter sleep timer - When Search for "Waking the Tiger" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -95,7 +94,6 @@ Feature: Audiobooks in A1QA library 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 "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 @@ -104,8 +102,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 @exclude_android Scenario: Audiobooks: Check of line for time remaining - When Search for "Mockingjay" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -115,8 +113,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check of switching to the next chapter - When Search for "The King's Taster" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -130,8 +128,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check closing playback speed and sleep timer - When Search for "The Lost Symbol" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -149,8 +147,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check time tracking line - When Search for "The Art of Racing in the Rain" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -171,8 +169,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario: Audiobooks: Check of not rewinding forward and back by tapping on time bar - When Search for "Master and Commander" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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 @@ -194,8 +192,8 @@ Feature: Audiobooks in A1QA library @logout @returnBooks @tier2 Scenario Outline: Audiobooks: Playback speed: Check of playback speed - When Search for "The Lightning Thief" and save bookName as 'bookNameInfo' - And Switch to 'Audiobooks' catalog tab + When Switch to "Audiobooks" catalog tab + And 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/screens/CatalogBooksScreen.java b/src/test/java/screens/CatalogBooksScreen.java index 4f2aff4..4c08150 100644 --- a/src/test/java/screens/CatalogBooksScreen.java +++ b/src/test/java/screens/CatalogBooksScreen.java @@ -135,7 +135,7 @@ private List getBooksName() { new IosLocator(By.xpath(BOOK_NAME_LOCATOR_IOS))), ElementType.LABEL); List booksName = new ArrayList<>(); - lblBooks.forEach(book->booksName.add(book.getText().toLowerCase())); + lblBooks.forEach(book->booksName.add(book.getText())); return booksName; } diff --git a/src/test/java/stepdefinitions/CatalogSteps.java b/src/test/java/stepdefinitions/CatalogSteps.java index 7abb553..126605e 100644 --- a/src/test/java/stepdefinitions/CatalogSteps.java +++ b/src/test/java/stepdefinitions/CatalogSteps.java @@ -4,6 +4,7 @@ import com.google.inject.Inject; import constants.RegEx; import constants.localization.catalog.BookActionButtonNames; +import enums.BookType; import enums.localization.catalog.ActionButtonsForBooksAndAlertsKeys; import enums.localization.sortoptions.AvailabilityKeys; import enums.localization.sortoptions.SortByKeys; @@ -11,12 +12,14 @@ import framework.utilities.swipe.SwipeElementUtils; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; +import org.apache.commons.lang3.StringUtils; import org.assertj.core.api.SoftAssertions; import org.junit.Assert; import screens.*; import screens.menubar.MenuBar; import screens.menubar.MenuBarScreen; +import java.security.SecureRandom; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -31,7 +34,9 @@ public class CatalogSteps { private final MainToolBarScreen mainToolBarScreen; private final CatalogBooksScreen catalogBooksScreen; private final SortOptionsScreen sortOptionsScreen; + private final SearchScreen searchScreen; private final ScenarioContext context; + private static final SecureRandom random = new SecureRandom(); @Inject public CatalogSteps(ScenarioContext context){ @@ -42,6 +47,7 @@ public CatalogSteps(ScenarioContext context){ mainToolBarScreen = new MainToolBarScreen(); catalogBooksScreen = new CatalogBooksScreen(); sortOptionsScreen = new SortOptionsScreen(); + searchScreen = new SearchScreen(); } @When("Open Catalog") @@ -273,6 +279,32 @@ public void openLibraryFromSideMenu(String libraryName) { catalogScreen.selectLibraryFromListOfAddedLibraries(libraryName); } + @When("Get {} book from {string} category and save it as {string}") + public void getABookAndSave(BookType bookType, String categoryName, String bookNameKey) { + catalogScreen.state().waitForDisplayed(); + + catalogScreen.openCategory(categoryName); + + AqualityServices.getConditionalWait().waitFor(catalogBooksScreen::isFirstBookInCatalogDisplayed); + + SwipeElementUtils.swipeDown(); + List books = catalogBooksScreen.getListOfBooks(); + + + System.out.println("size: " + books.size()); + + String bookName = books.get(random.nextInt(books.size())); + + if(bookType == BookType.AUDIOBOOK) { + bookName = StringUtils.substringBefore(bookName, ". Audiobook."); + } + + mainToolBarScreen.openSearchModal(); + searchScreen.setSearchedText(bookName); + searchScreen.applySearch(); + context.add(bookNameKey, bookName); + } + private List getSurnames(List list) { List listOfSurnames = new ArrayList<>(); for (String authorName : list) { diff --git a/src/test/java/stepdefinitions/GettingBooksStep.java b/src/test/java/stepdefinitions/GettingBooksStep.java index 5eba9af..bdfb077 100644 --- a/src/test/java/stepdefinitions/GettingBooksStep.java +++ b/src/test/java/stepdefinitions/GettingBooksStep.java @@ -52,7 +52,7 @@ public static String getBookFromSection(String bookType, String distributor) { AqualityServices.getConditionalWait().waitFor(catalogBooksScreen::isFirstBookInCatalogDisplayed); SwipeElementUtils.swipeDown(); - List books = catalogScreen.getListOfBooksNames(); + List books = catalogBooksScreen.getListOfBooks(); int bookIndex = random.nextInt(books.size()); String bookName = books.get(bookIndex); if(bookType.equalsIgnoreCase(BookType.AUDIOBOOK.getBookType())) {