Skip to content

Commit

Permalink
Merge pull request #32 from ThePalaceProject/refactoring_ios
Browse files Browse the repository at this point in the history
Refactoring ios
  • Loading branch information
AEkaterina authored Feb 27, 2024
2 parents b87e53e + 682e7d3 commit 9ef5d70
Show file tree
Hide file tree
Showing 24 changed files with 129 additions and 196 deletions.
11 changes: 9 additions & 2 deletions src/test/java/features/BooksTransactions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
19 changes: 1 addition & 18 deletions src/test/java/features/CatalogNavigation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 '<type1>', '<type2>' and '<type3>' on Subcategory screen in 'Palace Bookshelf'

Expand Down
60 changes: 11 additions & 49 deletions src/test/java/features/Distributors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,47 +78,18 @@ 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
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
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
Expand Down Expand Up @@ -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
Expand All @@ -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
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
32 changes: 1 addition & 31 deletions src/test/java/features/ManageLibraries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 8 additions & 11 deletions src/test/java/features/PdfPalaceIos.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
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
16 changes: 0 additions & 16 deletions src/test/java/features/Search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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
Expand Down
16 changes: 15 additions & 1 deletion src/test/java/framework/utilities/swipe/SwipeElementUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/screens/CatalogBooksScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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\"]";
Expand All @@ -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\")]";
Expand Down
Loading

0 comments on commit 9ef5d70

Please sign in to comment.