Removed now useless appium tests

This commit is contained in:
Julien Eluard 2017-09-02 18:11:31 +02:00 committed by Roman Volosovskyi
parent c46a465b98
commit 38bf64ae2e
3 changed files with 1 additions and 157 deletions

View File

@ -1,6 +1,5 @@
(defproject status-im "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:url "https://github.com/status-im/status-react/"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0-alpha17"]
@ -11,7 +10,6 @@
[com.andrewmcveigh/cljs-time "0.5.0"]
[tailrecursion/cljs-priority-map "1.2.0"]
[com.taoensso/timbre "4.10.0"]
[com.google.guava/guava "21.0"]
[hickory "0.7.1"]]
:plugins [[lein-cljsbuild "1.1.7"]
[lein-figwheel "0.5.13"]
@ -23,13 +21,11 @@
["with-profile" "prod" "cljsbuild" "once" "android"]]
"test-cljs" ["with-profile" "test" "doo" "node" "test" "once"]
"test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]}
:test-paths ["test/clj"]
:figwheel {:nrepl-port 7888}
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.11"]
[re-frisk-remote "0.4.2"]
[re-frisk-sidecar "0.4.5"]
[com.cemerick/piggieback "0.2.2"]
[io.appium/java-client "3.4.1"]
[hawk "0.2.11"]]
:source-paths ["src" "env/dev"]
:cljsbuild {:builds

View File

@ -1,103 +0,0 @@
(ns status-im.test.appium
(:require [clojure.java.io :as io]
[clojure.test :refer :all])
(:import (org.openqa.selenium.remote DesiredCapabilities)
(org.openqa.selenium By)
(io.appium.java_client.android AndroidDriver)
(java.net URL)
(java.util.concurrent TimeUnit)))
(defn init []
(let [dir (io/file (str (System/getProperty "user.dir")
"/android/app/build/outputs/apk"))
app (io/file dir "app-debug.apk")
capabilities (doto (DesiredCapabilities.)
(.setCapability "deviceName" "device")
(.setCapability "app" (.getAbsolutePath app))
(.setCapability "appPackage" "im.status.ethereum")
(.setCapability "appActivity" ".MainActivity"))
driver (AndroidDriver. (URL. "http://127.0.0.1:4723/wd/hub") capabilities)]
(-> driver
.manage
.timeouts
(.implicitlyWait 25 TimeUnit/SECONDS))
driver))
(defn by-xpath [driver xpath]
(.findElement driver (By/xpath xpath)))
(defn elements-by-xpath [driver xpath]
(.findElements driver (By/xpath 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 (get-element driver input-xpath) (into-array [text])))
(defn get-text [driver xpath]
(.getText (by-xpath driver xpath)))
(defn xpath-by-text [text]
(str ".//*[@text=\"" text "\"]"))
(defn click-by-text [driver text]
(let [elements (->> (xpath-by-text text)
(elements-by-xpath driver))]
(when (pos? (.size elements))
(let [element (.get elements 0)]
(.click element)))))
(defn contains-text [driver text]
(is (pos? (->> (xpath-by-text text)
(elements-by-xpath driver)
(.size)))
(format "Text \"%s\" was not found on screen." text)))
(defn quit [driver]
(.quit driver))
(defmacro appium-test
"Defines test which will create new appium session and will pass that
session as first argument to each command inside it's body. After execution
of all commands, the session will be closed.
Also, at the start of every test, the 'Continue' button from the 'Your phone
appears to be ROOTED' message will be pressed.
For instance,
(appium-test my-test
(click :button)
(write :input \"oops\"))
will be expanded to
(deftest my-test
(let [session (init)]
(click session :button)
(write session :input \"oops\")
(quit session)))"
[name & body]
(let [sym (gensym)]
`(deftest ~name
(let [~sym (init)]
(click-by-text ~sym "Continue")
~@(for [[f & rest] body]
`(~f ~sym ~@rest))
(quit ~sym)))))
(defmacro defaction
[name parameters & body]
(let [session (gensym)]
`(defn ~name [~@(concat [session] parameters)]
~@(for [[f & rest] body]
`(~f ~session ~@rest)))))

View File

@ -1,49 +0,0 @@
(ns status-im.test.console
(:require [clojure.test :refer :all]
[status-im.accessibility-ids :as id]
[status-im.test.appium :refer :all]))
(defaction send-command []
(click id/chat-send-button))
(defaction respond-to-request [request value]
(click (id/chat-request-message-button request))
(write id/chat-message-input value)
(send-command))
(defaction confirm-password [value]
(write id/chat-message-input value)
(send-command))
(appium-test sign-up-successfully
(respond-to-request :password "password")
(confirm-password "password")
(respond-to-request :phone "2015550123")
(respond-to-request :confirmation-code "1234")
(contains-text "Done!")
(click id/toolbar-back-button)
(contains-text "Chats"))
(appium-test wrong-password
(respond-to-request :password "abc")
(contains-text "Password should be not less then 6 symbols.")
(click id/chat-cancel-response-button)
(respond-to-request :password "password")
(confirm-password "abc")
(contains-text "Password confirmation doesn't match password."))
(appium-test wrong-phone-number
(respond-to-request :password "password")
(confirm-password "password")
(respond-to-request :phone "1234")
(contains-text "Invalid phone number"))
(appium-test wrong-confirmation-code
(respond-to-request :password "password")
(confirm-password "password")
(respond-to-request :phone "2015550123")
(respond-to-request :confirmation-code "432")
(contains-text "Wrong format")
(click id/chat-cancel-response-button)
(respond-to-request :confirmation-code "4321")
(contains-text "Wrong code!"))