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/.
5 from __future__
import absolute_import
, print_function
, unicode_literals
10 from tryselect
.selectors
.chooser
.app
import create_application
16 "label": "build-windows",
18 "build_platform": "windows",
23 "label": "test-windows-mochitest-e10s",
25 "unittest_suite": "mochitest-browser-chrome",
26 "mochitest_try_name": "mochitest-browser-chrome",
34 app
= create_application(tg
)
35 app
.config
["TESTING"] = True
37 ctx
= app
.app_context()
43 def test_try_chooser(app
):
44 client
= app
.test_client()
46 response
= client
.get("/")
47 assert response
.status_code
== 200
50 b
"""<title>Try Chooser Enhanced</title>""",
51 b
"""<input class="filter" type="checkbox" id=windows name="build" value='{"build_platform": ["windows"]}' onchange="console.log('checkbox onchange triggered');apply();">""", # noqa
52 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
55 for expected
in expected_output
:
56 assert expected
in response
.data
58 response
= client
.post("/", data
={"action": "Cancel"})
59 assert response
.status_code
== 200
60 assert b
"You may now close this page" in response
.data
61 assert app
.tasks
== []
63 response
= client
.post("/", data
={"action": "Push", "selected-tasks": ""})
64 assert response
.status_code
== 200
65 assert b
"You may now close this page" in response
.data
66 assert app
.tasks
== []
68 response
= client
.post(
72 "selected-tasks": "build-windows\ntest-windows-mochitest-e10s",
75 assert response
.status_code
== 200
76 assert b
"You may now close this page" in response
.data
77 assert set(app
.tasks
) == set(["build-windows", "test-windows-mochitest-e10s"])
80 if __name__
== "__main__":