Skip to content

Commit

Permalink
Fix failing test for navigation task
Browse files Browse the repository at this point in the history
Handle default case for ens confirmation

Before navigation away the registration state is cleared and case does not handle default value for nil

Remove extra space on home button

Remove outdated options

Fix e2e

Change navigation replace arguments as per rn5

Fixes #10178

Dispatch navigation later

Do not restore state for react-native-screens

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
  • Loading branch information
Ferossgp committed Mar 18, 2020
1 parent d2478bb commit d24f469
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ protected void onCreate(Bundle savedInstanceState) {

setSecureFlag();
SplashScreen.show(this, true);
super.onCreate(savedInstanceState);
// NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17
super.onCreate(null);

if (!shouldShowRootedNotification()) {
configureStatus();
Expand Down
13 changes: 8 additions & 5 deletions src/status_im/init/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:multiaccounts/loading true)})

(fx/defn initialize-views
{:events [::initialize-view]}
[cofx {:keys [logout?]}]
(let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx]
(when (and (seq multiaccounts) (not logout?))
Expand All @@ -50,11 +51,13 @@
{}
all-multiaccounts)]
(fx/merge cofx
{:db (-> db
(assoc :multiaccounts/multiaccounts multiaccounts)
(assoc :multiaccounts/logout? logout?)
(assoc :multiaccounts/loading false))}
(initialize-views {:logout? logout?}))))
{:db (-> db
(assoc :multiaccounts/multiaccounts multiaccounts)
(assoc :multiaccounts/logout? logout?)
(assoc :multiaccounts/loading false))
;; NOTE: Try to dispatch later navigation because of that https://github.com/react-navigation/react-navigation/issues/6879
:dispatch-later [{:dispatch [::initialize-view {:logout? logout?}]
:ms 100}]})))

(fx/defn start-app [cofx]
(fx/merge cofx
Expand Down
6 changes: 4 additions & 2 deletions src/status_im/ui/screens/ens/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@
(i18n/label :t/ens-saved-title)
;;NOTE: this state can't be reached atm
:registration-failed
(i18n/label :t/ens-registration-failed-title)))
(i18n/label :t/ens-registration-failed-title)
nil))

(defn- final-state-details
[state username]
Expand All @@ -391,7 +392,8 @@
;;NOTE: this state can't be reached atm
:registration-failed
[react/text {:style {:color colors/gray :font-size 14}}
(i18n/label :t/ens-registration-failed)]))
(i18n/label :t/ens-registration-failed)]
nil))

(views/defview confirmation []
(views/letsubs [{:keys [state username]} [:ens/confirmation-screen]]
Expand Down
5 changes: 1 addition & 4 deletions src/status_im/ui/screens/home/styles.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,4 @@

(def home-container
(merge
{:flex 1}
;;TODO move this to navigation layer
(when platform/ios?
{:margin-bottom tabs.styles/tabs-diff})))
{:flex 1}))
4 changes: 1 addition & 3 deletions src/status_im/ui/screens/routing/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,4 @@
(defn navigate-replace [route params]
(when (can-be-called?)
(ocall @navigator-ref "dispatch"
(ocall stack-actions "replace"
#js {:name (name route)
:params (clj->js params)}))))
(ocall stack-actions "replace" (name route) (clj->js params)))))
1 change: 0 additions & 1 deletion src/status_im/ui/screens/routing/intro_login_stack.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
{:name :login
:component login/login}
{:name :create-multiaccount-generate-key
:options {:stackPresentation "modal"}
:component intro/wizard-generate-key}
{:name :create-multiaccount-choose-key
:back-handler :noop
Expand Down
6 changes: 3 additions & 3 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,14 +594,14 @@ def public_key_to_address(self, public_key):

def get_back_to_home_view(self, times_to_click_on_back_btn=5):
counter = 0
from views.home_view import PlusButton
while not PlusButton(self.driver).is_element_displayed(2):
while BackButton(self.driver).is_element_displayed(2):
try:
if counter >= times_to_click_on_back_btn:
break
self.back_button.click()
except (NoSuchElementException, TimeoutException):
counter += 1
except (NoSuchElementException, TimeoutException):
continue
return self.home_button.click()

def relogin(self, password=common_password):
Expand Down

0 comments on commit d24f469

Please sign in to comment.