Skip to content

Commit

Permalink
Merge pull request #34 from ThePalaceProject/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
AEkaterina authored Mar 6, 2024
2 parents 165822e + 8f37de0 commit b646933
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 267 deletions.
1 change: 0 additions & 1 deletion src/test/java/features/Distributors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Feature: Distributors
| Axis 360 | AUDIOBOOK | Audiobooks |
| Palace Marketplace | EBOOK | eBooks |
| Palace Marketplace | AUDIOBOOK | Audiobooks |
| Biblioboard | EBOOK | eBooks |

@logout @returnBooks @tier2
Scenario Outline: Getting and returning books from Book Detail View in LYRASIS Reads
Expand Down
116 changes: 1 addition & 115 deletions src/test/java/features/EpubOverdrive.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: Read EPUB from Overdrive in A1QA
Feature: Read EPUB from Overdrive in A1QA Test Library

Background:
Given Close tutorial screen
Expand Down Expand Up @@ -114,117 +114,3 @@ Feature: Read EPUB from Overdrive in A1QA
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: Epub: Font settings: Check of increasing and reducing the text size
# When Search for "The Woman in White" 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
# And Scroll page forward from 7 to 9 times
# And Save font size as 'fontSize'
# And Open font settings
# And INCREASE_FONT of text
# Then Font size 'fontSize' is increased
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Font size 'fontSize' is increased
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Font size 'fontSize' is increased
# When Save font size as 'fontSize'
# And Open font settings
# And DECREASE_FONT of text
# Then Font size 'fontSize' is decreased
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Font size 'fontSize' is decreased
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Font size 'fontSize' is decreased

# @logout @returnBooks @tier2
# Scenario: Epub: Font settings: Check of font style
# When Search for "A Game of Thrones" 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
# And Scroll page forward from 7 to 9 times
# And Open font settings
# And Change font style to FONT_SERIF
# Then Book text displays in FONT_SERIF font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_SERIF font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_SERIF font
# When Open font settings
# And Change font style to FONT_SANS
# Then Book text displays in FONT_SANS font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_SANS font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_SANS font
# When Open font settings
# And Change font style to FONT_DYSLEXIC
# Then Book text displays in FONT_DYSLEXIC font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_DYSLEXIC font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_DYSLEXIC font

# @logout @returnBooks @tier2
# Scenario: Epub: Font settings: Check of text theme
# When Search for "The Adventures of Sherlock Holmes" 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
# And Scroll page forward from 7 to 9 times
# And Open font settings
# When Change contrast to BLACK_TEXT_ON_WHITE
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Open font settings
# And Change contrast to BLACK_TEXT_ON_SEPIA
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Open font settings
# And Change contrast to WHITE_TEXT_ON_BLACK
# Then The WHITE_TEXT_ON_BLACK background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The WHITE_TEXT_ON_BLACK background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The WHITE_TEXT_ON_BLACK background is correct
122 changes: 6 additions & 116 deletions src/test/java/features/EpubPalace.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Read EPUB in Palace Bookshelf
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
Then 'bookInfo' book is present on epub reader screen
When Scroll page forward from 3 to 5 times
When Scroll page forward from 3 to 7 times
And Open navigation bar on reader epub screen
And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen
And Tap on right book corner on epub reader screen
Expand All @@ -30,6 +30,7 @@ Feature: Read EPUB in Palace Bookshelf
When 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
And Scroll page forward from 3 to 5 times
And Open navigation bar on reader epub screen
And Add bookmark on reader epub screen
And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen
Expand All @@ -42,8 +43,6 @@ Feature: Read EPUB in Palace Bookshelf
And Open bookmarks epub screen
Then Bookmark with 'chapterNameKey' and 'deviceTimeDateKey' is displayed on bookmarks epub screen
And Bookmark with 'chapterNameKey2' and 'deviceTimeDateKey2' is displayed on bookmarks epub screen
When Open random bookmark and save chapter name as 'chapterNameKey3' on bookmarks epub screen
Then 'chapterNameKey3' chapter name is displayed on reader epub screen

@tier2
Scenario: Delete bookmarks
Expand All @@ -58,14 +57,15 @@ Feature: Read EPUB in Palace Bookshelf
And Add bookmark on reader epub screen
And Save pageNumber as 'pageNumberKey' and chapterName as 'chapterNameKey' on epub reader screen
And Save device time and date as 'deviceTimeDateKey'
And Scroll page forward from 3 to 6 times
And Add bookmark on reader epub screen
And Open navigation bar on reader epub screen
And Open bookmarks epub screen
And Delete bookmark on bookmarks epub screen
Then Bookmark with 'chapterNameKey' and 'deviceTimeDateKey' is not displayed on bookmarks epub screen
When Return to reader epub screen from toc bookmarks epub screen
And Click on left book corner on epub reader screen
Then 'chapterNameKey' chapter name is displayed on reader epub screen
And Bookmark is not displayed on reader epub screen
And Delete bookmark on reader epub screen
Then Bookmark is not displayed on reader epub screen

@tier2
Scenario: Navigate by Table of Contents Menu
Expand All @@ -88,116 +88,6 @@ Feature: Read EPUB in Palace Bookshelf
And Open font and background settings epub screen
Then Font and background settings epub screen is opened

# @tier2 @exclude_android
# Scenario: Font settings: Check of increasing and reducing the text size
# When 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
# And Scroll page forward from 7 to 9 times
# And Save font size as 'fontSize'
# And Open font settings
# And INCREASE_FONT of text
# Then Font size 'fontSize' is increased
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Font size 'fontSize' is increased
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Font size 'fontSize' is increased
# When Save font size as 'fontSize'
# And I DECREASE_FONT of text
# Then Font size 'fontSize' is decreased
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Font size 'fontSize' is decreased
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Font size 'fontSize' is decreased

# @tier2 @exclude_android
# Scenario: Font settings: Check of font style
# When 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
# And Scroll page forward from 7 to 9 times
# And Open font settings
# And Change font style to FONT_SERIF
# Then Book text displays in FONT_SERIF font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_SERIF font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_SERIF font
# When Open font settings
# And Change font style to FONT_SANS
# Then Book text displays in FONT_SANS font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_SANS font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_SANS font
# When Open font settings
# And Change font style to FONT_DYSLEXIC
# Then Book text displays in FONT_DYSLEXIC font
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then Book text displays in FONT_DYSLEXIC font
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then Book text displays in FONT_DYSLEXIC font

# @tier2 @exclude_android
# Scenario: Font settings: Check of text theme
# When 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
# And Scroll page forward from 7 to 9 times
# And Open font settings
# And Change contrast to BLACK_TEXT_ON_WHITE
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_WHITE background is correct
# When Open font settings
# And Change contrast to BLACK_TEXT_ON_SEPIA
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The BLACK_TEXT_ON_SEPIA background is correct
# When Open font settings
# And Change contrast to WHITE_TEXT_ON_BLACK
# Then The WHITE_TEXT_ON_BLACK background is correct
# When Restart app
# And Open Books
# And Open EBOOK book with READ action button and 'bookInfo' bookInfo on books screen
# And Click READ action button on book details screen
# Then The WHITE_TEXT_ON_BLACK background is correct
# When Return to previous screen from epub
# And Click READ action button on book details screen
# Then The WHITE_TEXT_ON_BLACK background is correct

@tier2
Scenario: Open book to last page read
When Click GET action button on EBOOK book with 'bookNameInfo' bookName on Catalog books screen and save book as 'bookInfo'
Expand Down
19 changes: 9 additions & 10 deletions src/test/java/screens/epub/BookmarksEpubScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class BookmarksEpubScreen extends Screen {
new AndroidLocator(By.id("tocBookmarksList")),
new IosLocator(By.xpath("//XCUIElementTypeTable"))), "Bookmarks tab");
private final IButton btnDelete = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.xpath("//android.widget.ImageView[contains(@resource-id,\"bookmarkDelete\")]")),
new AndroidLocator(By.xpath("//android.widget.Button[@text=\"Delete\"]")),
new IosLocator(By.name("Delete"))), "Delete bookmark button");

private static final String BTN_DELETE_LOC_ANDROID = "//android.widget.ImageView[contains(@resource-id,\"bookmarkDelete\")]";
Expand All @@ -57,6 +57,9 @@ public boolean isBookmarkScreenOpened() {

public boolean isBookmarkPresent(String expectedBookmarkTitle, String bookmarkDateTime) {
LocalDateTime expectedLocalDateTime = DateUtils.getExpectedLocalDateTime(bookmarkDateTime);
if (expectedBookmarkTitle == null) {
expectedBookmarkTitle = "";
}

AqualityServices.getLogger().info("expected bookmark info: ");
AqualityServices.getLogger().info("expected bookmark title-" + expectedBookmarkTitle);
Expand All @@ -67,10 +70,11 @@ public boolean isBookmarkPresent(String expectedBookmarkTitle, String bookmarkDa
AqualityServices.getLogger().info("expected hour-" + expectedLocalDateTime.getHour());
boolean isBookmarkPresent = false;

System.out.println("List size: " + getListOfBookmarkTitles().size());

for (int i = 0; i < getListOfBookmarkTitles().size(); i++) {
String actualBookmarkTitle = getListOfBookmarkTitles().get(i);
if(actualBookmarkTitle == null) {
actualBookmarkTitle = "";
}
LocalDateTime actualLocalDateTime = getActualLocalDateTime(getListOfBookmarkTimeDates().get(i));
AqualityServices.getLogger().info("bookmark number " + i + " info: ");
AqualityServices.getLogger().info("actual bookmark title-" + actualBookmarkTitle);
Expand Down Expand Up @@ -116,7 +120,7 @@ public void openBookmark(int bookmarkNumber) {

public void deleteBookmark(int bookmarkNumber) {
ActionProcessorUtils.doForAndroid(() -> {
getListOfDeleteBtns().get(bookmarkNumber).click();
getListOfDeleteBtns().get(bookmarkNumber + 1).click();
btnDelete.click();
});

Expand All @@ -131,11 +135,6 @@ private List<IButton> getListOfDeleteBtns() {
return getElementFactory().findElements(By.xpath(BTN_DELETE_LOC_ANDROID), ElementType.BUTTON);
}

private LocalDateTime getExpectedLocalDateTimeIos(String stringExpectedDateTime) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("y-M-dd HH:m:s");
return LocalDateTime.parse(deleteSomeCharactersForExpectedDateTime(stringExpectedDateTime), dateTimeFormatter);
}

private String deleteSomeCharactersForExpectedDateTime(String stringExpectedDateTime) {
return stringExpectedDateTime.split("\\+")[0].replace("T", " ");
}
Expand All @@ -150,7 +149,7 @@ private LocalDateTime getActualLocalDateTime(String stringActualDateTime) {
DateTimeFormatter dateTimeFormatter = ActionProcessorUtils.doForAndroid(() -> DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

if(dateTimeFormatter == null) {
ActionProcessorUtils.doForIos(() -> DateTimeFormatter.ofPattern("dd.MM.yyyy, HH:mm"));
dateTimeFormatter = ActionProcessorUtils.doForIos(() -> DateTimeFormatter.ofPattern("dd.MM.yyyy, HH:mm"));
}
return LocalDateTime.parse(deleteSomeCharactersForActualDateTime(stringActualDateTime), Objects.requireNonNull(dateTimeFormatter));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class FontAndBackgroundSettingsEpubScreen extends Screen {
public FontAndBackgroundSettingsEpubScreen() {
super(LocatorUtils.getLocator(
new AndroidLocator(By.xpath("//android.widget.FrameLayout[contains(@resource-id,\"custom\")]")),
new IosLocator(By.xpath("//XCUIElementTypeButton[@name=\"Sans font\"]"))), "Font and Background settings screen");
new IosLocator(By.xpath("//XCUIElementTypeButton[@name=\"Font selector: Sans font\"]"))), "Font and Background settings screen");
}
}
Loading

0 comments on commit b646933

Please sign in to comment.