Compare commits

..
Author SHA1 Message Date
alwx aa95efcd44 Updates 2023-04-04 15:27:26 +02:00
alwx afc8ca1976 DepReport 2023-04-04 14:09:04 +02:00
alwx 33055ffe4f dependencyReportTask 2023-04-04 13:57:56 +02:00
alwx c921a20ee8 Fixes 2023-04-04 13:38:08 +02:00
alwx f028f1d0b9 Last attempt 2023-04-04 13:31:25 +02:00
Alexander 4193750c86 Merge branch 'develop' into gradle-experiments 2023-04-03 18:07:54 +02:00
alwx 735a40275d More updates 2023-04-03 15:40:59 +02:00
alwx cf71ea9acb Experiments with Gradle and dependencies 2023-03-30 17:20:48 +02:00
9 changed files with 111 additions and 73 deletions
+25
View File
@@ -1,3 +1,6 @@
import java.util.stream.Collectors
import im.status.DependencyListTask
// Top-level build file where you can add configuration options common to all sub-projects/modules.
/**
@@ -13,6 +16,14 @@ ext {
gradlePluginVersion = project.gradlePluginVersion
}
def depsSet = new TreeSet<String>()
task printDeps {
doLast {
println(depsSet.stream().sorted().collect(Collectors.toList()))
}
}
buildscript {
repositories {
flatDir { dirs "libs", "${rootDir}/app/libs" }
@@ -28,6 +39,8 @@ buildscript {
}
subprojects {
task allDeps(type: DependencyListTask) { }
afterEvaluate {
if (project.hasProperty("android")) {
android {
@@ -49,6 +62,18 @@ allprojects {
}
}
afterEvaluate {
project.configurations.all { config ->
if (!config.name.toLowerCase().startsWith('test')) {
config.allDependencies.all { dep ->
if (dep.group && dep.name && dep.version && dep.version != "unspecified") {
depsSet.add("${dep.group}:${dep.name}:${dep.version}")
}
}
}
}
}
repositories {
mavenLocal()
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
@@ -0,0 +1,28 @@
package im.status;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.tasks.diagnostics.AbstractDependencyReportTask;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.diagnostics.internal.DependencyReportRenderer;
import org.gradle.api.tasks.diagnostics.internal.ReportRenderer;
import org.gradle.api.tasks.diagnostics.internal.dependencies.AsciiDependencyReportRenderer;
//https://github.com/gradle/gradle/tree/master/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/internal
/**
* Displays the dependency tree for a project. An instance of this type is used when you
* execute the {@code dependencies} task from the command-line.
*/
public abstract class DependencyListTask extends AbstractDependencyReportTask {
@Override
public ConfigurationContainer getTaskConfigurations() {
return getProject().getConfigurations();
}
@TaskAction
void action() {
}
}
@@ -13,7 +13,7 @@
[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])
+1 -1
View File
@@ -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
+11 -11
View File
@@ -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)
+33 -40
View 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)
-1
View File
@@ -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
+11 -11
View File
@@ -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
View File
@@ -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()