Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 19, 2022
1 parent 4c24664 commit 98bd4a8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
33 changes: 18 additions & 15 deletions examples/playwright/example.cljs
Expand Up @@ -17,21 +17,24 @@
(deftest browser-test
(async
done
(p/let [browser (.launch browser-type #js {:headless false})
context (.newContext browser)
page (.newPage context)
_ (.goto page "https://clojure.org")
_ (-> (.screenshot page #js{:path "screenshot.png"})
(.catch #(js/console.log %)))
content (.content page)
;; uncomment to save content to variable for inspection
;; _ (def c content)
;; uncomment to pause execution to inspect state in browser
;; _ (pause)
]
(is (str/includes? content "clojure"))
(.close browser)
(done))))
(p/let [browser (.launch browser-type #js {:headless false})]
(-> (p/let [context (.newContext browser)
page (.newPage context)
_ (.goto page "https://clojure.org")
_ (.waitFor (.locator page "audio") #js {:timeout 100})
_ (-> (.screenshot page #js{:path "screenshot.png"})
(.catch #(js/console.log %)))
content (.content page)
;; uncomment to save content to variable for inspection
;; _ (def c content)
;; uncomment to pause execution to inspect state in browser
;; _ (pause)
]
(is (str/includes? content "clojure")))
(p/finally
(fn []
(.close browser)
(done)))))))

(t/run-tests 'example)

Expand Down
2 changes: 1 addition & 1 deletion examples/playwright/package.json
@@ -1,5 +1,5 @@
{
"dependencies": {
"playwright": "^1.15.1"
"playwright": "^1.27.1"
}
}

0 comments on commit 98bd4a8

Please sign in to comment.