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