def room(**data): module = Atom('Room') expected = [ 'room_id', 'name', 'links', 'description', 'settings', 'members', 'admins', 'data', 'room_type', 'tos', 'tos_update', 'unread', 'mentions', 'readers', 'last_msg', 'update', 'created', 'room_status' ] actual = data my_dict = {} for i in expected: if i in actual.keys(): my_dict.update({i: actual[i]}) else: my_dict.update({i: []}) request_f = (module, my_dict['room_id'], my_dict['name'], my_dict['links'], my_dict['description'], my_dict['settings'], my_dict['members'], my_dict['admins'], my_dict['data'], my_dict['room_type'], my_dict['tos'], my_dict['tos_update'], my_dict['unread'], my_dict['mentions'], my_dict['readers'], my_dict['last_msg'], my_dict['update'], my_dict['created'], my_dict['room_status']) request = bert.encode(request_f) log.info('=' * 5 + 'REQUEST' + '=' * 5 + '\r\n' + str(request_f) + '\r\n') return request
def set_capabilities(): """ This is to set desired capabilities for Appium. All parameters are set in UI/configs/config.ini file :return: """ log.info("Set desired capabilities for %s", config.PLATFORM_NAME) caps = {"deviceName": config.DEVICE_NAME + " Device", "platformName": config.PLATFORM_NAME, "platformVersion": config.PLATFORM_VERSION, 'bundleId': config.BUNDLE_ID, # "appPackage": "com.nynja.mobile.communicator", # "appActivity": "com.nynja.mobile.communicator.ui.activities.SplashActivity", # "noReset": "true" # TODO: Issue with send keys action (Appium) # "automationName": "UiAutomator2" } if config.UDID: caps.update({"udid": config.UDID}) # TODO: This for future implementation cross platform feature # if caps["platformName"] == "iOS": # caps.update({"xcodeOrgId": config.xcode_org_id, "xcodeSigningId": config.xcode_signing_id, # "automationName": "XCUITest"}) return caps
def test_c8186(self): log.info("Select '{}' images and send it to the private chat".format( str(self.SELECT_NUMBER))) menu = Menu(self.driver) gallery = GalleryScreen(self.driver) chat = ChatScreen(self.driver) chat_list = ChatListScreen(self.driver) profile = OtherProfileScreen(self.driver) storage = StorageScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) chat_list.tap_user(self.FRIEND) chat.tap_open_profile() profile.open_storage() exist_images_in_chat = storage.get_count_images() menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) chat_list.tap_user(self.FRIEND) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.MEDIA], menu.wenums.CHATS, menu.wenums.GO_TO_GALLERY) gallery.tap_filter_photo() gallery.multiselect(self.SELECT_NUMBER) gallery.tap_send_btn() chat.tap_open_profile() profile.open_storage() log.info("Verify '{}' images sent to the chat".format( str(self.SELECT_NUMBER))) actual = storage.get_count_images(exist_images_in_chat) Verify.equals(self.SELECT_NUMBER, actual, "Not all images sent to the chat")
def test_c15395(self): log.info( "Select '{}' images and send it to the group chat as files".format( str(self.SELECT_NUMBER))) menu = Menu(self.driver) gallery = GalleryScreen(self.driver) chat = ChatScreen(self.driver) profile = OtherProfileScreen(self.driver) storage = StorageScreen(self.driver) group_list = GroupListScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) chat.tap_open_profile() profile.open_storage() exist_images_in_chat = storage.get_sent_files_count() menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.MEDIA], menu.wenums.CHATS, menu.wenums.GO_TO_GALLERY) gallery.tap_filter_photo() gallery.multiselect(self.SELECT_NUMBER) gallery.open_curtain() gallery.tap_send_as_file() chat.tap_open_profile() profile.open_storage() log.info("Verify '{}' files sent to the chat".format( str(self.SELECT_NUMBER))) actual = storage.get_sent_files_count(exist_images_in_chat) Verify.equals(self.SELECT_NUMBER, actual, "Not all files sent to the chat")
def test_c26409(self): log.info("Close avatar preview") home = HomeScreen(self.driver) home.tap_avatar() home.close_avatar() log.info("Verify Preview was closed") Verify.true(home.is_home_screen_displayed(), "Preview was not closed")
def test_c26309(self): log.info("Hint about empty search result on the group list screen") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) search.set_search(self.INVALID_GROUP_NAME) log.info("Verify Hint about empty search result is shown") Verify.true(search.is_no_result_displayed(), "Hint about empty search result is not shown")
def test_c07(self): log.info("Login to Nynja APP, set phone number '{}'".format(self.PHONE_NUMBER)) login = LoginScreen(self.driver) login.set_full_number(self.COUNTRY_CODE, self.PHONE_NUMBER) login.tap_confirm_btn() log.info("Verify user is unauthorized.") Verify.true(login.error_verify(error_enums.NOT_ALLOW_NUMBER), "Alert doesn't displayed")
def test_c26238(self): log.info("Hint about empty search result on the chat list screen") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) search.set_search(self.INVALID_FRIEND_NAME.swapcase()) log.info("Verify Hint about empty search result is shown") Verify.true(search.error_verify(error_enums.NO_SEARCH_RESULT), "Hint about empty search result is not shown")
def test_c26237(self): log.info("Check that search is case insensitive on the Chats List screen") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) search.set_search(self.FRIEND_NAME.swapcase()) log.info("Verify Particular P2P Chat is in the search result") Verify.true(search.is_result_displayed(self.FRIEND_NAME), "Particular P2P Chat is not in the search result")
def test_c25768(self): log.info("Send sticker message in myself chat") menu = Menu(self.driver) chat = ChatScreen(self.driver) menu.go_to(menu.wenums.MYSELF) chat.tap_sticker_btn() chat.send_first_sticker() log.info("Verify sticker message display") Verify.true(chat.is_sticker_displayed(), "No sent message in list")
def test_tc3(self): log.info("DELETE: Publish new message") response = Request.delete(config.base_url, base_fb.page_header, self.msg_id) log.debug(response) log.info( "Verify response consist parameter 'success' with status 'True'") Verify.true(response['success'], "The parameter 'success' is not equals to 'True'")
def test_c26239(self): log.info("Search on the Chat list screen by part of user name") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) search.set_search(self.PART_NAME) log.info("Verify Particular P2P Chat is in the search result") Verify.true(search.is_result_displayed(self.FRIEND_NAME), "Particular P2P Chat is not in the search result")
def test_c532(self): log.info("Send message in myself") menu = Menu(self.driver) chat = ChatScreen(self.driver) menu.go_to(menu.wenums.MYSELF) chat.set_chat_msg(self.TEXT_MESSAGE) chat.tap_send_btn() log.info("Verify text message sent.") Verify.contains(self.TEXT_MESSAGE, chat.get_text_msg(), "No sent message in list")
def test_c26307(self): log.info("Search on the group list screen") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) search.set_search(self.GROUP_NAME) log.info("Verify group chat is in the search result") Verify.true(search.is_result_displayed(self.GROUP_NAME), "Group Chat is not in the search result")
def test_c26310(self): log.info("Search on the Chat list screen by part of Group name") menu = Menu(self.driver) search = SearchScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) search.set_search(self.PART_GROUP_NAME) log.info("Verify Group Chat is in the search result") Verify.true(search.is_result_displayed(self.GROUP_NAME), "Group Chat is not in the search result")
def test_c534(self): log.info("Send message in myself") menu = Menu(self.driver) chat = ChatScreen(self.driver) menu.go_to(menu.wenums.MYSELF) chat.record_voice_msg() chat.tap_record_send() log.info("Verify voice message sent.") Verify.true(chat.is_voice_displayed(), "No sent voice message in list")
def on_message(self, client, userdata, msg): log.info('='*5 + 'RESPONSE' + '='*5 + '\r\n'+ str(bert.decode(bytes(msg.payload))) + '\r\n') for node in (bert.decode(bytes(msg.payload))): if node == (Atom('ok'), Atom('sms_sent')): client.publish(topic="events/1//api/anon//", payload=bytearray(sms(self.my_number)), qos=2, retain=False) if re.findall(r"\(Atom\('ok2'\), Atom\('login'\)", str(node)): self.clien = str(node[2][0].decode("utf-8")) self.pswd = str(node[2][1].decode("utf-8")) log.info('Got client {} and password {}'.format(self.clien, self.pswd)) client.disconnect()
def test_c2909(self): log.info("Create group with default alias") menu = Menu(self.driver) group = GroupScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.NEW_GROUP]) group.add_user(self.FRIEND) group.tap_done() log.info("Verify alias is match with First / Last name ") Verify.true(group.default_alias(self.MY_USERNAME), "Alias doesn't match")
def test_c11239(self): log.info("Open stickers board") menu = Menu(self.driver) chat = ChatScreen(self.driver) chat_list = ChatListScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) chat_list.tap_user(self.FRIEND) chat.tap_sticker_btn() log.info("Verify sticker board open") Verify.true(chat.is_sticker_board_display(), "No sticker board")
def test_c43777(self): log.info("Received sticker message from p2p chat") menu = Menu(self.driver) chat = ChatScreen(self.driver) chat_list = ChatListScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) chat_list.tap_user(self.FRIEND_NAME) incoming_message(self.CHAT_TYPE, self.MIME) log.info("Verify sticker message received.") Verify.true(chat.is_received_sticker_displayed(), "No received sticker message in list")
def test_c25390(self): log.info("Open custom gallery from myself") menu = Menu(self.driver) gallery = GalleryScreen(self.driver) menu.go_to(menu.wenums.MYSELF) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.MEDIA], menu.wenums.CHATS, menu.wenums.GO_TO_GALLERY) log.info("Verify gallery screen displayed") Verify.true(gallery.is_gallery_screen(), "Gallery screen doesn't display")
def test_c19133(self): log.info("Open stickers board") menu = Menu(self.driver) chat = ChatScreen(self.driver) group_list = GroupListScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) chat.tap_sticker_btn() log.info("Verify sticker board open") Verify.true(chat.is_sticker_board_display(), "No sticker board")
def test_c1910(self): log.info("Open reply screen for replied msg in p2p chat") menu = Menu(self.driver) chat = ChatScreen(self.driver) chat_list = ChatListScreen(self.driver) menu.go_to(menu.wenums.CHATS, [menu.wenums.ALL]) chat_list.tap_user(self.FULL_NAME) chat.open_replay(self.REPLY_COUNT) log.info("Verify reply screen open") Verify.true(chat.is_replay_screen(), "Reply screen doesn't display")
def test_c1911(self): log.info("Open replied screen from first replied msg in group chat") menu = Menu(self.driver) chat = ChatScreen(self.driver) group_list = GroupListScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) chat.open_replay(self.REPLY_COUNT) log.info("Verify replied screen open") Verify.true(chat.is_replay_screen(), "Replied screen doesn't display")
def test_c15469(self): log.info("Check context menu items on sticker message") menu = Menu(self.driver) chat = ChatScreen(self.driver) menu.go_to(menu.wenums.MYSELF) chat.tap_sticker_btn() chat.send_first_sticker() chat.open_sticker_context_menu() log.info("Verify sticker message context menu items") Verify.equals(context_enums.STICKERS_CONTEXT_MENU_ITEMS, chat.get_context_options(), "Items not identical")
def test_c11251(self): log.info("Send sticker message in group chat") menu = Menu(self.driver) chat = ChatScreen(self.driver) group_list = GroupListScreen(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) chat.tap_sticker_btn() chat.send_first_sticker() log.info("Verify sticker message display") Verify.true(chat.is_sticker_displayed(), "No sent message in list")
def test_c21568(self): log.info("Send sticker message in channel") menu = Menu(self.driver) chat = ChatScreen(self.driver) channels = ChannelsListScreen(self.driver) menu.go_to(menu.wenums.CHANNELS, [menu.wenums.MY_CHANNELS]) channels.open_channel(self.CHANNEL_NAME) chat.tap_sticker_btn() chat.send_first_sticker() log.info("Verify sticker message display") Verify.true(chat.is_sticker_displayed(), "No sent message in list")
def test_c15389(self): log.info("Open custom gallery from group chat") gallery = GalleryScreen(self.driver) group_list = GroupListScreen(self.driver) menu = Menu(self.driver) menu.go_to(menu.wenums.GROUPS, [menu.wenums.ALL]) group_list.open_group_chat(self.GROUP_NAME) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.MEDIA], menu.wenums.CHATS, menu.wenums.GO_TO_GALLERY) log.info("Verify gallery screen displayed") Verify.true(gallery.is_gallery_screen(), "Gallery screen doesn't display")
def test_c15468(self): log.info("Check context menu items on voice message") menu = Menu(self.driver) chat = ChatScreen(self.driver) menu.go_to(menu.wenums.MYSELF) chat.record_voice_msg() chat.tap_record_send() chat.open_context_menu_last_bubble() log.info("Verify context menu items") Verify.equals(context_enums.VOICE_CONTEXT_MENU_ITEMS, chat.get_context_options(), "Wrong context menu items")
def test_c536(self): log.info("Send location message") menu = Menu(self.driver) chat = ChatScreen(self.driver) location = LocationScreen(self.driver) menu.go_to(menu.wenums.MYSELF) menu.go_to(menu.wenums.ACTIONS, [menu.wenums.LOCATION], menu.wenums.CHATS) location.tap_send_location() log.info("Verify location message sent.") Verify.true(chat.is_location_displayed(), "No sent message in list")