laurent.orseau
2020-5-3 08:13:05

@robby How do I use framework/test? When I run the example from the docs, it just loops forever: #lang racket (require framework/test) (test:menu-select "File" "New Tab") and I need to break it.


laurent.orseau
2020-5-3 08:13:22

(I’d like to automate some tests for Quickscript, finally!)


laurent.orseau
2020-5-3 08:21:49

Or maybe I need to run the program outside the target drracket window and make sure the X window manager has focus on the drracket window? I’ll try that later.


laurent.orseau
2020-5-3 12:18:54

Doesn’t seem to work when run from an external repl, with (sleep 1) to give me time to switch to DrRacket’s window.


robby
2020-5-3 12:53:34

Maybe you calling it from the wrong thread?


robby
2020-5-3 12:53:58

It needs to be called from a thread that isn’t the event space main thread


laurent.orseau
2020-5-3 12:58:00

I’m a little confused it seems. This #lang racket (require framework/test) (thread (λ () (sleep 2) (test:menu-select "File" "New Tab"))) (read-line) raises: .../framework/test.rkt:633:6: test:menu-select: no active frame


laurent.orseau
2020-5-3 12:58:12

From within DrRacket


laurent.orseau
2020-5-3 13:02:01

Same if I run from the terminal and switch to DrRacket’s window in the 2s interval


laurent.orseau
2020-5-3 13:16:59

Looking at https://github.com/racket/drracket/blob/master/drracket-test/tests/drracket/private/run-example-tool.rkt it seems there’s a looot more stuff to do to make this work


laurent.orseau
2020-5-3 13:33:10

Aha, after installing drracket-test, I could get this one to work: https://github.com/racket/drracket/blob/master/drracket-test/tests/drracket/insert-large-letters-test.rkt which should be a good starting point. I guess I’ll have to make a separate quickscript-test package that depends on drracket-test then.


robby
2020-5-3 15:16:00

You need to be on the same eventspace but on a different thread.


robby
2020-5-3 15:16:28

In the message starting with “I’m a little confused it seems” you were on a different eventspace.


robby
2020-5-3 15:16:46

When you tried it in a racket run from the terminal you were not in the same process (so thus also not on the same eventspace)


laurent.orseau
2020-5-3 15:18:02

Ok so i need to start drracket from my module with drracket/tool-lib and start a second thread to control it then?


robby
2020-5-3 15:19:04

probably I should document some of the helper functions that I have set up for drracket’s own test suite


laurent.orseau
2020-5-3 15:55:55

I have this now: #lang racket (require tests/drracket/private/drracket-test-util drracket/private/local-member-names racket/gui/base framework rackunit string-constants) (fire-up-drracket-and-run-tests (λ () (define drr (wait-for-drracket-frame)) (queue-callback/res (λ () (send (send drr get-definitions-canvas) focus))) (test:menu-select "Scripts" "Tests" "string-insert") (test:menu-select "Scripts" "Tests" "string-reverse") #t)) The first script is called correctly, but it seems to hang before the second. Is there something I must do between the two test:menu-select calls?


robby
2020-5-3 21:26:21

No


robby
2020-5-3 21:26:30

Maybe quickscript has a race condition


robby
2020-5-3 21:26:32

?


robby
2020-5-3 21:33:44

@laurent.orseau that coe, I believe, corresponds to a user clicking very quickly first on the string-insert menu item and then on the string-reverse one.


robby
2020-5-3 21:33:54

It should be a legal set of inputs to quick script.


robby
2020-5-3 21:34:05

I guess.


robby
2020-5-3 21:34:06

:slightly_smiling_face:


laurent.orseau
2020-5-4 06:12:16

There’s no thread in quickscript, but maybe drracket plugins are threaded?