Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0720aaadd | ||
|
|
33c5d57167 |
@@ -172,4 +172,4 @@
|
||||
:show-line-numbers false
|
||||
:style #js {}
|
||||
:custom-style #js {:backgroundColor nil}}
|
||||
children])
|
||||
#_children])
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
(ns status-im2.contexts.chat.messages.content.text.view
|
||||
(:require
|
||||
[quo2.core :as quo]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[status-im2.contexts.chat.messages.content.text.style :as style]
|
||||
[status-im2.contexts.chat.messages.link-preview.view :as link-preview]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.i18n :as i18n]))
|
||||
(:require [quo2.core :as quo]
|
||||
[quo2.foundations.colors :as colors]
|
||||
[react-native.core :as rn]
|
||||
[status-im2.contexts.chat.messages.content.text.style :as style]
|
||||
[status-im2.contexts.chat.messages.link-preview.view :as link-preview]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn- underline [children]
|
||||
[quo/text {:style {:text-decoration-line :underline}}
|
||||
children])
|
||||
|
||||
;; TODO: ask for an exmaple for multiline quote
|
||||
(defn- quote [children]
|
||||
[rn/view {:style {:flex-direction :row}}
|
||||
[quo/text {:style {:color colors/neutral-40
|
||||
:margin-right 10}}
|
||||
"|"]
|
||||
[quo/text children]])
|
||||
|
||||
(defn render-inline
|
||||
[units {:keys [type literal destination]} chat-id]
|
||||
(case (keyword type)
|
||||
:code
|
||||
(conj units [quo/text {:style (merge style/block (style/code)) :weight :code} literal])
|
||||
(conj units [rn/view {:style (merge style/block (style/code))}
|
||||
[quo/text {:weight :code} literal]])
|
||||
|
||||
:emph
|
||||
(conj units [quo/text {:style {:font-style :italic}} literal])
|
||||
|
||||
:strong
|
||||
(conj units [quo/text {:weight :bold} literal])
|
||||
(conj units [quote literal])
|
||||
|
||||
:strong-emph
|
||||
(conj units
|
||||
[quo/text
|
||||
{:weight :bold
|
||||
:style {:font-style :italic}} literal])
|
||||
(conj units [quo/text
|
||||
{:weight :bold
|
||||
:style {:font-style :italic}}
|
||||
literal])
|
||||
|
||||
:del
|
||||
(conj units [quo/text {:style {:text-decoration-line :line-through}} literal])
|
||||
@@ -38,7 +49,7 @@
|
||||
destination])
|
||||
|
||||
:mention
|
||||
(conj
|
||||
(conj ;; TODO: fix vertical alignment in mention
|
||||
units
|
||||
[rn/touchable-opacity
|
||||
{:active-opacity 1
|
||||
@@ -51,7 +62,6 @@
|
||||
|
||||
:edited
|
||||
(conj units
|
||||
|
||||
[quo/text
|
||||
{:weight :medium
|
||||
:style {:font-size 11 ; Font-size must be used instead of props or the
|
||||
@@ -59,6 +69,7 @@
|
||||
:color (colors/theme-colors colors/neutral-40
|
||||
colors/neutral-50)}}
|
||||
literal])
|
||||
|
||||
:status-tag
|
||||
(let [community-id (rf/sub [:community-id-by-chat-id chat-id])]
|
||||
(conj units
|
||||
@@ -72,29 +83,27 @@
|
||||
|
||||
(conj units literal)))
|
||||
|
||||
|
||||
(defn render-block
|
||||
[blocks {:keys [type literal children]} chat-id]
|
||||
(case (keyword type)
|
||||
:paragraph
|
||||
(conj blocks
|
||||
[rn/view {:style style/paragraph}
|
||||
(reduce
|
||||
(fn [acc e]
|
||||
(render-inline acc e chat-id))
|
||||
(reduce (fn [acc e]
|
||||
(render-inline acc e chat-id))
|
||||
[quo/text]
|
||||
children)])
|
||||
|
||||
:edited-block
|
||||
(conj blocks
|
||||
[rn/view {:style style/paragraph}
|
||||
(reduce
|
||||
(fn [acc e]
|
||||
(render-inline acc e chat-id))
|
||||
(reduce (fn [acc e]
|
||||
(render-inline acc e chat-id))
|
||||
[quo/text]
|
||||
children)])
|
||||
|
||||
:blockquote
|
||||
;; TODO: ask for an exmaple for multiline quote
|
||||
(conj blocks
|
||||
[rn/view {:style style/quote}
|
||||
[quo/text literal]])
|
||||
@@ -117,7 +126,7 @@
|
||||
(update parsed-text
|
||||
(dec items-count)
|
||||
(fn [last-literal]
|
||||
(update last-literal :children into [{:literal " "} edited-tag])))
|
||||
(update last-literal :children conj {:literal " "} edited-tag)))
|
||||
(conj parsed-text {:type :edited-block :children [edited-tag]}))))
|
||||
|
||||
(defn render-parsed-text
|
||||
@@ -127,8 +136,7 @@
|
||||
(render-block acc e chat-id))
|
||||
[:<>]
|
||||
(cond-> (:parsed-text content)
|
||||
edited-at
|
||||
add-edited-tag))])
|
||||
edited-at add-edited-tag))])
|
||||
|
||||
(defn text-content
|
||||
[message-data context]
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
:header [list-header chat]
|
||||
:footer [list-footer chat]
|
||||
:data messages
|
||||
:render-data render-data
|
||||
:render-data render-data ;; TODO: What does this key do?
|
||||
:render-fn render-fn
|
||||
:on-viewable-items-changed on-viewable-items-changed
|
||||
:on-end-reached list-on-end-reached
|
||||
|
||||
@@ -228,6 +228,7 @@
|
||||
(re-frame/subscribe [:chats/joined chat-id])])
|
||||
(fn [[message-list messages pin-messages loading-messages? synced-from chat-type joined] [_ chat-id]]
|
||||
;;TODO (perf)
|
||||
|
||||
(let [message-list-seq (models.message-list/->seq message-list)]
|
||||
; Don't show gaps if that's the case as we are still loading messages
|
||||
(if (and (empty? message-list-seq) loading-messages?)
|
||||
|
||||
@@ -36,7 +36,7 @@ python-dateutil==2.8.1
|
||||
pytz==2020.4
|
||||
PyYAML==5.4
|
||||
repoze.lru==0.7
|
||||
requests==2.28.2
|
||||
requests==2.25.1
|
||||
rlp==3.0.0
|
||||
sauceclient==1.0.0
|
||||
scrypt==0.8.17
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import asyncio
|
||||
import functools
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
import os
|
||||
import json
|
||||
from support.appium_container import AppiumContainer
|
||||
from support.test_data import TestSuiteData
|
||||
import functools
|
||||
|
||||
import time
|
||||
|
||||
|
||||
async def start_threads(quantity: int, func: type, returns: dict, *args):
|
||||
loop = asyncio.get_event_loop()
|
||||
# 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)
|
||||
# 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)
|
||||
# returns[i] = loop.run_in_executor(None, functools.partial(func, **kwargs))
|
||||
for k in returns:
|
||||
returns[k] = await returns[k]
|
||||
return returns
|
||||
@@ -44,7 +44,6 @@ def get_current_time():
|
||||
def debug(text: str):
|
||||
logging.debug(text)
|
||||
|
||||
|
||||
appium_root_project_path = os.path.join(os.sep.join(__file__.split(os.sep)[:-1]), '../')
|
||||
|
||||
pytest_config_global = dict()
|
||||
@@ -55,7 +54,7 @@ common_password = 'qwerty1234'
|
||||
unique_password = 'unique' + get_current_time()
|
||||
pin = '121212'
|
||||
puk = '000000000000'
|
||||
pair_code = '000000'
|
||||
pair_code= '000000'
|
||||
background_service_message = 'Background service for notifications'
|
||||
|
||||
bootnode_address = "enode://a8a97f126f5e3a340cb4db28a1187c325290ec08b2c9a6b1f19845ac86c46f9fac2ba13328822590" \
|
||||
@@ -78,5 +77,6 @@ test_dapp_name = 'simpledapp.status.im'
|
||||
|
||||
emojis = {'thumbs-up': 2, 'thumbs-down': 3, 'love': 1, 'laugh': 4, 'angry': 6, 'sad': 5}
|
||||
|
||||
|
||||
with open(os.sep.join(__file__.split(os.sep)[:-1]) + '/../../../translations/en.json') as json_file:
|
||||
transl = json.load(json_file)
|
||||
|
||||
@@ -15,6 +15,7 @@ from sauceclient import SauceException
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from urllib3.exceptions import MaxRetryError
|
||||
|
||||
from support.api.network_api import NetworkApi
|
||||
from support.github_report import GithubHtmlReport
|
||||
@@ -69,10 +70,10 @@ def get_capabilities_sauce_lab():
|
||||
desired_caps['name'] = test_suite_data.current_test.name
|
||||
desired_caps['platformName'] = 'Android'
|
||||
desired_caps['appiumVersion'] = '1.18.1'
|
||||
desired_caps['platformVersion'] = '12.0'
|
||||
desired_caps['platformVersion'] = '10.0'
|
||||
desired_caps['deviceName'] = 'Android GoogleAPI Emulator'
|
||||
desired_caps['deviceOrientation'] = "portrait"
|
||||
desired_caps['newCommandTimeout'] = 600
|
||||
desired_caps['commandTimeout'] = 600
|
||||
desired_caps['idleTimeout'] = 1000
|
||||
desired_caps['unicodeKeyboard'] = True
|
||||
desired_caps['automationName'] = 'UiAutomator2'
|
||||
@@ -300,21 +301,17 @@ def create_shared_drivers(quantity):
|
||||
capabilities = {'maxDuration': 3600}
|
||||
print('SC Executor: %s' % executor_sauce_lab)
|
||||
try:
|
||||
# options = webdriver.webdriver.AppiumOptions()
|
||||
# for key, value in update_capabilities_sauce_lab(capabilities).items():
|
||||
# options.set_capability(key, value)
|
||||
drivers = loop.run_until_complete(start_threads(quantity,
|
||||
Driver,
|
||||
drivers,
|
||||
executor_sauce_lab,
|
||||
update_capabilities_sauce_lab(capabilities)))
|
||||
Driver,
|
||||
drivers,
|
||||
executor_sauce_lab,
|
||||
update_capabilities_sauce_lab(capabilities)))
|
||||
for i in range(quantity):
|
||||
test_suite_data.current_test.testruns[-1].jobs[drivers[i].session_id] = i + 1
|
||||
drivers[i].implicitly_wait(implicit_wait)
|
||||
return drivers, loop
|
||||
except Exception as e:
|
||||
loop.close()
|
||||
raise e #from None
|
||||
except MaxRetryError as e:
|
||||
test_suite_data.current_test.testruns[-1].error = e.reason
|
||||
|
||||
|
||||
class LocalSharedMultipleDeviceTestCase(AbstractTestCase):
|
||||
@@ -373,14 +370,12 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
||||
geth_names.append(
|
||||
'%s_geth%s.log' % (test_suite_data.current_test.name, str(self.drivers[driver].number)))
|
||||
geth_contents.append(self.pull_geth(self.drivers[driver]))
|
||||
|
||||
except (WebDriverException, AttributeError):
|
||||
pass
|
||||
finally:
|
||||
try:
|
||||
geth = {geth_names[i]: geth_contents[i] for i in range(len(geth_names))}
|
||||
test_suite_data.current_test.geth_paths = self.github_report.save_geth(geth)
|
||||
except IndexError:
|
||||
pass
|
||||
geth = {geth_names[i]: geth_contents[i] for i in range(len(geth_names))}
|
||||
test_suite_data.current_test.geth_paths = self.github_report.save_geth(geth)
|
||||
|
||||
@pytest.fixture(scope='class', autouse=True)
|
||||
def prepare(self, request):
|
||||
@@ -395,30 +390,28 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase):
|
||||
from tests.conftest import sauce
|
||||
requests_session = requests.Session()
|
||||
requests_session.auth = (sauce_username, sauce_access_key)
|
||||
if hasattr(cls, 'drivers'):
|
||||
for _, driver in cls.drivers.items():
|
||||
session_id = driver.session_id
|
||||
for _, driver in cls.drivers.items():
|
||||
session_id = driver.session_id
|
||||
try:
|
||||
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
|
||||
except (RemoteDisconnected, SauceException):
|
||||
pass
|
||||
try:
|
||||
driver.quit()
|
||||
except WebDriverException:
|
||||
pass
|
||||
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "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:
|
||||
try:
|
||||
sauce.jobs.update_job(username=sauce_username, job_id=session_id, name=cls.__name__)
|
||||
except (RemoteDisconnected, SauceException, ConnectionError):
|
||||
pass
|
||||
try:
|
||||
driver.quit()
|
||||
except WebDriverException:
|
||||
pass
|
||||
url = 'https://api.%s/rest/v1/%s/jobs/%s/assets/%s' % (apibase, sauce_username, session_id, "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:
|
||||
try:
|
||||
if command['message'].startswith("Started "):
|
||||
for test in test_suite_data.tests:
|
||||
if command['message'] == "Started %s" % test.name:
|
||||
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
|
||||
except KeyError:
|
||||
continue
|
||||
if hasattr(cls, 'loop'):
|
||||
cls.loop.close()
|
||||
if command['message'].startswith("Started "):
|
||||
for test in test_suite_data.tests:
|
||||
if command['message'] == "Started %s" % test.name:
|
||||
test.testruns[-1].first_commands[session_id] = commands.index(command) + 1
|
||||
except KeyError:
|
||||
continue
|
||||
cls.loop.close()
|
||||
for test in test_suite_data.tests:
|
||||
cls.github_report.save_test(test)
|
||||
|
||||
|
||||
@@ -243,7 +243,6 @@ def should_save_device_stats(config):
|
||||
return all(db_args)
|
||||
|
||||
|
||||
# @pytest.hookimpl(hookwrapper=True)
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_runtest_makereport(item, call):
|
||||
outcome = yield
|
||||
|
||||
@@ -72,17 +72,17 @@ class BaseElement(object):
|
||||
return None
|
||||
|
||||
def find_element(self):
|
||||
# for _ in range(3):
|
||||
try:
|
||||
self.driver.info("Find `%s` by `%s`: `%s`" % (self.name, self.by, self.exclude_emoji(self.locator)))
|
||||
return self.driver.find_element(self.by, self.locator)
|
||||
except NoSuchElementException:
|
||||
raise NoSuchElementException(
|
||||
"Device %s: %s by %s: `%s` is not found on the screen" % (
|
||||
self.driver.number, self.name, self.by, self.locator)) from None
|
||||
# except Exception as exception:
|
||||
# if 'Internal Server Error' in str(exception):
|
||||
# continue
|
||||
for _ in range(3):
|
||||
try:
|
||||
self.driver.info("Find `%s` by `%s`: `%s`" % (self.name, self.by, self.exclude_emoji(self.locator)))
|
||||
return self.driver.find_element(self.by, self.locator)
|
||||
except NoSuchElementException:
|
||||
raise NoSuchElementException(
|
||||
"Device %s: %s by %s: `%s` is not found on the screen" % (
|
||||
self.driver.number, self.name, self.by, self.locator)) from None
|
||||
except Exception as exception:
|
||||
if 'Internal Server Error' in str(exception):
|
||||
continue
|
||||
|
||||
def find_elements(self):
|
||||
return self.driver.find_elements(self.by, self.locator)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import time
|
||||
|
||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException, StaleElementReferenceException
|
||||
from selenium.webdriver.support import expected_conditions
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||
|
||||
from tests import test_dapp_url
|
||||
from views.base_element import Button, Text, BaseElement, SilentButton, CheckBox, EditBox
|
||||
@@ -314,11 +312,6 @@ class HomeView(BaseView):
|
||||
chat_element.cancel_contact_request()
|
||||
else:
|
||||
self.driver.fail("Illegal option for CR!")
|
||||
try:
|
||||
element = self.close_activity_centre.find_element()
|
||||
WebDriverWait(self.driver, 30).until(expected_conditions.staleness_of(element))
|
||||
except TimeoutException:
|
||||
pass
|
||||
self.close_activity_centre.click()
|
||||
self.chats_tab.wait_for_visibility_of_element()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user