add accessibility ids for end-to-end tests

This commit is contained in:
Eric Dvorsak 2017-09-25 12:46:22 +02:00 committed by Roman Volosovskyi
parent 17011f6d9e
commit 28355ca3c5
8 changed files with 80 additions and 71 deletions

View File

@ -90,7 +90,8 @@
(fn [] (fn []
(let [show-actions @show-actions] (let [show-actions @show-actions]
[touchable-highlight [touchable-highlight
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])} {:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])
:accessibility-label :chat-menu}
[view st/action [view st/action
(if show-actions (if show-actions
[vi/icon :icons/dropdown-up] [vi/icon :icons/dropdown-up]

View File

@ -90,16 +90,19 @@
custom-icon custom-icon
handler handler
title title
subtitle] subtitle
accessibility-label]
:or {accessibility-label :action}
icon-name :icon}] icon-name :icon}]
[touchable-highlight {:on-press (fn [] [touchable-highlight {:on-press (fn []
(dispatch [:set-chat-ui-props {:show-actions? false}]) (dispatch [:set-chat-ui-props {:show-actions? false}])
(when handler (when handler
(handler)))} (handler)))}
[view st/action-icon-row [view {:accessibility-label accessibility-label
:style st/action-icon-row}
[view st/action-icon-view [view st/action-icon-view
(or custom-icon (or custom-icon
[icon icon-name icon-style])] [icon icon-name icon-style])
[view st/action-view [view st/action-view
[text {:style st/action-title [text {:style st/action-title
:number-of-lines 1 :number-of-lines 1
@ -109,7 +112,7 @@
[text {:style st/action-subtitle [text {:style st/action-subtitle
:number-of-lines 1 :number-of-lines 1
:font :default} :font :default}
subtitle])]]]) subtitle])]]]])
(defview actions-list-view [] (defview actions-list-view []
(letsubs [group-chat [:chat :group-chat] (letsubs [group-chat [:chat :group-chat]

View File

@ -161,6 +161,7 @@
(dispatch [:load-chat-parameter-box (:command @command)]) (dispatch [:load-chat-parameter-box (:command @command)])
(dispatch [:set-chat-ui-props {:validation-messages nil}])) (dispatch [:set-chat-ui-props {:validation-messages nil}]))
:placeholder placeholder :placeholder placeholder
:accessibility-label :chat-request-input
:blur-on-submit false :blur-on-submit false
:editable (not @sending-in-progress?) :editable (not @sending-in-progress?)
:on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}]) :on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}])

View File

@ -36,7 +36,7 @@
(when (and extended? (not (empty? extend-options))) (when (and extended? (not (empty? extend-options)))
[view st/more-btn-container [view st/more-btn-container
[context-menu [context-menu
[vi/icon :icons/options] [vi/icon :icons/options {:accessibility-label :options}]
extend-options extend-options
nil nil
st/more-btn]])]]]) st/more-btn]])]]])

View File

@ -75,8 +75,10 @@
(defn icon (defn icon
([name] (icon name nil)) ([name] (icon name nil))
([name {:keys [color container-style style]}] ([name {:keys [color container-style style accessibility-label]
[react/view {:style container-style} :or {accessibility-label :icon}}]
[react/view {:style container-style
:accessibility-label accessibility-label}
(if-let [icon-fn (get icons (normalize-property-name name))] (if-let [icon-fn (get icons (normalize-property-name name))]
(into [] (into []
(concat (concat

View File

@ -66,6 +66,7 @@
:offset-y 40 :offset-y 40
:spacing 13 :spacing 13
:hide-shadow true :hide-shadow true
:accessibility-label :plus-button
:on-press #(re-frame/dispatch [:navigate-to :new-chat])}]) :on-press #(re-frame/dispatch [:navigate-to :new-chat])}])
(defn chat-list-item [[chat-id chat] edit?] (defn chat-list-item [[chat-id chat] edit?]

View File

@ -110,6 +110,7 @@
:spacing 13} :spacing 13}
[native-action-button-item [native-action-button-item
{:title (label :t/new-contact) {:title (label :t/new-contact)
:accessibility-label :new-contact
:buttonColor :#9b59b6 :buttonColor :#9b59b6
:onPress #(dispatch [:navigate-to :new-contact])} :onPress #(dispatch [:navigate-to :new-contact])}
[ion-icon {:name :md-create [ion-icon {:name :md-create

View File

@ -45,6 +45,7 @@
[{:value #(dispatch [:remove-contact-from-group [{:value #(dispatch [:remove-contact-from-group
(:whisper-identity item) (:whisper-identity item)
group-id]) group-id])
:accessibility-label :remove-button
:text (label :t/remove-from-group)}])) :text (label :t/remove-from-group)}]))
(defview edit-chat-group-contact-list [] (defview edit-chat-group-contact-list []
@ -69,8 +70,7 @@
(contact-extended-options group-id)])) (contact-extended-options group-id)]))
(defview edit-contact-group-contact-list [] (defview edit-contact-group-contact-list []
(letsubs [group [:get-contact-group] (letsubs [group [:get-contact-group]]
type [:get-group-type]]
[view styles/group-container [view styles/group-container
[status-bar] [status-bar]
[contact-list-toolbar (:name group)] [contact-list-toolbar (:name group)]