Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeleniumTest testAPI - run more tests client side, and test new API not Scratch Binding #85

Open
vorburger opened this issue Jul 1, 2018 · 3 comments

Comments

@vorburger
Copy link
Member

I've started extending our SeleniumTest with a new testAPI() to run more tests written in TS client side instead of in Java server side, and to focus on testing the new API, not the Scratch Binding.

Got reasonable far, but am now stuck with an issue I don't understand:

test.ts:53 Uncaught Error: INVALID_STATE_ERR
    at o.send (test.ts:53)
    at t._subscribe (test.ts:53)
    at t._trySubscribe (1.568a857938616d5c186c.hot-update.js:7)
    at t.subscribe (1.568a857938616d5c186c.hot-update.js:7)
    at t.test (test.ts:53)
    at HTMLButtonElement.onclick (?eventBusURL=http://localhost:6060/eventbus:20)

@edewit perhaps you could have a look at this, some time?

vorburger referenced this issue Jul 1, 2018
but run that new client side, and test new API not Scratch Binding

not yet working, see
https://github.com/vorburger/minecraft-storeys-maker/issues/85
@vorburger
Copy link
Member Author

Got reasonable far, but am now stuck with an issue I don't understand:

see vorburger@afe8327 - running that in the browser as described here reproduces above, and should hopefully make it easy to debug for you @edewit ? (Running SeleniumTest onsee vorburger@afe8327 makes it fail with something like #23, which is less clear.)

vorburger added a commit that referenced this issue Jul 1, 2018
even though this isn't need in Scratch 2, because the Server send this
as String, and this enum ItemType is not actually used in Scratch 2 at
runtime after this TS became TS.  But it, probably, would make a real TS
test fail, such as the one I'm trying to build in #85.
vorburger added a commit that referenced this issue Jul 2, 2018
even though this isn't need in Scratch 2, because the Server send this
as String, and this enum ItemType is not actually used in Scratch 2 at
runtime after this TS became TS.  But it, probably, would make a real TS
test fail, such as the one I'm trying to build in #85.
vorburger referenced this issue Jul 2, 2018
but run that new client side, and test new API not Scratch Binding

not yet working, see
https://github.com/vorburger/minecraft-storeys-maker/issues/85
@vorburger
Copy link
Member Author

@edewit pointed out that Uncaught Error: INVALID_STATE_ERR means we're using SockJS EventBus too early; and indeed a quick hack to use eb.onopen gets us past that (@edewit wants to nicely work that into the Minecraft wrapp class).

This uncovers another problem, for some reason this is not quite working yet:

awaitUntilJSReturnsValue("Client side test is not yet done", "tester.isDone()");

@vorburger
Copy link
Member Author

this is not quite working yet

Selenium executeScript() doesn't know what do with the failures as Set object; RTFM, it's JavaDoc even says so. @edewit suggested to simply use a JS array instead, and that did the trick.

Enough for now. Future enhancement could be to use executeAsyncScript() instead of executeScript() with a throws for failures instead. In a sense I guess I'm writing a small Selenium / JS Test infrastructure framework here now...

vorburger referenced this issue Jul 2, 2018
but run that new client side, and test new API not Scratch Binding

see https://github.com/vorburger/minecraft-storeys-maker/issues/85

The quick hack fix in test.ts to await EB ready will be replaced
by edewit who will provide something equivalent directly
in the Minecraft API wrapper class.
vorburger referenced this issue Jul 2, 2018
but run that new client side, and test new API not Scratch Binding

see https://github.com/vorburger/minecraft-storeys-maker/issues/85

The quick hack fix in test.ts to await EB ready will be replaced
by edewit who will provide something equivalent directly
in the Minecraft API wrapper class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant