Fork me on GitHub
#kaocha
<
2019-05-06
>
plexus12:05:33

@rgm the pattern I've used for this is to have an idempotent setup method which I call at the start of every step, see https://github.com/lambdaisland/kaocha/blob/master/test/shared/kaocha/integration_helpers.clj#L70-L102

plexus12:05:50

For you this could look something like this

plexus12:05:06

(defn wedriver-setup [m]
  (if (:driver m)
    m
    (assoc m :driver (do-actual-setup))))

(When "foo" [m]
  (let [m (webdriver-setup m)]
    ...
    m))


(Then "bar" [m]
  (let [m (webdriver-setup m)]
    ...
    m))

rgm19:05:15

@plexus ah, ok. That works well for setup in step definitions, just passing it along the chain in state. I’m still fuzzy about teardown at the end of the suite … lambdaisland.cucumber.dsl/After can’t have access to that state, can it?

rgm19:05:51

I would guess not since there may be a bunch of tests / drivers cruising around in parallel, which is how I ended up on pre-test/post-test hooks