ElectronTests.query_testid
— Methodquery_testid(testsession::TestSession, id::String)
Returns a JSObject representing the object found for id
.
ElectronTests.query_testid
— Methodquery_testid(id::String)
Returns a js string, that queries for id
.
ElectronTests.testsession
— Method testsession(f, handler; url="0.0.0.0", port=8081, timeout=300)
testsession(handler; url="0.0.0.0", port=8081, timeout=300)) do testsession
# test code using testsession
end
This function will ensure proper setup and teardown once done with the tests or whenever an error occurs. The testsession object passed to f
allows to communicate with the browser session, run javascript and get values from the html dom!
ElectronTests.trigger_keyboard_press
— Functiontrigger_keyboard_press(testsession::TestSession, code::String, element=nothing)
Triggers a keyboard press on element
! If element is nothing
, the event will be triggered for the whole document
! Find out the key code string to pass at http://keycode.info/
ElectronTests.trigger_mouse_move
— Functiontrigger_mouse_move(testsession::TestSession, code::String, position::Tuple{Int, Int}, element=nothing)
Triggers a MouseMove event! If element == nothing, it will try to trigger on any canvas element found in the DOM.
JSServe.evaljs
— Methodevaljs(testsession::TestSession, js::JSCode)
Runs javascript code js
in testsession. Will return the return value of js
. Might return garbage data, if return value isn't json serializable.
Example:
evaljs(testsession, js"document.getElementById('the-id')")
ElectronTests.@wait_for
— Macrowait_test(condition)
Waits for condition expression to become true and then tests it!
ElectronTests.JSTest
— ConstantOur Javascript library, defining a few JS helper functions!
ElectronTests.TestSession
— TypeTestSession(handler)
Main construct, which will lunch an electron browser session, serving the application created by handler(testsession)::DOM.div
. Can be used via the testsession function:
testsession(handler; url="0.0.0.0", port=8081, timeout=300)) do testsession
# test code using testsession
end
This will ensure proper setup and teardown once done with the tests. The testsession object allows to communicate with the browser session, run javascript and get values from the html dom!
Base.close
— Methodclose(testsession::TestSession)
Close the testsession and clean up the state!
ElectronTests.reload!
— Methodreload!(testsession::TestSession)
Reloads the served application and waits untill all state is initialized.
ElectronTests.wait
— Methodwait(testsession::TestSession; timeout=300)
Wait for testsession to be fully loaded! Note, if you call wait on a fully loaded test
JSServe.start
— Methodstart(testsession::TestSession)
Start the testsession and make sure everything is loaded correctly. Will close all connections, if any error occurs!