OASIS-learn-study / minecraft-storeys-maker

Minecraft extension to make your own stories in, with and for Minecraft - it's like being a movie director!
https://www.learn.study
GNU Affero General Public License v3.0
15 stars 10 forks source link

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

Open vorburger opened 6 years ago

vorburger commented 6 years ago

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 commented 6 years ago

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

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

vorburger commented 6 years ago

@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 commented 6 years ago

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...