From 1d1f8e220c244a0876eadf74b361e9f9ec473ecd Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 28 Dec 2020 09:41:39 -0800 Subject: [PATCH] Started working on test script --- project.clj | 125 ++++++++++-------- .../views/components/invoice_table.cljs | 2 +- test/clj/auto_ap/functional/test.clj | 52 ++++++++ .../clj/auto_ap/{ => integration}/graphql.clj | 2 +- .../{ => integration}/graphql/vendors.clj | 2 +- .../{ => integration}/yodlee/import.clj | 2 +- 6 files changed, 126 insertions(+), 59 deletions(-) create mode 100644 test/clj/auto_ap/functional/test.clj rename test/clj/auto_ap/{ => integration}/graphql.clj (99%) rename test/clj/auto_ap/{ => integration}/graphql/vendors.clj (98%) rename test/clj/auto_ap/{ => integration}/yodlee/import.clj (99%) diff --git a/project.clj b/project.clj index efea15cb..251219c8 100644 --- a/project.clj +++ b/project.clj @@ -106,68 +106,83 @@ "fig:min" ["run" "-m" "figwheel.main" "-O" "advanced" "-bo" "min"]} - :profiles - {:dev - {:resource-paths ["resources" "target"] - :dependencies [[binaryage/devtools "1.0.2"] - [postgresql/postgresql "9.3-1102.jdbc41"] - [org.clojure/java.jdbc "0.7.11"] - [com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript - ring - ring/ring-core - ring/ring-codec - ring/ring-defaults - ring/ring-devel - org.clojure/tools.cli - binaryage/devtools - commons-io - commons-codec - com.fasterxml.jackson.core/jackson-core - org.clojure/tools.namespace - org.eclipse.jetty.websocket/websocket-server - org.eclipse.jetty.websocket/websocket-servlet - args4j]] - [com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [org.clojure/clojurescript]] - [javax.servlet/servlet-api "2.5"]] - :plugins [[lein-pdo "0.1.1"]] - :jvm-opts ["-Dconfig=config/dev.edn" "-Dlogback.configurationFile=logback.xml"]} - + :profiles { + :dev + {:resource-paths ["resources" "target"] + :dependencies [[binaryage/devtools "1.0.2"] + [postgresql/postgresql "9.3-1102.jdbc41"] + [org.clojure/java.jdbc "0.7.11"] + [etaoin "0.4.1"] + [com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript + ring + ring/ring-core + ring/ring-codec + ring/ring-defaults + ring/ring-devel + org.clojure/tools.cli + binaryage/devtools + commons-io + commons-codec + com.fasterxml.jackson.core/jackson-core + org.clojure/tools.namespace + org.eclipse.jetty.websocket/websocket-server + org.eclipse.jetty.websocket/websocket-servlet + args4j]] + [com.bhauman/rebel-readline-cljs "0.1.4" :exclusions [org.clojure/clojurescript]] + [javax.servlet/servlet-api "2.5"]] + :plugins [[lein-pdo "0.1.1"]] + :jvm-opts ["-Dconfig=config/dev.edn" "-Dlogback.configurationFile=logback.xml"]} + - :uberjar {:prep-tasks ["fig:min" ] - :dependencies [[com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript - ring - ring/ring-core - ring/ring-codec - ring/ring-defaults - ring/ring-devel - org.clojure/tools.cli - ring.adapter.jetty - binaryage/devtools - commons-io - commons-codec - com.fasterxml.jackson.core/jackson-core - org.clojure/tools.namespace - org.eclipse.jetty.websocket/websocket-server - org.eclipse.jetty.websocket/websocket-servlet - args4j]]]} - :provided {:dependencies [[org.clojure/clojurescript "1.10.773" - :exclusions [com.google.code.findbugs/jsr305 - com.fasterxml.jackson.core/jackson-core]] - [reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ] - [re-frame "1.1.2" - :exclusions - [reagent - org.clojure/clojurescript]] - [re-frame-utils "0.1.0"] - [com.andrewmcveigh/cljs-time "0.5.2"] - [cljs-http "0.1.46"] - [kibu/pushy "0.3.8"]]}} + :uberjar + {:prep-tasks ["fig:min" ] + :dependencies [[com.bhauman/figwheel-main "0.2.12" :exclusions [org.clojure/clojurescript + ring + ring/ring-core + ring/ring-codec + ring/ring-defaults + ring/ring-devel + org.clojure/tools.cli + ring.adapter.jetty + binaryage/devtools + commons-io + commons-codec + com.fasterxml.jackson.core/jackson-core + org.clojure/tools.namespace + org.eclipse.jetty.websocket/websocket-server + org.eclipse.jetty.websocket/websocket-servlet + args4j]]]} + :provided {:dependencies [[org.clojure/clojurescript "1.10.773" + :exclusions [com.google.code.findbugs/jsr305 + com.fasterxml.jackson.core/jackson-core]] + [reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ] + [re-frame "1.1.2" + :exclusions + [reagent + org.clojure/clojurescript]] + [re-frame-utils "0.1.0"] + [com.andrewmcveigh/cljs-time "0.5.2"] + [cljs-http "0.1.46"] + [kibu/pushy "0.3.8"]]} + + } :main auto-ap.server :aot [auto-ap.server auto-ap.datomic.migrate auto-ap.time clj-time.core clj-time.coerce clj-time.format clojure.tools.logging.impl] :uberjar-name "auto-ap.jar" + :test-paths ["test/clj"] + :test-selectors {:integration (fn [m] + (or (clojure.string/includes? (str (:ns m)) + "integration") + (clojure.string/includes? (str (:name m)) + "integration"))) + :functional (fn [m] + (or (clojure.string/includes? (str (:ns m)) + "functional") + (clojure.string/includes? (str (:name m)) + "functional")))} :prep-tasks [ "compile"]) diff --git a/src/cljs/auto_ap/views/components/invoice_table.cljs b/src/cljs/auto_ap/views/components/invoice_table.cljs index b1f21c0f..1ab7d47b 100644 --- a/src/cljs/auto_ap/views/components/invoice_table.cljs +++ b/src/cljs/auto_ap/views/components/invoice_table.cljs @@ -105,7 +105,7 @@ (client-override i) (:name client))]) [grid/cell {} (:name vendor)] - [glast-updatedrid/cell {} invoice-number] + [grid/cell {} invoice-number] [grid/cell {} (date->str date) ] [grid/cell {} (when due diff --git a/test/clj/auto_ap/functional/test.clj b/test/clj/auto_ap/functional/test.clj new file mode 100644 index 00000000..21ce7b91 --- /dev/null +++ b/test/clj/auto_ap/functional/test.clj @@ -0,0 +1,52 @@ +(ns auto-ap.functional.test + (:require [clojure.test :as t :refer :all] + [etaoin.api :as e] + [etaoin.keys :as k] + [config.core :refer [env]] + [clj-time.core :as time] + [buddy.sign.jwt :as jwt])) + +(def base-url "https://staging3.app.integreatconsult.com") +(defn login-admin [driver] + (let [jwt-token (jwt/sign {:user "Automated Tests" + :exp (time/plus (time/now) (time/days 30)) + :user/role "admin" + :user/name "Automated Tests"} + (:jwt-secret env) + {:alg :hs512})] + (e/go driver (str base-url "/?jwt=" jwt-token)) + (e/wait-visible driver {:tag :h1 + :class "title"}))) + +(deftest create-invoice + (testing "Creating a new invoice" + (e/with-wait-timeout 10 + (e/with-firefox {} driver + (login-admin driver) + (e/click driver {:tag :a :fn/text "Invoices"}) + (e/wait-visible driver {:tag :h1 + :class "title" + :fn/text "Unpaid Invoices"}))))) + + +(deftest edit-client + (testing "Editing a client" + (e/with-wait-timeout 10 + (e/with-firefox {} driver + (login-admin driver) + + (e/click driver {:tag :a :class "navbar-link login"}) + (e/click driver {:tag :a :fn/text "Administration"}) + + (e/wait-visible driver {:tag :h1 + :class "title" + :fn/text "Admin"}) + (e/click driver {:tag :span :fn/text "Clients"}) + (e/wait-visible driver {:tag :h1 + :class "title" + :fn/text "Clients"}) + (e/click driver {:tag :i :class "fa fa-pencil"}) + (e/wait-visible driver {:tag :button + :fn/text "Save"}) + (e/click driver {:tag :button :fn/text "Save"}) + (e/wait-invisible driver {:tag :form}))))) diff --git a/test/clj/auto_ap/graphql.clj b/test/clj/auto_ap/integration/graphql.clj similarity index 99% rename from test/clj/auto_ap/graphql.clj rename to test/clj/auto_ap/integration/graphql.clj index e9c9fce1..2c388d9b 100644 --- a/test/clj/auto_ap/graphql.clj +++ b/test/clj/auto_ap/integration/graphql.clj @@ -1,4 +1,4 @@ -(ns test.auto-ap.graphql +(ns auto-ap.integration.graphql (:require [auto-ap.graphql :as sut] [auto-ap.datomic.migrate :as m] [venia.core :as v] diff --git a/test/clj/auto_ap/graphql/vendors.clj b/test/clj/auto_ap/integration/graphql/vendors.clj similarity index 98% rename from test/clj/auto_ap/graphql/vendors.clj rename to test/clj/auto_ap/integration/graphql/vendors.clj index 028189be..204da51f 100644 --- a/test/clj/auto_ap/graphql/vendors.clj +++ b/test/clj/auto_ap/integration/graphql/vendors.clj @@ -1,4 +1,4 @@ -(ns clj.auto-ap.graphql.vendors +(ns auto-ap.integration.graphql.vendors (:require [auto-ap.graphql.vendors :as sut2] [auto-ap.datomic :refer [uri conn]] [auto-ap.datomic.migrate :as m] diff --git a/test/clj/auto_ap/yodlee/import.clj b/test/clj/auto_ap/integration/yodlee/import.clj similarity index 99% rename from test/clj/auto_ap/yodlee/import.clj rename to test/clj/auto_ap/integration/yodlee/import.clj index b299b017..539f7ef9 100644 --- a/test/clj/auto_ap/yodlee/import.clj +++ b/test/clj/auto_ap/integration/yodlee/import.clj @@ -1,4 +1,4 @@ -(ns test.auto-ap.yodlee.import +(ns auto-ap.integration.yodlee.import (:require [auto-ap.yodlee.import :as sut] [auto-ap.yodlee.core :as c] [datomic.api :as d]