Skip to content

Commit

Permalink
Refactor test codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaboleken committed Dec 26, 2024
1 parent f7dcabb commit 0666e73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 131 deletions.
35 changes: 5 additions & 30 deletions test/test_join_leave.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def get_stop_recording_button(self):
stop_recording_button = self.chrome.get_element(By.ID, "stop-recording-button")
return stop_recording_button

#FIXME uncomment test
def _test_home_page_create_room(self):
room = "room"+str(random.randint(100, 999))
app = "/"+self.test_app_name
Expand All @@ -259,7 +258,6 @@ def _test_home_page_create_room(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_home_page_create_random_room(self):
app = "/"+self.test_app_name
if self.url.endswith("localhost:3000"):
Expand All @@ -272,7 +270,6 @@ def _test_home_page_create_random_room(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_camera_mic_setting_in_waiting_room(self):
room = "room"+str(random.randint(100, 999))
app = "/"+self.test_app_name
Expand Down Expand Up @@ -326,7 +323,6 @@ def _test_camera_mic_setting_in_waiting_room(self):
assert(meeting_gallery.is_displayed())
self.chrome.close_all()

#FIXME uncomment test
def _test_join_as_camera_mic_off(self):
room = "room"+str(random.randint(100, 999))
app = "/"+self.test_app_name
Expand All @@ -352,7 +348,6 @@ def _test_join_as_camera_mic_off(self):
self.chrome.close_all()

#this test will not work on local since we have camera and mic in local
#FIXME uncomment test
def _test_join_without_camera_mic(self):
self.chrome.close_all()
self.chrome = Browser()
Expand Down Expand Up @@ -395,8 +390,7 @@ def _test_join_without_camera_mic(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_join_room(self):
def test_join_room(self):
room = "room"+str(random.randint(100, 999))
self.join_room_in_new_tab("participantA", room)
self.chrome.close_all()
Expand All @@ -408,7 +402,6 @@ def set_and_test_tile_count(self, limit):
wait.until(lambda x: self.get_tile_count() == limit)
print("video_track_limit: "+str(limit))

#FIXME uncomment test
def _test_tile_count(self):
#self.chrome.makeFullScreen()
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -511,7 +504,6 @@ def send_reaction(self, reaction):
self.chrome.mouse_click_on(reaction_button)


#FIXME uncomment test
def _test_others_tile(self):
self.chrome.makeFullScreen()
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -563,8 +555,7 @@ def get_publishStreamId(self, index=0):
else:
return self.get_publishStreamId(index=index+1)

#FIXME uncomment test
def _test_join_room_2_participants(self):
def test_join_room_2_participants(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
handle_2 = self.join_room_in_new_tab("participantB", room)
Expand Down Expand Up @@ -597,7 +588,6 @@ def _test_join_room_2_participants(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_with_stats(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -649,7 +639,6 @@ def open_close_participant_list_drawer(self):
self.chrome.click_element(participant_list_button)
time.sleep(2)

#FIXME uncomment test
def _test_screen_share(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -729,7 +718,6 @@ def _test_screen_share(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_reconnection_while_screen_sharing(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -808,8 +796,7 @@ def _test_reconnection_while_screen_sharing(self):



#FIXME uncomment test
def _test_join_room_N_participants(self):
def test_join_room_N_participants(self):
self.chrome.makeFullScreen()
N = 5
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -863,7 +850,6 @@ def _test_join_room_N_participants(self):
self.kill_participants_with_test_tool(process)
self.chrome.close_all()

#FIXME uncomment test
def _test_get_debugme_info(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -893,8 +879,7 @@ def is_video_displayed_for(self, stream_id):
def is_mic_off_displayed_for(self, stream_id):
return self.chrome.is_element_exist(By.ID, "mic-muted-"+stream_id)

#FIXME uncomment test
def _test_on_off_mic_cam(self):
def test_on_off_mic_cam(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
handle_2 = self.join_room_in_new_tab("participantB", room)
Expand Down Expand Up @@ -1040,7 +1025,6 @@ def _test_recording(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_tiled_layout_test(self):
self.chrome.makeFullScreen()
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -1242,7 +1226,6 @@ def _test_pin_on_video_card(self):



#FIXME uncomment test
def _test_pin_on_participant_list(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -1337,7 +1320,6 @@ def _test_pin_on_participant_list(self):

self.chrome.close_all()


#FIXME uncomment test
def _test_mute_on_video_card(self):
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -1394,7 +1376,6 @@ def _test_mute_on_video_card(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_talking_people_frame(self):
self.chrome.close_all()
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -1444,7 +1425,6 @@ def _test_talking_people_frame(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_video_track_assignment(self):
self.chrome.close_all()
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -1527,7 +1507,6 @@ def _test_video_track_assignment(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_camera_mic_setting_in_meeting_room(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -1654,7 +1633,6 @@ def _test_chat_messages(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_reactions(self):
reaction_A = "💖"
reaction_B = "👍🏼"
Expand Down Expand Up @@ -1717,7 +1695,6 @@ def _test_reactions(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_background_replacement(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -1767,7 +1744,6 @@ def rgb_to_hex(self, rgb_string):
return color


#FIXME uncomment test
def _test_theme(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -1851,7 +1827,6 @@ def _test_theme(self):
self.chrome.close_all()


#FIXME uncomment test
def _test_language(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_in_new_tab("participantA", room)
Expand Down Expand Up @@ -1919,4 +1894,4 @@ def _test_language(self):
self.chrome.close_all()

if __name__ == '__main__':
unittest.main()
unittest.main()
105 changes: 4 additions & 101 deletions test/test_webinar.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ def get_role(self, streamId):
print("role of: "+str(role))
return role

#FIXME uncomment test
def _test_presenter_room(self):
def test_presenter_room(self):
room = "room"+str(random.randint(100, 999))
handle_admin = self.join_room_as_admin("adminA", room)
handle_presenter = self.join_room_as_presenter("presenterA", room)
Expand Down Expand Up @@ -371,8 +370,7 @@ def _test_presenter_room(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_both_rooms(self):
def test_both_rooms(self):
self.chrome.makeFullScreen()
# create a room and join as admin and presenter
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -491,7 +489,6 @@ def assertLocalVideoAvailable(self):

assert(localVideo.is_displayed())

#FIXME uncomment test
def _test_with_stats(self):
room = "room"+str(random.randint(100, 999))
handle_1 = self.join_room_as_presenter("participantA", room)
Expand Down Expand Up @@ -528,7 +525,6 @@ def _test_with_stats(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_pin_scenario(self):
# create a room and join as admin and 3 presenters
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -591,8 +587,7 @@ def _test_pin_scenario(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_multiple_player(self):
def test_multiple_player(self):
# create a room and join as admin and presenter
room = "room"+str(random.randint(100, 999))
handle_admin = self.join_room_as_admin("adminA", room)
Expand Down Expand Up @@ -695,98 +690,6 @@ def _test_multiple_player(self):

self.chrome.close_all()

#FIXME uncomment test
def _test_request_to_speak(self):
return
# create a room and join as admin and presenter
room = "room"+str(random.randint(100, 999))
handle_admin = self.join_room_as_admin("adminA", room)
handle_presenter = self.join_room_as_presenter("presenterA", room)

assert(handle_presenter == self.chrome.get_current_tab_id())

assert(self.chrome.get_element_with_retry(By.LABEL,"localVideo").is_displayed())

wait = self.chrome.get_wait()

# check if both participants are in the room and see each other
wait.until(lambda x: len(self.get_participants()) == 2)

self.chrome.switch_to_tab(handle_admin)

wait.until(lambda x: len(self.get_participants()) == 2)

self.chrome.switch_to_tab(handle_presenter)

# playerA joins to listener room
handle_player_A = self.join_room_as_player("playerA", room+"listener")
# there should be no video in listener room
wait.until(lambda x: len(self.get_participants()) == 0)

# playerB joins to listener room
handle_player_B = self.join_room_as_player("playerB", room+"listener")
# there should be no video in listener room
wait.until(lambda x: len(self.get_participants()) == 0)

# switch to admin and add presenter to listener room
self.chrome.switch_to_tab(handle_admin)

presenterId = self.get_id_of_participant("presenterA")

self.open_close_participant_list_drawer()

time.sleep(15)

self.add_presenter_to_listener_room(presenterId)

# switch to playerA and check if presenter is added to listener room
self.chrome.switch_to_tab(handle_player_A)

wait.until(lambda x: len(self.get_participants()) == 1)

# playerA requests to become a publisher
request_to_publisher_button = self.chrome.get_element_with_retry(By.ID,"request-to-publisher-button")
self.chrome.click_element(request_to_publisher_button)

# switch to admin and check if playerA is added to listener room
self.chrome.switch_to_tab(handle_admin)

# participant list should 1 beacuse playerA requested to speak but we did not approve it yet
wait.until(lambda x: len(self.get_participants()) == 2)

# admin checks if there is a request to speak
self.open_close_publisher_request_list_drawer()
wait.until(lambda x: len(self.get_request_publisher_list()) == 1)

# admin approves playerA to become a speaker
approve_button = self.chrome.get_element_with_retry(By.ID,"approve-publisher-request-"+presenterId)
self.chrome.click_element(approve_button)

wait.until(lambda x: len(self.get_request_publisher_list()) == 0)
wait.until(lambda x: len(self.get_participants()) == 3)

# switch to playerA and check if playerA is added to publisher room
self.chrome.switch_to_tab(handle_player_A)
wait.until(lambda x: len(self.get_participants()) == 3)

# switch to playerB and check if there is still 1 participant in the listener room
self.chrome.switch_to_tab(handle_player_B)
wait.until(lambda x: len(self.get_participants()) == 1)

# switch to admin and remove presenter from listener room
self.chrome.switch_to_tab(handle_admin)

tempPresenterId = self.get_id_of_participant("playerA")
self.remove_temporary_speaker_from_presenter_room(tempPresenterId)

wait.until(lambda x: len(self.get_participants()) == 2)

self.chrome.switch_to_tab(handle_player_A)
wait.until(lambda x: len(self.get_participants()) == 1)

self.chrome.close_all()

#FIXME uncomment test
def _test_admin_video_card_controls(self):
# create a room and join as admin and presenter
room = "room"+str(random.randint(100, 999))
Expand Down Expand Up @@ -852,4 +755,4 @@ def _test_admin_video_card_controls(self):
self.chrome.close_all()

if __name__ == '__main__':
unittest.main()
unittest.main()

0 comments on commit 0666e73

Please sign in to comment.