Skip to content

Commit

Permalink
fix: fix end meeting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
quitrk committed Aug 24, 2023
1 parent ac4f136 commit 50ef532
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/test/java/org/jitsi/meet/test/IFrameAPICommandsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1029,14 +1029,10 @@ public void testCommandKickParticipant()

participant1.waitForParticipants(0);

// check that the kicked participant sees the notification
// check that the kicked participant sees the kick reason dialog
assertTrue(
getParticipant2().getNotifications().hasKickedNotification(),
"The second participant should see a warning that was kicked.");

// switchToIframeAPI(driver1);
// FIXME getEventResult(driver1, "participantKickedOut")
// switchToMeetContent(this.iFrameUrl, driver1);
getParticipant2().getDialogs().isLeaveReasonDialogOpen(),
"The second participant should see a dialog that states he was kicked.");
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/jitsi/meet/test/KickTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public void kickParticipant2AndCheck()

participant1.waitForParticipants(0);

// check that the kicked participant sees the notification
// check that the kicked participant sees the kick reason dialog
assertTrue(
getParticipant2().getNotifications().hasKickedNotification(),
"The second participant should see a warning that was kicked.");
getParticipant2().getDialogs().isLeaveReasonDialogOpen(),
"The second participant should see a dialog that states he was kicked.");
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/jitsi/meet/test/LobbyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,10 @@ public void testConferenceEndedInLobby()

WebParticipant participant3 = getParticipant3();

// check that the participant sees the end meeting dialog
assertTrue(
participant3.getNotifications().hasMeetingEndedNotification(),
"The third participant should see a warning that meeting has ended.");
getParticipant3().getDialogs().isLeaveReasonDialogOpen(),
"The second participant should see a dialog that states that the meeting has ended.");

assertFalse(participant3.getLobbyScreen().isLobbyRoomJoined(), "Lobby room not left");

Expand Down
64 changes: 64 additions & 0 deletions src/test/java/org/jitsi/meet/test/pageobjects/web/Dialogs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright @ 2018 8x8 Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.meet.test.pageobjects.web;

import org.jitsi.meet.test.util.*;
import org.jitsi.meet.test.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.interactions.*;

import java.util.*;

/**
* Manages dialogs
*/
public class Dialogs
{
/**
* The participant on current page.
*/
private final WebParticipant participant;

/**
* The test id for the notification when a participant joins.
*/
private static final String LEAVE_REASON_ID = "dialog.leaveReason";

public Dialogs(WebParticipant participant)
{
this.participant = participant;
}

/**
* Whether the given dialog is open.
* @param testId the test id to search for.
* @return whether the given dialog is open.
*/
private boolean isDialogOpen(String testId)
{
return this.participant.getDriver().findElements(ByTestId.testId(testId)).size() > 0;
}

/**
* Whether the leave reason dialog is open.
* @return whether the leave reason dialog is open.
*/
public boolean isLeaveReasonDialogOpen()
{
return isDialogOpen(LEAVE_REASON_ID);
}
}
15 changes: 15 additions & 0 deletions src/test/java/org/jitsi/meet/test/web/WebParticipant.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public class WebParticipant extends Participant<WebDriver>
private AVModerationMenu avModerationMenu;
private BreakoutRoomsList breakoutRoomsList;
private DialInNumbersPage dialInNumbersPage;
private Dialogs dialogs;
private InviteDialog inviteDialog;
private LargeVideo largeVideo;
private LobbyScreen lobbyScreen;
Expand Down Expand Up @@ -682,6 +683,20 @@ public LobbyScreen getLobbyScreen()
return lobbyScreen;
}


/**
* @return a representation of the dialogs.
*/
public Dialogs getDialogs()
{
if (dialogs == null)
{
dialogs = new Dialogs(this);
}

return dialogs;
}

/**
* @return a representation of the notifications.
*/
Expand Down

0 comments on commit 50ef532

Please sign in to comment.