Skip to content

Commit

Permalink
feat: update to test components with improved accessibility (#619)
Browse files Browse the repository at this point in the history
* feat(breakout-rooms): update to test breakout-rooms with improved accessibility
  • Loading branch information
emrahcom authored Sep 27, 2023
1 parent 23f566d commit a26a6dc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 20 deletions.
53 changes: 39 additions & 14 deletions src/test/java/org/jitsi/meet/test/AudioVideoModerationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jitsi.meet.test.util.*;
import org.jitsi.meet.test.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.*;
import org.openqa.selenium.support.ui.*;
import org.testng.*;
import org.testng.annotations.*;
Expand Down Expand Up @@ -81,21 +82,25 @@ public void setupClass()
@Test
public void testCheckAudioModerationEnableDisable()
{
WebDriver driver = participant1.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

ParticipantsPane participantsPane = participant1.getParticipantsPane();
AVModerationMenu avModerationMenu = participant1.getAVModerationMenu();

participantsPane.open();

participantsPane.clickContextMenuButton();

avModerationMenu.clickStartAudioModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

// Here we want to try unmuting and check that we are still muted.
tryToAudioUnmuteAndCheck(participant3, participant1);

participantsPane.clickContextMenuButton();

avModerationMenu.clickStopAudioModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participantsPane.close();

Expand All @@ -111,22 +116,26 @@ public void testCheckAudioModerationEnableDisable()
@Test(dependsOnMethods = { "testCheckAudioModerationEnableDisable" })
public void testCheckVideoModerationEnableDisable()
{
WebDriver driver = participant1.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

ParticipantsPane participantsPane = participant1.getParticipantsPane();
AVModerationMenu avModerationMenu = participant1.getAVModerationMenu();

participantsPane.open();

participantsPane.clickContextMenuButton();

avModerationMenu.clickStartVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

// Here we want to try video unmuting and check that we are still muted.
// Make sure that there is the video unmute button
tryToVideoUnmuteAndCheck(participant3, participant1);

participantsPane.clickContextMenuButton();

avModerationMenu.clickStopVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participantsPane.close();

Expand Down Expand Up @@ -161,6 +170,10 @@ public void testUnmuteByModerator()
@Test(dependsOnMethods = { "testUnmuteByModerator" })
public void testHangUpAndChangeModerator()
{
WebDriver driver = participant1.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

participant2.hangUp();
participant3.hangUp();

Expand All @@ -170,12 +183,10 @@ public void testHangUpAndChangeModerator()
participant3.muteAudio(true);

participant1.getParticipantsPane().open();

participant1.getParticipantsPane().clickContextMenuButton();

participant1.getAVModerationMenu().clickStartAudioModeration();

participant1.getAVModerationMenu().clickStartVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participant2.getToolbar().clickRaiseHandButton();

Expand All @@ -190,6 +201,10 @@ public void testHangUpAndChangeModerator()
WebParticipant nonModerator = participant2.isModerator() ? participant3 : participant2;
nonModerator.getParticipantsPane().assertIsParticipantVideoMuted(nonModerator, true);

WebDriver moderatorDriver = moderator.getDriver();
WebElement moderatorBody = moderatorDriver.findElement(By.tagName("body"));
Actions moderatorActions = new Actions(moderatorDriver);

moderator.getParticipantsPane().open();
moderator.getParticipantsPane().allowVideo(nonModerator, false);
moderator.getParticipantsPane().askToUnmute(nonModerator, false);
Expand All @@ -199,6 +214,7 @@ public void testHangUpAndChangeModerator()
moderator.getParticipantsPane().clickContextMenuButton();
moderator.getAVModerationMenu().clickStopAudioModeration();
moderator.getAVModerationMenu().clickStopVideoModeration();
moderatorActions.moveToElement(moderatorBody).moveByOffset(10, 10).perform();
moderator.getParticipantsPane().close();
}

Expand All @@ -212,16 +228,19 @@ public void testGrantModerator()

ensureThreeParticipants();

WebDriver driver = participant1.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

ParticipantsPane participantsPane = participant1.getParticipantsPane();
AVModerationMenu avModerationMenu = participant1.getAVModerationMenu();

participantsPane.open();

participantsPane.clickContextMenuButton();

avModerationMenu.clickStartAudioModeration();

avModerationMenu.clickStartVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participantsPane.close();

Expand Down Expand Up @@ -315,16 +334,20 @@ public void testJoinModerated()

ensureOneParticipant();

WebDriver driver = participant1.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

//enable moderation
ParticipantsPane participantsPane = participant1.getParticipantsPane();
AVModerationMenu avModerationMenu = participant1.getAVModerationMenu();

participantsPane.open();

participantsPane.clickContextMenuButton();

avModerationMenu.clickStartAudioModeration();
avModerationMenu.clickStartVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participantsPane.close();

Expand Down Expand Up @@ -359,15 +382,18 @@ private void unmuteByModerator(WebParticipant moderator, WebParticipant particip
ParticipantsPane participantsPane = moderator.getParticipantsPane();
AVModerationMenu avModerationMenu = moderator.getAVModerationMenu();

WebDriver driver = moderator.getDriver();
WebElement body = driver.findElement(By.tagName("body"));
Actions actions = new Actions(driver);

participantsPane.open();

if (turnOnModeration)
{
participantsPane.clickContextMenuButton();

avModerationMenu.clickStartAudioModeration();

avModerationMenu.clickStartVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();
}

raiseHandToSpeak(participant);
Expand All @@ -380,10 +406,9 @@ private void unmuteByModerator(WebParticipant moderator, WebParticipant particip
if (stopModeration)
{
participantsPane.clickContextMenuButton();

avModerationMenu.clickStopAudioModeration();

avModerationMenu.clickStopVideoModeration();
actions.moveToElement(body).moveByOffset(10, 10).perform();

participantsPane.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ public void joinRoom()
WebElement listItem = TestUtils.waitForElementBy(participant.getDriver(),
By.xpath("//div[@data-testid='" + id + "']"), 5);

Actions hoverOnBreakoutRoomListItem = new Actions(participant.getDriver());
hoverOnBreakoutRoomListItem.moveToElement(listItem);
hoverOnBreakoutRoomListItem.perform();
Actions clickOnBreakoutRoomListItem = new Actions(participant.getDriver());
clickOnBreakoutRoomListItem.click(listItem);
clickOnBreakoutRoomListItem.perform();

WebElement joinButton = TestUtils.waitForElementBy(participant.getDriver(),
ByTestId.testId("join-room-" + id), 2);
Expand All @@ -161,9 +161,9 @@ private void openContextMenu()
WebElement listItem = TestUtils.waitForElementBy(participant.getDriver(),
By.xpath("//div[@data-testid='" + id + "']"), 5);

Actions hoverOnBreakoutRoomListItem = new Actions(participant.getDriver());
hoverOnBreakoutRoomListItem.moveToElement(listItem);
hoverOnBreakoutRoomListItem.perform();
Actions clickOnBreakoutRoomListItem = new Actions(participant.getDriver());
clickOnBreakoutRoomListItem.click(listItem);
clickOnBreakoutRoomListItem.perform();

String cssSelector = MeetUIUtils.getAccessibilityCSSSelector(MORE_LABEL);
listItem.findElement(By.cssSelector(cssSelector)).click();
Expand Down

0 comments on commit a26a6dc

Please sign in to comment.