1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from tryselect
.selectors
.chooser
.app
import create_application
14 "label": "build-windows",
16 "build_platform": "windows",
21 "label": "test-windows-mochitest-e10s",
23 "unittest_suite": "mochitest-browser-chrome",
24 "mochitest_try_name": "mochitest-browser-chrome",
32 return multiprocessing
.Queue()
37 app
= create_application(tg
, queue
)
38 app
.config
["TESTING"] = True
40 ctx
= app
.app_context()
46 def test_try_chooser(app
, queue
: multiprocessing
.Queue
):
47 client
= app
.test_client()
49 response
= client
.get("/")
50 assert response
.status_code
== 200
53 b
"""<title>Try Chooser Enhanced</title>""",
54 b
"""<input class="filter" type="checkbox" id=windows name="build" value='{"build_platform": ["windows"]}' onchange="console.log('checkbox onchange triggered');apply();">""", # noqa
55 b
"""<input class="filter" type="checkbox" id=mochitest-browser-chrome name="test" value='{"unittest_suite": ["mochitest-browser-chrome"]}' onchange="console.log('checkbox onchange triggered');apply();">""", # noqa
58 for expected
in expected_output
:
59 assert expected
in response
.data
61 response
= client
.post("/", data
={"action": "Cancel"})
62 assert response
.status_code
== 200
63 assert b
"You may now close this page" in response
.data
64 assert queue
.get() == []
66 response
= client
.post("/", data
={"action": "Push", "selected-tasks": ""})
67 assert response
.status_code
== 200
68 assert b
"You may now close this page" in response
.data
69 assert queue
.get() == []
71 response
= client
.post(
75 "selected-tasks": "build-windows\ntest-windows-mochitest-e10s",
78 assert response
.status_code
== 200
79 assert b
"You may now close this page" in response
.data
80 assert set(queue
.get()) == set(["build-windows", "test-windows-mochitest-e10s"])
83 if __name__
== "__main__":