Skip to content

Commit

Permalink
updated audibooks locators
Browse files Browse the repository at this point in the history
  • Loading branch information
AEkaterina committed Oct 27, 2023
1 parent f8a3e5c commit 7f40fbc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
20 changes: 10 additions & 10 deletions src/test/java/features/AudiobookLyrasis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Audiobooks in LYRASIS Reads
Then Audio player screen of book 'bookInfo' is opened
And Chapter name on audio player screen is equal to 'chapterNameKey' saved chapter name
And Pause button is present on audio player screen
When Select 2X playback speed on playback speed audiobook screen
When Select "2.0"X playback speed on playback speed audiobook screen
And Wait for 3 seconds
And Tap pause button on audio player screen
Then Play button is present on audio player screen
Expand Down Expand Up @@ -61,8 +61,9 @@ Feature: Audiobooks in LYRASIS Reads
| Biblioboard |

@logout @returnBooks @tier1
Scenario Outline: Navigate by Audiobook
When Search 'available' book of distributor '<distributor>' and bookType 'AUDIOBOOK' and save as 'bookNameInfo'
Scenario: Navigate by Audiobook
# When Search 'available' book of distributor '<distributor>' and bookType 'AUDIOBOOK' and save as 'bookNameInfo'
When Search for "Pinocchio" 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
Expand All @@ -81,12 +82,12 @@ Feature: Audiobooks in LYRASIS Reads
Then Play button is present on audio player screen
And Playback has been moved behind by 15 seconds from 'timeBehind' and 'chapterTimeKey' seconds on audio player screen

Scenarios:
| distributor |
| Bibliotheca |
| Palace Marketplace |
| Axis 360 |
| Biblioboard |
# Scenarios:
# | distributor |
# | Bibliotheca |
# | Palace Marketplace |
# | Axis 360 |
# | Biblioboard |

@logout @returnBooks @tier1
Scenario Outline: Check end of chapter sleep timer
Expand Down Expand Up @@ -325,7 +326,6 @@ Feature: Audiobooks in LYRASIS Reads
And Open Bookmarks on toc audiobook screen
Then Bookmark for the chapter 'chapterName' with the time 'chapterTime' is saved on Bookmarks screen

# need to fix for ios
@smoke @logout @returnBooks
Scenario: Audiobooks: Perform check of Listen and Back button
When Search for "Down the Hatch" and save bookName as 'bookNameInfo'
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/screens/audiobook/AudioPlayerScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,34 @@ public class AudioPlayerScreen extends Screen {
new IosLocator(By.xpath("//XCUIElementTypeButton[@label=\"Play\"]"))), "Play button");
private final IButton btnBack = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.xpath("//android.widget.ImageButton[@content-desc=\"Back\"]")),
new IosLocator(By.xpath("//XCUIElementTypeNavigationBar/XCUIElementTypeButton[1]"))), "Back button");
new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeImage[@name=\"Back\"]"))), "Back button");
private final IButton btnPause = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.xpath("//android.widget.ImageView[@content-desc=\"Pause\"]")),
new IosLocator(By.xpath("//XCUIElementTypeButton[@label=\"Pause\"]"))), "Pause button");
private final ILabel lblLeftTime = getElementFactory().getLabel(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_time")),
new IosLocator(By.xpath("//XCUIElementTypeStaticText[@name=\"progress_leftLabel\"]"))), "Left time label");
new IosLocator(By.xpath("//XCUIElementTypeOther/XCUIElementTypeStaticText[6]"))), "Left time label");
private final IButton btnToc = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_menu_toc")),
new IosLocator(By.xpath("//XCUIElementTypeNavigationBar//XCUIElementTypeButton[@label=\"Table of contents\"]"))), "TOC button");
private final ILabel lblChapterName = getElementFactory().getLabel(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_spine_element")),
new IosLocator(By.xpath("(//XCUIElementTypeStaticText[@name=\"progress_rightLabel\"])[1]"))), "Chapter name label");
new IosLocator(By.xpath("//XCUIElementTypeOther/XCUIElementTypeStaticText[7]"))), "Chapter name label");
private final IButton btnPlaybackSpeed = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_menu_playback_rate_image")),
new IosLocator(By.xpath("//XCUIElementTypeToolbar//XCUIElementTypeButton"))), "Playback speed button");
new IosLocator(By.xpath("//XCUIElementTypeOther/XCUIElementTypeButton[4]"))), "Playback speed button");
private final ILabel lblRightTime = getElementFactory().getLabel(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_time_maximum")),
new IosLocator(By.xpath("(//XCUIElementTypeStaticText[@name=\"progress_rightLabel\"])[2]"))), "Right time label");
new IosLocator(By.xpath("//XCUIElementTypeOther/XCUIElementTypeStaticText[8]"))), "Right time label");
private final IButton btnSkipAhead = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_jump_forwards")),
new IosLocator(By.name("skip_forward"))), "Skip ahead button");
new IosLocator(By.name("skip forward"))), "Skip ahead button");
private final IButton btnSkipBehind = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_jump_backwards")),
new IosLocator(By.name("skip_back"))), "Skip behind button");
new IosLocator(By.name("skip back"))), "Skip behind button");
private final IButton btnSleepTimer = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.id("player_menu_sleep_image")),
new IosLocator(By.xpath("//XCUIElementTypeToolbar//XCUIElementTypeButton[3]"))), "Sleep timer button");
new IosLocator(By.xpath("//XCUIElementTypeButton[@name=\"Sleep Timer\"]"))), "Sleep timer button");
private final IButton btnSlider = getElementFactory().getButton(LocatorUtils.getLocator(
new AndroidLocator(By.xpath("//android.widget.SeekBar")),
new IosLocator(By.xpath("//XCUIElementTypeOther[@name=\"progress_grip\"]"))), "Slider");
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/screens/audiobook/PlaybackSpeedScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PlaybackSpeedScreen extends Screen {

private static final String PLAYBACK_SPEED_ANDROID = "//*[@text=\"%sx\"]";

private static final String PLAYBACK_SPEED_IOS = "//XCUIElementTypeButton[@name=\"%s\"]";
private static final String PLAYBACK_SPEED_IOS = "//XCUIElementTypeButton[contains(@name,\"%s\")]";

public PlaybackSpeedScreen() {
super(LocatorUtils.getLocator(
Expand All @@ -40,8 +40,7 @@ public PlaybackSpeedScreen() {

public void selectPlaybackSpeed(String playbackSpeed) {
ActionProcessorUtils.doForIos(() -> {
String speedOptionName = speedNameIos.get(playbackSpeed);
getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_IOS, speedOptionName)), speedOptionName).click();
getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_IOS, playbackSpeed)), "Playback speed " + playbackSpeed).click();
});
ActionProcessorUtils.doForAndroid(() -> {
getElementFactory().getButton(By.xpath(String.format(PLAYBACK_SPEED_ANDROID, playbackSpeed)), "Playback speed").click();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/screens/audiobook/TocAudiobookScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class TocAudiobookScreen extends Screen {
private static final String CHAPTERS_LOC_ANDROID = "//android.widget.LinearLayout//android.widget.TextView[contains(@resource-id, \"player_toc_chapter_item_view_title\")]";
private static final String DOWNLOADING_PROGRESS_LOC_ANDROID = "//androidx.recyclerview.widget.RecyclerView//android.widget.RelativeLayout[%d]//android.view.View";

private static final String CHAPTER_NAME_BY_CHAPTER_NUMBER_LOC_IOS = "//XCUIElementTypeTable/XCUIElementTypeCell[%d]/XCUIElementTypeStaticText[1]";
private static final String CHAPTER_NAME_BY_CHAPTER_NUMBER_LOC_IOS = "//XCUIElementTypeCollectionView/XCUIElementTypeCell[%d]//XCUIElementTypeStaticText[1]";

public TocAudiobookScreen() {
super(LocatorUtils.getLocator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ public PlaybackSpeedSteps() {
audioPlayerScreen = new AudioPlayerScreen();
}

@And("Select {double}X playback speed on playback speed audiobook screen")
public void selectPlaybackSpeedOnPlaybackSpeedAudiobookScreen(Double playbackSpeedDouble) {
String playbackSpeed = String.valueOf(playbackSpeedDouble);
@And("Select {string}X playback speed on playback speed audiobook screen")
public void selectPlaybackSpeedOnPlaybackSpeedAudiobookScreen(String playbackSpeed) {
audioPlayerScreen.openPlaybackSpeed();
audioPlayerScreen.getPlaybackSpeedAudiobookScreen().selectPlaybackSpeed(playbackSpeed);
}
Expand Down

0 comments on commit 7f40fbc

Please sign in to comment.