parent
c10abb17bb
commit
6823acd171
|
@ -38,11 +38,13 @@
|
|||
:onChangeText set-input-message
|
||||
:onSubmitEditing (fn []
|
||||
(when (valid? message validator)
|
||||
(send-command)))}
|
||||
(send-command)))
|
||||
:accessibility-label :command-input}
|
||||
input-options)
|
||||
message]
|
||||
(if (valid? message validator)
|
||||
[touchable-highlight {:on-press send-command}
|
||||
[touchable-highlight {:on-press send-command
|
||||
:accessibility-label :stage-command}
|
||||
[view st/send-container [icon :send st/send-icon]]]
|
||||
[touchable-highlight {:on-press cancel-command-input}
|
||||
[view st/cancel-container
|
||||
|
|
|
@ -72,13 +72,18 @@
|
|||
(defn set-chat-command [msg-id command]
|
||||
(dispatch [:set-response-chat-command msg-id (:command command)]))
|
||||
|
||||
(defn label [{:keys [command]}]
|
||||
(->> (name command)
|
||||
(str "request-")))
|
||||
|
||||
(defn message-content-command-request
|
||||
[{:keys [msg-id content from incoming-group]}]
|
||||
(let [commands-atom (subscribe [:get-commands])]
|
||||
(fn [{:keys [msg-id content from incoming-group]}]
|
||||
(let [commands @commands-atom
|
||||
{:keys [command content]} (parse-command-request commands content)]
|
||||
[touchable-highlight {:onPress #(set-chat-command msg-id command)}
|
||||
[touchable-highlight {:onPress #(set-chat-command msg-id command)
|
||||
:accessibility-label (label command)}
|
||||
[view st/comand-request-view
|
||||
[view st/command-request-message-view
|
||||
(when incoming-group
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
(ns status-im.chat.views.plain-input
|
||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||
[status-im.components.react :refer [view
|
||||
icon
|
||||
touchable-highlight
|
||||
text-input]]
|
||||
icon
|
||||
touchable-highlight
|
||||
text-input]]
|
||||
[status-im.chat.views.suggestions :refer [suggestions-view]]
|
||||
[status-im.chat.styles.plain-input :as st]))
|
||||
|
||||
|
@ -39,15 +39,16 @@
|
|||
(if @typing-command?
|
||||
[icon :close-gray st/close-icon]
|
||||
[icon :list st/list-icon])]]
|
||||
[text-input {:style st/message-input
|
||||
:autoFocus (pos? (count @staged-commands-atom))
|
||||
:onChangeText set-input-message
|
||||
:onSubmitEditing #(try-send @chat @staged-commands-atom
|
||||
input-message)}
|
||||
[text-input {:style st/message-input
|
||||
:autoFocus (pos? (count @staged-commands-atom))
|
||||
:onChangeText set-input-message
|
||||
:onSubmitEditing #(try-send @chat @staged-commands-atom
|
||||
input-message)}
|
||||
input-message]
|
||||
;; TODO emoticons: not implemented
|
||||
[icon :smile st/smile-icon]
|
||||
(when (message-valid? @staged-commands-atom input-message)
|
||||
[touchable-highlight {:on-press #(send @chat input-message)}
|
||||
[touchable-highlight {:on-press #(send @chat input-message)
|
||||
:accessibility-label :send-message}
|
||||
[view st/send-container
|
||||
[icon :send st/send-icon]]])]]))))
|
||||
|
|
|
@ -32,11 +32,19 @@
|
|||
(defn elements-by-xpath [driver xpath]
|
||||
(.findElements driver (By/xpath xpath)))
|
||||
|
||||
(defn click [driver xpath]
|
||||
(.click (by-xpath driver xpath)))
|
||||
(defn by-id [driver id]
|
||||
(.findElementByAccessibilityId driver (name id)))
|
||||
|
||||
(defn get-element [driver id]
|
||||
(if (keyword? id)
|
||||
(by-id driver id)
|
||||
(by-xpath driver id)))
|
||||
|
||||
(defn click [driver id]
|
||||
(.click (get-element driver id)))
|
||||
|
||||
(defn write [driver input-xpath text]
|
||||
(.sendKeys (by-xpath driver input-xpath) (into-array [text])))
|
||||
(.sendKeys (get-element driver input-xpath) (into-array [text])))
|
||||
|
||||
(defn get-text [driver xpath]
|
||||
(.getText (by-xpath driver xpath)))
|
||||
|
|
|
@ -2,33 +2,6 @@
|
|||
(:require [clojure.test :refer :all]
|
||||
[status-im.appium :refer :all]))
|
||||
|
||||
(def command-request-icon
|
||||
(str
|
||||
"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]"
|
||||
"/android.widget.FrameLayout[1]/android.view.ViewGroup[1]"
|
||||
"/android.widget.ScrollView[1]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[1]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[2]/android.widget.ImageView[1]"))
|
||||
|
||||
(def input
|
||||
(str
|
||||
"//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]"
|
||||
"/android.widget.FrameLayout[1]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[2]/android.view.ViewGroup[1]"
|
||||
"/android.widget.EditText[1]"))
|
||||
|
||||
(def send-button1
|
||||
(str "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]"
|
||||
"/android.widget.FrameLayout[1]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[2]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[2]/android.view.ViewGroup[1]"))
|
||||
|
||||
(def send-button2
|
||||
(str "//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]"
|
||||
"/android.widget.FrameLayout[1]/android.view.ViewGroup[1]"
|
||||
"/android.view.ViewGroup[2]/android.view.ViewGroup[2]"
|
||||
"/android.view.ViewGroup[2]/android.view.ViewGroup[1]"))
|
||||
|
||||
(def message-text
|
||||
(str "Your phone number is also required to use the app. Type"
|
||||
" the exclamation mark or hit the icon to open the command "
|
||||
|
@ -36,9 +9,9 @@
|
|||
|
||||
(deftest console-test
|
||||
(let [driver (init)]
|
||||
(click driver command-request-icon)
|
||||
(write driver input "123")
|
||||
(click driver send-button1)
|
||||
(click driver send-button2)
|
||||
(click driver :request-keypair-password)
|
||||
(write driver :command-input "123")
|
||||
(click driver :stage-command)
|
||||
(click driver :send-message)
|
||||
(contains-text driver message-text)
|
||||
(quit driver)))
|
||||
|
|
Loading…
Reference in New Issue