From 68f0a02cbcfc32151a9e8dc87e5f9c27c449dcd0 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 24 Mar 2020 16:39:52 +0100 Subject: [PATCH] fix e2e Signed-off-by: Andrey Shovkoplyas --- .../java/im/status/ethereum/MainActivity.java | 11 +++++++ .../app/src/main/res/layout/launch_screen.xml | 2 +- android/app/src/main/res/values/colors.xml | 6 ---- android/app/src/main/res/values/styles.xml | 19 ++++++------ ios/StatusIm/AppDelegate.m | 2 +- .../ui/components/tabbar/styles.cljs | 2 +- .../ui/components/text_input/styles.cljs | 5 ++-- .../ui/screens/currency_settings/styles.cljs | 7 +---- .../ui/screens/currency_settings/views.cljs | 2 +- src/status_im/ui/screens/pairing/views.cljs | 7 +---- src/status_im/ui/screens/progress/styles.cljs | 2 +- src/status_im/ui/screens/progress/views.cljs | 2 +- .../screens/wallet/collectibles/styles.cljs | 9 +----- .../ui/screens/wallet/collectibles/views.cljs | 29 +++++++++---------- .../atomic/account_management/test_profile.py | 4 +-- test/appium/views/profile_view.py | 10 +++++-- 16 files changed, 56 insertions(+), 63 deletions(-) delete mode 100644 android/app/src/main/res/values/colors.xml diff --git a/android/app/src/main/java/im/status/ethereum/MainActivity.java b/android/app/src/main/java/im/status/ethereum/MainActivity.java index 5161f5cd63..fcaf643264 100644 --- a/android/app/src/main/java/im/status/ethereum/MainActivity.java +++ b/android/app/src/main/java/im/status/ethereum/MainActivity.java @@ -108,6 +108,17 @@ public class MainActivity extends ReactFragmentActivity @Override protected void onCreate(Bundle savedInstanceState) { + switch (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) { + case Configuration.UI_MODE_NIGHT_YES: + setTheme(R.style.DarkTheme); + + break; + case Configuration.UI_MODE_NIGHT_NO: + setTheme(R.style.LightTheme); + break; + default: + setTheme(R.style.LightTheme); + } // Make sure we get an Alert for every uncaught exceptions registerUncaughtExceptionHandler(MainActivity.this); diff --git a/android/app/src/main/res/layout/launch_screen.xml b/android/app/src/main/res/layout/launch_screen.xml index 6bbb51c514..fac58e8916 100644 --- a/android/app/src/main/res/layout/launch_screen.xml +++ b/android/app/src/main/res/layout/launch_screen.xml @@ -3,7 +3,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background"> + android:background="?attr/backgroundColor"> - #4360df - #FFFFFF - #5c6bc0 - #FFFFFF - diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index cb7ffa0490..06cc320e49 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,14 +1,15 @@ - + + + diff --git a/ios/StatusIm/AppDelegate.m b/ios/StatusIm/AppDelegate.m index 8d9efa6994..cdcf96f6a8 100644 --- a/ios/StatusIm/AppDelegate.m +++ b/ios/StatusIm/AppDelegate.m @@ -54,7 +54,7 @@ self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; _blankView = [[UIView alloc]initWithFrame:self.window.frame]; - _blankView.backgroundColor = [UIColor whiteColor]; + _blankView.backgroundColor = [UIColor systemBackgroundColor]; _blankView.alpha = 0; UIViewController *rootViewController = [UIViewController new]; diff --git a/src/status_im/ui/components/tabbar/styles.cljs b/src/status_im/ui/components/tabbar/styles.cljs index 34de49d319..1d48baf0bb 100644 --- a/src/status_im/ui/components/tabbar/styles.cljs +++ b/src/status_im/ui/components/tabbar/styles.cljs @@ -90,7 +90,7 @@ "rgba(0, 0, 0, 0.75)" "rgba(0, 9, 26, 0.12)") :elevation 8 - :background-color :white + :background-color colors/white :position :absolute :left 0 :right 0 diff --git a/src/status_im/ui/components/text_input/styles.cljs b/src/status_im/ui/components/text_input/styles.cljs index 1e38224628..128772e31e 100644 --- a/src/status_im/ui/components/text_input/styles.cljs +++ b/src/status_im/ui/components/text_input/styles.cljs @@ -1,6 +1,5 @@ (ns status-im.ui.components.text-input.styles (:require [status-im.ui.components.colors :as colors] - [status-im.utils.platform :as p] [status-im.utils.styles :as styles])) (defn label [editable label-style] @@ -30,6 +29,8 @@ :container-style {:shadow-offset {:width 0 :height 1} :shadow-radius 6 :shadow-opacity 1 - :shadow-color colors/gray + :shadow-color (if (colors/dark?) + "rgba(0, 0, 0, 0.75)" + "rgba(0, 34, 51)") :elevation 2} :font-size 12}) diff --git a/src/status_im/ui/screens/currency_settings/styles.cljs b/src/status_im/ui/screens/currency_settings/styles.cljs index 27aaf1835a..a1d91062b6 100644 --- a/src/status_im/ui/screens/currency_settings/styles.cljs +++ b/src/status_im/ui/screens/currency_settings/styles.cljs @@ -1,10 +1,5 @@ (ns status-im.ui.screens.currency-settings.styles - (:require [status-im.ui.components.colors :as colors] - [status-im.utils.styles :as styles])) - -(def wrapper - {:flex 1 - :background-color colors/white}) + (:require [status-im.utils.styles :as styles])) (styles/def currency-item {:flex-direction :row diff --git a/src/status_im/ui/screens/currency_settings/views.cljs b/src/status_im/ui/screens/currency_settings/views.cljs index c715be3fee..7d0185aaa9 100644 --- a/src/status_im/ui/screens/currency_settings/views.cljs +++ b/src/status_im/ui/screens/currency_settings/views.cljs @@ -32,7 +32,7 @@ (reset! search-active? false))} [react/view {:flex 1} [topbar/topbar {:title :t/main-currency}] - [react/view styles/wrapper + [react/view {:flex 1} [search-input/search-input {:search-active? search-active? :search-filter search-filter diff --git a/src/status_im/ui/screens/pairing/views.cljs b/src/status_im/ui/screens/pairing/views.cljs index 077eef79a4..e50b8e80e6 100644 --- a/src/status_im/ui/screens/pairing/views.cljs +++ b/src/status_im/ui/screens/pairing/views.cljs @@ -51,12 +51,7 @@ (defn footer [syncing] [react/touchable-highlight {:on-press (when-not @syncing synchronize-installations!) - :style {:height 52 - :elevation 8 - :shadow-radius 4 - :shadow-offset {:width 0 :height -5} - :shadow-opacity 0.3 - :shadow-color "rgba(0, 9, 26, 0.12)"}} + :style {:height 52}} [react/view {:style styles/footer-content} [react/text diff --git a/src/status_im/ui/screens/progress/styles.cljs b/src/status_im/ui/screens/progress/styles.cljs index 8fca5f4315..fb6838f9bc 100644 --- a/src/status_im/ui/screens/progress/styles.cljs +++ b/src/status_im/ui/screens/progress/styles.cljs @@ -1,7 +1,7 @@ (ns status-im.ui.screens.progress.styles (:require [status-im.ui.components.colors :as colors])) -(def container +(defn container [] {:flex 1 :align-items :center :justify-content :center diff --git a/src/status_im/ui/screens/progress/views.cljs b/src/status_im/ui/screens/progress/views.cljs index 75c362021b..b92378d26c 100644 --- a/src/status_im/ui/screens/progress/views.cljs +++ b/src/status_im/ui/screens/progress/views.cljs @@ -6,5 +6,5 @@ ;; a simple view with animated progress indicator in its center (defview progress [_] - [react/keyboard-avoiding-view {:style styles/container} + [react/keyboard-avoiding-view {:style (styles/container)} [components/activity-indicator {:animating true}]]) diff --git a/src/status_im/ui/screens/wallet/collectibles/styles.cljs b/src/status_im/ui/screens/wallet/collectibles/styles.cljs index 48521e3e5d..fdb491ed2e 100644 --- a/src/status_im/ui/screens/wallet/collectibles/styles.cljs +++ b/src/status_im/ui/screens/wallet/collectibles/styles.cljs @@ -1,6 +1,4 @@ -(ns status-im.ui.screens.wallet.collectibles.styles - (:require [status-im.ui.components.colors :as colors] - [status-im.ui.components.styles :as styles])) +(ns status-im.ui.screens.wallet.collectibles.styles) (def default-collectible {:padding-left 10 @@ -27,8 +25,3 @@ (def details-image {:flex 1 :margin 10}) - -(def container - (merge - styles/flex - {:background-color colors/white})) diff --git a/src/status_im/ui/screens/wallet/collectibles/views.cljs b/src/status_im/ui/screens/wallet/collectibles/views.cljs index 7d267fb45f..379d3382e7 100644 --- a/src/status_im/ui/screens/wallet/collectibles/views.cljs +++ b/src/status_im/ui/screens/wallet/collectibles/views.cljs @@ -17,19 +17,18 @@ (defview collectibles-list [] (letsubs [{:keys [name symbol]} [:get-screen-params] collectibles [:screen-collectibles]] - [react/view styles/container - [react/view {:style component.styles/flex} - [topbar/topbar {:title name}] - (cond - (nil? collectibles) - [react/view {:style styles/loading-indicator} - [react/activity-indicator {:animating true :size :large :color colors/blue}]] - (seq collectibles) - [list/flat-list {:data collectibles - :key-fn (comp str :id) - :render-fn #(render-collectible symbol %)}] - :else - ;; Should never happen. Less confusing to debug new NFT support. - [react/view {:style styles/loading-indicator} - [react/text (i18n/label :t/error)]])]])) + [react/view {:style component.styles/flex} + [topbar/topbar {:title name}] + (cond + (nil? collectibles) + [react/view {:style styles/loading-indicator} + [react/activity-indicator {:animating true :size :large :color colors/blue}]] + (seq collectibles) + [list/flat-list {:data collectibles + :key-fn (comp str :id) + :render-fn #(render-collectible symbol %)}] + :else + ;; Should never happen. Less confusing to debug new NFT support. + [react/view {:style styles/loading-indicator} + [react/text (i18n/label :t/error)]])])) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 6d33c1594e..9ec8c4ffb6 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -93,9 +93,9 @@ class TestProfileSingleDevice(SingleDeviceTestCase): profile_view.sync_settings_button.click() profile_view.element_by_text('Mobile data').click() - if profile_view.use_mobile_data.attribute_value("checked"): + if profile_view.use_mobile_data.text != 'OFF': self.errors.append("Mobile data is enabled by default") - if not profile_view.ask_me_when_on_mobile_network.attribute_value("checked"): + if profile_view.ask_me_when_on_mobile_network.text != "ON": self.errors.append("'Ask me when on mobile network' is not enabled by default") sign_in_view.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown") diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 641300d7cd..6b20752a37 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -462,7 +462,11 @@ class ContinueButton(BaseButton): class SyncSettingsButton(BaseButton): def __init__(self, driver): super(SyncSettingsButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector('//*[@content-desc="sync-settings-button"]') + self.locator = self.Locator.accessibility_id('sync-settings-button') + + def click(self): + self.scroll_to_element().click() + self.driver.info('Tap on %s' % self.name) class GoToPairingSettingsButton(BaseButton): @@ -528,13 +532,13 @@ class UseMobileDataToggle(BaseButton): def __init__(self, driver): super(UseMobileDataToggle, self).__init__(driver) self.locator = self.Locator.xpath_selector( - "//*[@text='Use mobile data']/../*[name()='android.widget.Switch']") + "//*[@text='Use mobile data']/following-sibling::android.widget.Switch[1]") class AskMeWhenOnMobileNetworkToggle(BaseButton): def __init__(self, driver): super(AskMeWhenOnMobileNetworkToggle, self).__init__(driver) self.locator = self.Locator.xpath_selector( - "//*[@text='Ask me when on mobile network']/../*[name()='android.widget.Switch']") + "//*[@text='Ask me when on mobile network']/following-sibling::android.widget.Switch[1]") class ENSUsernameInChatSettings(BaseElement): def __init__(self, driver):