e2e: saucelab new api + remove workarounds
This commit is contained in:
parent
db417cb3a3
commit
c1e3a38cb2
|
@ -52,4 +52,5 @@ hexbytes==0.2.2
|
|||
eth-account==0.7.0
|
||||
lru-dict==1.1.7
|
||||
websockets==10.3
|
||||
websocket-client==1.3.2
|
||||
websocket-client==1.3.2
|
||||
saucelab-api-client==0.6.2
|
|
@ -5,9 +5,8 @@ import os
|
|||
from hashlib import md5
|
||||
from sauceclient import SauceException
|
||||
import re
|
||||
|
||||
from support.test_data import SingleTestData
|
||||
from tests.cloudbase_test_api import sauce, apibase
|
||||
|
||||
|
||||
class BaseTestReport:
|
||||
TEST_REPORT_DIR = "%s/../report" % os.path.dirname(os.path.abspath(__file__))
|
||||
|
@ -102,6 +101,7 @@ class BaseTestReport:
|
|||
|
||||
def get_sauce_job_url(self, job_id, first_command=0):
|
||||
token = self.get_sauce_token(job_id)
|
||||
from tests.conftest import apibase
|
||||
url = 'https://%s/jobs/%s?auth=%s' % (apibase, job_id, token)
|
||||
if first_command > 0:
|
||||
url += "#%s" % first_command
|
||||
|
@ -113,13 +113,17 @@ class BaseTestReport:
|
|||
'?BRANCH_NAME=%s&APK_NAME=%s&PR_ID=%s&TR_CASE_IDS=%s' % (branch_name, apk_name, pr_id, tr_case_ids)
|
||||
|
||||
def get_sauce_final_screenshot_url(self, job_id):
|
||||
token = self.get_sauce_token(job_id)
|
||||
for _ in range(10):
|
||||
try:
|
||||
scr_number = sauce.jobs.get_job_assets(job_id)['screenshots'][-1]
|
||||
return 'https://assets.%s/jobs/%s/%s?auth=%s' % (apibase, job_id, scr_number, token)
|
||||
except SauceException:
|
||||
time.sleep(3)
|
||||
return 'https://media.giphy.com/media/9M5jK4GXmD5o1irGrF/giphy.gif'
|
||||
# temp blocked, no sense with groups
|
||||
# from tests.conftest import sauce, apibase
|
||||
# token = self.get_sauce_token(job_id)
|
||||
# username = sauce.accounts.account_user.get_active_user().username
|
||||
# for _ in range(10):
|
||||
# try:
|
||||
# scr_number = sauce.jobs.get_job_assets(username=username, job_id=job_id)['screenshots'][-1]
|
||||
# return 'https://assets.%s/jobs/%s/%s?auth=%s' % (apibase, job_id, scr_number, token)
|
||||
# except SauceException:
|
||||
# time.sleep(3)
|
||||
|
||||
@staticmethod
|
||||
def is_test_successful(test):
|
||||
|
|
|
@ -11,10 +11,10 @@ import time
|
|||
|
||||
async def start_threads(quantity: int, func: type, returns: dict, *args):
|
||||
loop = asyncio.get_event_loop()
|
||||
from tests.cloudbase_test_api import sauce
|
||||
for _ in range(60):
|
||||
if 16 - len([job for job in sauce.jobs.get_jobs() if job['status'] == 'in progress']) < quantity:
|
||||
time.sleep(10)
|
||||
# from tests.conftest import sauce
|
||||
# for _ in range(60):
|
||||
# if 16 - len([job for job in sauce.jobs.get_user_jobs() if job['status'] == 'in progress']) < quantity:
|
||||
# time.sleep(10)
|
||||
for i in range(quantity):
|
||||
returns[i] = loop.run_in_executor(None, func, *args)
|
||||
for k in returns:
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import asyncio
|
||||
import base64
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from http.client import RemoteDisconnected
|
||||
from os import environ
|
||||
from re import findall
|
||||
|
||||
import pytest
|
||||
|
@ -18,16 +16,13 @@ from selenium.common.exceptions import NoSuchElementException
|
|||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
|
||||
from tests.conftest import option
|
||||
from tests.conftest import option, sauce_username, sauce_access_key
|
||||
from support.api.network_api import NetworkApi
|
||||
from support.github_report import GithubHtmlReport
|
||||
from tests import test_suite_data, start_threads, appium_container, pytest_config_global
|
||||
from tests import transl
|
||||
from tests.cloudbase_test_api import sauce, apibase
|
||||
from tests.conftest import apibase
|
||||
|
||||
sauce_username = environ.get('SAUCE_USERNAME')
|
||||
|
||||
sauce_access_key = environ.get('SAUCE_ACCESS_KEY')
|
||||
|
||||
executor_sauce_lab = 'https://%s:%s@ondemand.%s:443/wd/hub' % (sauce_username, sauce_access_key, apibase)
|
||||
|
||||
|
@ -35,7 +30,6 @@ executor_local = 'http://localhost:4723/wd/hub'
|
|||
|
||||
implicit_wait = 5
|
||||
|
||||
|
||||
def get_capabilities_local():
|
||||
desired_caps = dict()
|
||||
if pytest_config_global['docker']:
|
||||
|
@ -385,12 +379,13 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
|||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
from tests.conftest import sauce
|
||||
requests_session = requests.Session()
|
||||
requests_session.auth = (sauce_username, sauce_access_key)
|
||||
for _, driver in cls.drivers.items():
|
||||
session_id = driver.session_id
|
||||
try:
|
||||
sauce.jobs.update_job(job_id=session_id, name=cls.__name__)
|
||||
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
|
||||
except (RemoteDisconnected, SauceException):
|
||||
pass
|
||||
try:
|
||||
|
@ -400,7 +395,7 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
|||
if option.datacenter == 'eu-central-1':
|
||||
url = 'https://eu-central-1.saucelabs.com/rest/v1/%s/jobs/%s/assets/%s' % (sauce_username, session_id, "log.json")
|
||||
else:
|
||||
url = sauce.jobs.get_job_asset_url(job_id=session_id, filename="log.json")
|
||||
url = sauce.jobs.get_job_asset_url(username=sauce_username, job_id=session_id, filename="log.json")
|
||||
WebDriverWait(driver, 60, 2).until(lambda _: requests_session.get(url).status_code == 200)
|
||||
commands = requests_session.get(url).json()
|
||||
for command in commands:
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
from os import environ
|
||||
import json
|
||||
import requests
|
||||
from io import BytesIO
|
||||
from time import sleep
|
||||
|
||||
from sauceclient import SauceClient, SauceException
|
||||
|
||||
from tests.conftest import option
|
||||
|
||||
try:
|
||||
import http.client as http_client
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
import httplib as http_client
|
||||
from urllib import urlencode
|
||||
|
||||
|
||||
sauce_username = environ.get('SAUCE_USERNAME')
|
||||
sauce_access_key = environ.get('SAUCE_ACCESS_KEY')
|
||||
|
||||
sauce = SauceClient(sauce_username, sauce_access_key)
|
||||
if option.datacenter == 'us-west-1':
|
||||
apibase = 'saucelabs.com'
|
||||
elif option.datacenter == 'eu-central-1':
|
||||
apibase = 'eu-central-1.saucelabs.com'
|
||||
else:
|
||||
raise NotImplementedError("Unknown SauceLabs datacenter")
|
||||
|
||||
|
||||
def request(method, url, body=None, content_type='application/json'):
|
||||
"""This is to monkey patch further this method in order to use apibase"""
|
||||
headers = sauce.make_auth_headers(content_type)
|
||||
connection = http_client.HTTPSConnection(apibase)
|
||||
connection.request(method, url, body, headers=headers)
|
||||
response = connection.getresponse()
|
||||
data = response.read()
|
||||
connection.close()
|
||||
if response.status not in [200, 201]:
|
||||
raise SauceException('{}: {}.\nSauce Status NOT OK'.format(
|
||||
response.status, response.reason), response=response)
|
||||
return json.loads(data.decode('utf-8'))
|
||||
|
||||
|
||||
sauce.request = request
|
||||
|
||||
|
||||
def upload_from_url(apk_path=str()):
|
||||
response = requests.get(apk_path, stream=True)
|
||||
response.raise_for_status()
|
||||
apk_name = apk_path.split("/")[-1]
|
||||
file = BytesIO(response.content)
|
||||
del response
|
||||
for _ in range(3):
|
||||
try:
|
||||
requests.post('https://' + apibase + '/rest/v1/storage/'
|
||||
+ sauce_username + '/' + apk_name + '?overwrite=true',
|
||||
auth=(sauce_username, sauce_access_key),
|
||||
data=file,
|
||||
headers={'Content-Type': 'application/octet-stream'})
|
||||
break
|
||||
except ConnectionError:
|
||||
sleep(10)
|
|
@ -3,10 +3,12 @@ from dataclasses import dataclass
|
|||
from datetime import datetime
|
||||
from http.client import RemoteDisconnected
|
||||
from os import environ
|
||||
from time import sleep
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from _pytest.runner import runtestprotocol
|
||||
from sauceclient import SauceClient, SauceException
|
||||
import requests
|
||||
|
||||
import tests
|
||||
from support.device_stats_db import DeviceStatsDB
|
||||
|
@ -17,7 +19,6 @@ sauce_username = environ.get('SAUCE_USERNAME')
|
|||
sauce_access_key = environ.get('SAUCE_ACCESS_KEY')
|
||||
github_token = environ.get('GIT_HUB_TOKEN')
|
||||
|
||||
sauce = SauceClient(sauce_username, sauce_access_key)
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
|
@ -143,6 +144,8 @@ class Option:
|
|||
option = Option()
|
||||
testrail_report = None
|
||||
github_report = None
|
||||
apibase = None
|
||||
sauce = None
|
||||
|
||||
|
||||
def is_master(config):
|
||||
|
@ -150,13 +153,11 @@ def is_master(config):
|
|||
|
||||
|
||||
def is_uploaded():
|
||||
from tests.cloudbase_test_api import sauce
|
||||
stored_files = sauce.storage.get_stored_files()
|
||||
for i in range(len(stored_files['files'])):
|
||||
if stored_files['files'][i]['name'] == test_suite_data.apk_name:
|
||||
stored_files = sauce.storage.files()
|
||||
for i in range(len(stored_files)):
|
||||
if stored_files[i].name == test_suite_data.apk_name:
|
||||
return True
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
global option
|
||||
option = config.option
|
||||
|
@ -165,9 +166,19 @@ def pytest_configure(config):
|
|||
testrail_report = TestrailReport()
|
||||
from support.github_report import GithubHtmlReport
|
||||
global github_report
|
||||
from saucelab_api_client.saucelab_api_client import SauceLab
|
||||
github_report = GithubHtmlReport()
|
||||
tests.pytest_config_global = vars(config.option)
|
||||
config.addinivalue_line("markers", "testrail_id(name): empty")
|
||||
global apibase
|
||||
if config.getoption('datacenter') == 'us-west-1':
|
||||
apibase = 'saucelabs.com'
|
||||
elif config.getoption('datacenter') == 'eu-central-1':
|
||||
apibase = 'eu-central-1.saucelabs.com'
|
||||
else:
|
||||
raise NotImplementedError("Unknown SauceLabs datacenter")
|
||||
global sauce
|
||||
sauce = SauceLab('https://api.' + apibase +'/', sauce_username, sauce_access_key)
|
||||
if config.getoption('log_steps'):
|
||||
import logging
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
@ -191,11 +202,24 @@ def pytest_configure(config):
|
|||
description='e2e tests are running')
|
||||
if config.getoption('env') == 'sauce':
|
||||
if not is_uploaded():
|
||||
from tests.cloudbase_test_api import sauce, upload_from_url
|
||||
if 'http' in config.getoption('apk'):
|
||||
upload_from_url(config.getoption('apk'))
|
||||
response = requests.get(config.getoption('apk'), stream=True)
|
||||
response.raise_for_status()
|
||||
apk_name = config.getoption('apk').split("/")[-1]
|
||||
file = BytesIO(response.content)
|
||||
del response
|
||||
for _ in range(3):
|
||||
try:
|
||||
requests.post('https://' + apibase + '/rest/v1/storage/'
|
||||
+ sauce_username + '/' + apk_name + '?overwrite=true',
|
||||
auth=(sauce_username, sauce_access_key),
|
||||
data=file,
|
||||
headers={'Content-Type': 'application/octet-stream'})
|
||||
break
|
||||
except ConnectionError:
|
||||
sleep(10)
|
||||
else:
|
||||
sauce.storage.upload_file(config.getoption('apk'))
|
||||
sauce.storage.upload(config.getoption('apk'))
|
||||
|
||||
|
||||
def pytest_unconfigure(config):
|
||||
|
@ -305,10 +329,10 @@ def pytest_runtest_makereport(item, call):
|
|||
|
||||
|
||||
def update_sauce_jobs(test_name, job_ids, passed):
|
||||
from tests.cloudbase_test_api import sauce
|
||||
from sauceclient import SauceException
|
||||
for job_id in job_ids.keys():
|
||||
try:
|
||||
sauce.jobs.update_job(job_id, name=test_name, passed=passed)
|
||||
sauce.jobs.update_job(username=sauce_username, job_id=job_id, name=test_name, passed=passed)
|
||||
except (RemoteDisconnected, SauceException):
|
||||
pass
|
||||
|
||||
|
|
|
@ -982,15 +982,15 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||
self.profile_2.switch_push_notifications()
|
||||
|
||||
self.profile_1.just_fyi("Sending contact request via Profile > Contacts")
|
||||
self.profile_1.click_system_back_button_until_element_is_shown(self.profile_1.contacts_button)
|
||||
self.profile_1.add_contact_via_contacts_list(self.public_key_2)
|
||||
self.profile_1.click_system_back_button_until_element_is_shown(self.profile_1.chats_tab)
|
||||
self.home_1.chats_tab.click()
|
||||
self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2)
|
||||
|
||||
self.home_2.just_fyi("Accepting contact request from activity centre")
|
||||
self.home_2.chats_tab.click()
|
||||
self.home_2.handle_contact_request(self.default_username_1)
|
||||
|
||||
self.profile_1.just_fyi("Sending message to contact via Messages > Recent")
|
||||
self.home_1.chats_tab.click()
|
||||
self.chat_1 = self.home_1.get_chat(self.default_username_2).click()
|
||||
self.chat_1.send_message('hey')
|
||||
self.home_2.click_system_back_button_until_element_is_shown()
|
||||
|
@ -1103,10 +1103,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||
self.errors.append(
|
||||
"Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1)
|
||||
)
|
||||
# workaround for 14672
|
||||
chat.tap_by_coordinates(500, 100)
|
||||
# Part of the test is blocked by #14637
|
||||
#chat.click_system_back_button()
|
||||
chat.click_system_back_button()
|
||||
|
||||
self.home_1.just_fyi("Check that Device1 can not pin more than 3 messages and 'Unpin' dialog appears")
|
||||
for message in (self.message_3, self.message_4):
|
||||
|
@ -1162,7 +1159,6 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||
if not self.chat_1.chat_message_input.is_element_displayed():
|
||||
self.chat_1.click_system_back_button_until_element_is_shown()
|
||||
self.home_1.get_chat(self.default_username_2).click()
|
||||
self.chat_1.send_message("workaround for 14637")
|
||||
messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥']
|
||||
[self.chat_2.send_message(message) for message in messages]
|
||||
for message in messages:
|
||||
|
@ -1324,6 +1320,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||
|
||||
self.home_1.just_fyi('Turn on airplane mode and check that offline status is shown on home view')
|
||||
[home.toggle_airplane_mode() for home in (self.home_1, self.home_2)]
|
||||
|
||||
# Not implemented yet
|
||||
# self.home_1.connection_offline_icon.wait_and_click(20)
|
||||
# for element in self.home_1.not_connected_to_node_text, self.home_1.not_connected_to_peers_text:
|
||||
|
|
|
@ -205,10 +205,11 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
|||
|
||||
self.homes[0].just_fyi('Admin creates group chat')
|
||||
self.chat_name = self.homes[0].get_random_chat_name()
|
||||
# workaround for issue with checkboxes in bottom sheet
|
||||
self.homes[0].communities_tab.click()
|
||||
self.chats[0] = self.homes[0].create_group_chat(user_names_to_add=[self.usernames[1]],
|
||||
group_chat_name=self.chat_name,
|
||||
new_ui=True)
|
||||
# self.homes[0].chats_tab.click()
|
||||
self.chats[0] = self.homes[0].create_group_chat(user_names_to_add=[self.usernames[1], self.usernames[2]],
|
||||
group_chat_name=self.chat_name)
|
||||
for i in range(1, 3):
|
||||
self.chats[i] = ChatView(self.drivers[i])
|
||||
|
||||
|
@ -228,6 +229,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
|||
if pn:
|
||||
pn.click()
|
||||
else:
|
||||
self.errors.append("No PN was received on new message for message in group chat")
|
||||
self.homes[0].click_system_back_button()
|
||||
self.homes[0].get_chat(self.chat_name).click()
|
||||
|
||||
|
@ -243,15 +245,8 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
|||
@marks.testrail_id(702808)
|
||||
def test_group_chat_offline_pn(self):
|
||||
[self.homes[i].click_system_back_button_until_element_is_shown() for i in range(3)]
|
||||
chat_name = 'for_offline_pn'
|
||||
#TODO: workaround for bottom sheet issues
|
||||
self.homes[0].communities_tab.click()
|
||||
self.homes[0].create_group_chat(user_names_to_add=[self.usernames[1], self.usernames[2]],
|
||||
group_chat_name=chat_name,
|
||||
new_ui=True)
|
||||
self.homes[0].click_system_back_button_until_element_is_shown()
|
||||
for i in range(1, 3):
|
||||
self.homes[i].get_chat(chat_name).click()
|
||||
self.homes[i].get_chat(self.chat_name).click()
|
||||
|
||||
message_1, message_2 = 'message from old member', 'message from new member'
|
||||
|
||||
|
@ -269,62 +264,37 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
|
|||
self.errors.append('%s PN was not fetched from offline' % message)
|
||||
self.homes[0].click_system_back_button()
|
||||
self.homes[0].chats_tab.click()
|
||||
self.homes[0].get_chat(chat_name).click()
|
||||
self.homes[0].get_chat(self.chat_name).click()
|
||||
|
||||
self.homes[0].just_fyi("check that messages are shown for every member")
|
||||
for i in range(3):
|
||||
for message in (message_1, message_2):
|
||||
if not self.chats[i].chat_element_by_text(message).is_element_displayed():
|
||||
if not self.chats[i].chat_element_by_text(message).is_element_displayed(30):
|
||||
self.errors.append('%s if not shown for device %s' % (message, str(i)))
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="two_2")
|
||||
@marks.new_ui_critical
|
||||
class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase):
|
||||
|
||||
def prepare_devices(self):
|
||||
self.drivers, self.loop = create_shared_drivers(2)
|
||||
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,))))
|
||||
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
|
||||
self.home_1.browser_tab.click() # temp, until profile is on browser tab
|
||||
self.profile_1 = self.home_1.get_profile_view()
|
||||
self.default_username_1 = self.profile_1.default_username_text.text
|
||||
self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True)
|
||||
self.profile_1.add_contact_via_contacts_list(self.public_key_2)
|
||||
self.home_2.click_system_back_button_until_element_is_shown()
|
||||
self.home_1.click_system_back_button_until_element_is_shown()
|
||||
self.home_1.chats_tab.click()
|
||||
self.home_2.chats_tab.click()
|
||||
self.home_2.handle_contact_request(self.default_username_1)
|
||||
self.home_2.click_system_back_button_until_element_is_shown()
|
||||
# workaround for group chat new UI
|
||||
self.home_1.communities_tab.click()
|
||||
self.group_chat_name = "Group Chat"
|
||||
self.group_chat_1 = self.home_1.create_group_chat(user_names_to_add=[self.default_username_2],
|
||||
group_chat_name=self.group_chat_name,
|
||||
new_ui=True)
|
||||
self.group_chat_2 = self.home_2.get_chat(self.group_chat_name).click()
|
||||
self.group_chat_2.join_chat_button.click_if_shown()
|
||||
self.message_1, self.message_2, self.message_3, self.message_4 = \
|
||||
"Message 1", "Message 2", "Message 3", "Message 4"
|
||||
|
||||
@marks.testrail_id(702732)
|
||||
def test_group_chat_pin_messages(self):
|
||||
self.home_1.just_fyi("Enter group chat and pin message there. It's pinned for both members.")
|
||||
self.drivers[2].quit()
|
||||
|
||||
self.group_chat_1.send_message(self.message_1)
|
||||
self.group_chat_1.pin_message(self.message_1, "pin-to-chat")
|
||||
if not (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30) and
|
||||
self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30)):
|
||||
[self.homes[i].click_system_back_button_until_element_is_shown() for i in range(2)]
|
||||
[self.homes[i].get_chat(self.chat_name).click() for i in range(2)]
|
||||
|
||||
self.message_1, self.message_2, self.message_3, self.message_4 = \
|
||||
"Message 1", "Message 2", "Message 3", "Message 4"
|
||||
self.chats[0].just_fyi("Enter group chat and pin message there. It's pinned for both members.")
|
||||
|
||||
self.chats[0].send_message(self.message_1)
|
||||
self.chats[0].pin_message(self.message_1, "pin-to-chat")
|
||||
if not (self.chats[0].chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30) and
|
||||
self.chats[1].chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30)):
|
||||
self.errors.append("Message 1 is not pinned in group chat!")
|
||||
|
||||
self.home_1.just_fyi("Check that non admin user can not unpin messages")
|
||||
self.group_chat_2.chat_element_by_text(self.message_1).long_press_element()
|
||||
if self.group_chat_2.element_by_translation_id("unpin-from-chat").is_element_displayed():
|
||||
self.chats[0].just_fyi("Check that non admin user can not unpin messages")
|
||||
self.chats[1].chat_element_by_text(self.message_1).long_press_element()
|
||||
if self.chats[1].element_by_translation_id("unpin-from-chat").is_element_displayed():
|
||||
self.errors.append("Unpin option is available for non-admin user")
|
||||
self.group_chat_2.tap_by_coordinates(500, 100)
|
||||
self.chats[1].tap_by_coordinates(500, 100)
|
||||
|
||||
# not implemented yet :
|
||||
|
||||
|
@ -339,32 +309,32 @@ class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase):
|
|||
# self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed()):
|
||||
# self.errors.append("Message failed to be unpinned by user who granted admin permissions!")
|
||||
|
||||
self.home_1.just_fyi("Send, pin messages and check they are pinned")
|
||||
self.chats[0].just_fyi("Send, pin messages and check they are pinned")
|
||||
for message in self.message_2, self.message_3:
|
||||
# here group_chat_1 should be changed to group_chat_2 after enabling the previous block
|
||||
self.group_chat_1.send_message(message)
|
||||
self.group_chat_1.pin_message(message, 'pin-to-chat')
|
||||
if not (self.group_chat_1.chat_element_by_text(message).pinned_by_label.is_element_displayed(30) and
|
||||
self.group_chat_2.chat_element_by_text(message).pinned_by_label.is_element_displayed(30)):
|
||||
self.chats[0].send_message(message)
|
||||
self.chats[0].pin_message(message, 'pin-to-chat')
|
||||
if not (self.chats[0].chat_element_by_text(message).pinned_by_label.is_element_displayed(30) and
|
||||
self.chats[1].chat_element_by_text(message).pinned_by_label.is_element_displayed(30)):
|
||||
self.errors.append("%s is not pinned in group chat!" % message)
|
||||
|
||||
self.home_1.just_fyi("Check that a user can not pin more than 3 messages")
|
||||
self.group_chat_1.send_message(self.message_4)
|
||||
self.group_chat_1.pin_message(self.message_4, 'pin-to-chat')
|
||||
if self.group_chat_1.pin_limit_popover.is_element_displayed(30):
|
||||
self.group_chat_1.view_pinned_messages_button.click_until_presence_of_element(self.group_chat_1.pinned_messages_list)
|
||||
self.group_chat_1.pinned_messages_list.message_element_by_text(self.message_2).click_inside_element_by_coordinate()
|
||||
self.group_chat_1.element_by_translation_id('unpin-from-chat').double_click()
|
||||
self.group_chat_1.chat_element_by_text(self.message_4).click()
|
||||
self.group_chat_1.pin_message(self.message_4, 'pin-to-chat')
|
||||
if not (self.group_chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and
|
||||
self.group_chat_2.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)):
|
||||
self.chats[0].just_fyi("Check that a user can not pin more than 3 messages")
|
||||
self.chats[0].send_message(self.message_4)
|
||||
self.chats[0].pin_message(self.message_4, 'pin-to-chat')
|
||||
if self.chats[0].pin_limit_popover.is_element_displayed(30):
|
||||
self.chats[0].view_pinned_messages_button.click_until_presence_of_element(self.chats[0].pinned_messages_list)
|
||||
self.chats[0].pinned_messages_list.message_element_by_text(self.message_2).click_inside_element_by_coordinate()
|
||||
self.chats[0].element_by_translation_id('unpin-from-chat').double_click()
|
||||
self.chats[0].chat_element_by_text(self.message_4).click()
|
||||
self.chats[0].pin_message(self.message_4, 'pin-to-chat')
|
||||
if not (self.chats[0].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and
|
||||
self.chats[1].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)):
|
||||
self.errors.append("Message 4 is not pinned in group chat after unpinning previous one")
|
||||
else:
|
||||
self.errors.append("Can pin more than 3 messages in group chat")
|
||||
|
||||
self.home_1.just_fyi("Check pinned messages count and content")
|
||||
for chat_number, group_chat in enumerate([self.group_chat_1, self.group_chat_2]):
|
||||
self.chats[0].just_fyi("Check pinned messages count and content")
|
||||
for chat_number, group_chat in enumerate([self.chats[0], self.chats[1]]):
|
||||
count = group_chat.pinned_messages_count.text
|
||||
if count != '3':
|
||||
self.errors.append(
|
||||
|
@ -374,7 +344,7 @@ class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase):
|
|||
pinned_by = group_chat.pinned_messages_list.get_message_pinned_by_text(message)
|
||||
if pinned_by.is_element_displayed():
|
||||
text = pinned_by.text.strip()
|
||||
expected_text = "You" if chat_number == 0 else self.default_username_1
|
||||
expected_text = "You" if chat_number == 0 else self.usernames[0]
|
||||
if text != expected_text:
|
||||
self.errors.append(
|
||||
"Pinned by '%s' doesn't match expected '%s' for user %s" % (
|
||||
|
|
|
@ -720,11 +720,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
|||
|
||||
self.home_1.just_fyi("Check enabling and sending first gif")
|
||||
self.channel_2.send_message(giphy_url)
|
||||
# workaround to get chat view focused
|
||||
self.channel_2.send_message(giphy_url)
|
||||
self.channel_2.element_by_translation_id("dont-ask").click()
|
||||
# workaround to get chat view focused
|
||||
self.channel_1.send_message(giphy_url)
|
||||
self.channel_1.element_by_text("Enable").wait_and_click()
|
||||
|
||||
self.channel_1.element_by_translation_id("enable-all").wait_and_click()
|
||||
|
@ -798,12 +794,10 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
|||
if not self.home_1.communities_tab.is_element_displayed():
|
||||
self.channel_1.click_system_back_button_until_element_is_shown()
|
||||
comm_to_leave_element = self.home_1.get_chat(self.community_leave, community=True)
|
||||
comm_to_leave_element.click()
|
||||
comm_to_leave_element.long_press_element()
|
||||
community_to_leave = CommunityView(self.drivers[0])
|
||||
community_to_leave.community_options_button.click()
|
||||
community_to_leave.community_info_button.click()
|
||||
community_to_leave.leave_community_button.click()
|
||||
community_to_leave.click_system_back_button_until_element_is_shown()
|
||||
community_to_leave.leave_community_button.click()
|
||||
if comm_to_leave_element.is_element_displayed():
|
||||
self.errors.append('Community is still shown in the list after leave')
|
||||
self.errors.verify_no_errors()
|
||||
|
|
|
@ -320,6 +320,11 @@ class HomeView(BaseView):
|
|||
self.new_chat_button = Button(self.driver, accessibility_id="new-chat-button")
|
||||
self.jump_to_button = Button(self.driver, accessibility_id="jump-to")
|
||||
|
||||
# New UI bottom sheet
|
||||
self.start_a_new_chat_bottom_sheet_button = Button(self.driver, accessibility_id="start-a-new-chat")
|
||||
self.add_a_contact_chat_bottom_sheet_button = Button(self.driver, accessibility_id="add-a-contact")
|
||||
|
||||
|
||||
def wait_for_syncing_complete(self):
|
||||
self.driver.info('Waiting for syncing to complete')
|
||||
while True:
|
||||
|
@ -387,26 +392,39 @@ class HomeView(BaseView):
|
|||
|
||||
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat', new_ui=False):
|
||||
self.driver.info("## Creating group chat '%s'" % group_chat_name, device=False)
|
||||
self.new_chat_button.click()
|
||||
chat_view = self.get_chat_view()
|
||||
if new_ui:
|
||||
self.new_chat_button.click()
|
||||
self.start_a_new_chat_bottom_sheet_button.click()
|
||||
[chat_view.get_username_checkbox(user_name).click() for user_name in user_names_to_add]
|
||||
else:
|
||||
self.plus_button.click()
|
||||
chat_view = self.new_group_chat_button.click()
|
||||
if user_names_to_add:
|
||||
for user_name in user_names_to_add:
|
||||
if len(user_names_to_add) > 5:
|
||||
chat_view.search_by_keyword(user_name[:5])
|
||||
chat_view.get_username_checkbox(user_name).click()
|
||||
chat_view.search_input.clear()
|
||||
else:
|
||||
chat_view.get_username_checkbox(user_name).click()
|
||||
chat_view = self.new_group_chat_button.click()
|
||||
if user_names_to_add:
|
||||
for user_name in user_names_to_add:
|
||||
if len(user_names_to_add) > 5:
|
||||
chat_view.search_by_keyword(user_name[:5])
|
||||
chat_view.get_username_checkbox(user_name).click()
|
||||
chat_view.search_input.clear()
|
||||
else:
|
||||
chat_view.get_username_checkbox(user_name).click()
|
||||
chat_view.next_button.click()
|
||||
chat_view.chat_name_editbox.send_keys(group_chat_name)
|
||||
chat_view.create_button.click()
|
||||
self.driver.info("## Group chat %s is created successfully!" % group_chat_name, device=False)
|
||||
return chat_view
|
||||
|
||||
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png', require_approval=True):
|
||||
def send_contact_request_via_bottom_sheet(self, key:str):
|
||||
chat = self.get_chat_view()
|
||||
self.new_chat_button.click()
|
||||
self.add_a_contact_chat_bottom_sheet_button.click()
|
||||
chat.public_key_edit_box.click()
|
||||
chat.public_key_edit_box.send_keys(key)
|
||||
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts)
|
||||
chat.profile_add_to_contacts.click()
|
||||
self.click_system_back_button_until_element_is_shown()
|
||||
|
||||
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png',
|
||||
require_approval=True):
|
||||
self.driver.info("## Creating community '%s', set image is set to '%s'" % (name, str(set_image)), device=False)
|
||||
self.plus_button.click()
|
||||
chat_view = self.communities_button.click()
|
||||
|
|
Loading…
Reference in New Issue