Skip to content

Commit

Permalink
tests: add tests for issue #53
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Mar 14, 2018
1 parent 1e4a9a9 commit 6ed8f5b
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/browser/fixtures/resources/scenarios/issue-53.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<html>
<head>
<title>issue-53</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="../css/scenario.css">
<script src="../.compiled/scenarios03/goog/base.js" type="text/javascript"></script>
<script src="../.compiled/scenarios03/main.js" type="text/javascript"></script>
</head>
<body>
This page scenario contains:
<ul>
<li>cljs-devtools</li>
<li>dirac runtime properly initialized</li>
<li>issue-53 workspace is present</li>
</ul>

<script>goog.require('dirac.tests.scenarios.issue_53')</script>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns dirac.tests.scenarios.issue-53
"https://github.com/binaryage/dirac/issues/53"
(:require [dirac.automation.runtime :refer [init-runtime!]]
[dirac.automation.triggers :refer [install-common-triggers!]]
[dirac.automation.scenario :as scenario]
[dirac.tests.scenarios.issue-53.core]))

(init-runtime!)
(install-common-triggers!)
(scenario/ready!)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(ns dirac.tests.scenarios.issue-53.core)

(defn breakpoint-fn1 []
(let [x 1]
(let [y 2]
(let [x 3
z #(println x)]
(js-debugger)))))

(defn breakpoint-fn2 [one-one]
(let [two-two 2]
((fn rebind [] one-one))
(js-debugger)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(ns dirac.tests.tasks.suite03.issue-53
(:require [cljs.core.async :refer [<! timeout]]
[cljs.test :refer-macros [is are]]
[dirac.automation :refer-macros [<!* go-task with-scenario with-devtools with-console-feedback testing] :as a]))

(go-task
(with-scenario "issue-53"
(with-devtools
(<!* a/switch-to-console-panel!)
(<!* a/switch-prompt-to-dirac!)
(<!* a/wait-for-prompt-to-enter-edit-mode)
(with-console-feedback
(<!* a/console-enter! "(require 'dirac.tests.scenarios.issue-53.core)")
(<!* a/console-exec-and-match!
"(in-ns 'dirac.tests.scenarios.issue-53.core)"
"setDiracPromptNS('dirac.tests.scenarios.issue-53.core')")

(testing "test case 1"
(<!* a/console-enter! "(breakpoint-fn1)")
(<!* a/wait-for-panel-switch "sources")
(<!* a/scrape! :scope-content)
(<!* a/simulate-global-action! "F8")) ; resume paused debugger

(testing "test case 2"
(<!* a/switch-to-console-panel!)
(<!* a/console-enter! "(breakpoint-fn2 1)")
(<!* a/wait-for-panel-switch "sources")
(<!* a/scrape! :scope-content)
(<!* a/simulate-global-action! "F8")) ; resume paused debugger
))))
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
(execute-transcript-test! "clean-urls")
(execute-transcript-test! "beautify-function-names"))
(with-transcript-suite "suite03"
(execute-transcript-test! "issue-53")
(execute-transcript-test! "issue-55")
(execute-transcript-test! "issue-74")))
80 changes: 80 additions & 0 deletions test/browser/transcripts/expected/suite03-issue-53.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
ns Testing dirac.tests.tasks.suite03.issue-53
extension reset extension state
extension set extension options:{:target-url "http://localhost:<port>"}
extension set extension options:{:open-as "window"}
automate open-scenario! ["issue-53"]
automate open-devtools!
extension handling command: open-dirac-devtools
extension register devtools #1
devtools #1 implant initialized
devtools #1 setCurrentPanel: elements
devtools #1 devtools ready
devtools #1 namespacesCache is cool now
automate #1 switch-to-console-panel!
devtools #1 setCurrentPanel: console
devtools #1 console initialized
devtools #1 adopt-prompt-element use-parinfer? true
devtools #1 setDiracPromptMode('status')
devtools #1 ConsoleView constructed
devtools #1 displayWelcomeMessage
automate #1 switch-prompt-to-dirac!
devtools #1 switched console prompt to 'dirac'
devtools #1 init-repl!
devtools #1 setDiracPromptStatusContent('Checking for Dirac Runtime presence in your app...')
devtools #1 setDiracPromptStatusStyle('info')
devtools #1 setDiracPromptStatusContent('Dirac Agent connected. Bootstrapping ClojureScript REPL...')
devtools #1 setDiracPromptNS('cljs.user')
devtools #1 setDiracPromptMode('edit')
automate #1 enable-console-feedback!
automate #1 console-enter! ["(require 'dirac.tests.scenarios.issue-53.core)"]
devtools #1 DC.info> (require 'dirac.tests.scenarios.issue-53.core)
devtools #1 send-eval-request: (require 'dirac.tests.scenarios.issue-53.core)
devtools #1 repl eval job started
automate #1 console-exec-and-match! ["(in-ns 'dirac.tests.scenarios.issue-53.core)" "setDiracPromptNS('dirac.tests.scenarios.issue-53.core')"]
devtools #1 repl eval job ended
devtools #1 DC.info> (in-ns 'dirac.tests.scenarios.issue-53.core)
devtools #1 send-eval-request: (in-ns 'dirac.tests.scenarios.issue-53.core)
devtools #1 repl eval job started
devtools #1 setDiracPromptNS('dirac.tests.scenarios.issue-53.core')
devtools #1 repl eval job ended
testing test case 1
automate #1 console-enter! ["(breakpoint-fn1)"]
devtools #1 DC.info> (breakpoint-fn1)
devtools #1 send-eval-request: (breakpoint-fn1)
devtools #1 repl eval job started
devtools #1 setCurrentPanel: sources
automate #1 scrape! [:scope-content]
stdout displayed 5 items:
* this: Window
* x: 1
* x: 3
* y: 2
* z: <custom>
automate #1 simulate-global-action! ["F8"]
devtools #1 DF.info> null
devtools #1 repl eval job ended
testing test case 2
automate #1 switch-to-console-panel!
devtools #1 setCurrentPanel: console
automate #1 console-enter! ["(breakpoint-fn2 1)"]
devtools #1 DC.info> (breakpoint-fn2 1)
devtools #1 send-eval-request: (breakpoint-fn2 1)
devtools #1 repl eval job started
devtools #1 setCurrentPanel: sources
automate #1 scrape! [:scope-content]
stdout displayed 3 items:
* one-one: 1
* this: Window
* two-two: 2
automate #1 simulate-global-action! ["F8"]
devtools #1 DF.info> null
devtools #1 repl eval job ended
automate #1 disable-console-feedback!
automate #1 close-devtools!
extension handling command: close-dirac-devtools
extension unregister devtools #1
automate close-scenario! ["scenario-tab#1"]
summary Automated 17 actions with 3 check-points containing 0 assertions.
0 failures, 0 errors.

0 comments on commit 6ed8f5b

Please sign in to comment.