123456789101112131415161718192021222324252627282930313233 |
- # Copyright 2021-2025 Avaiga Private Limited
- #
- # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- # specific language governing permissions and limitations under the License.
- from taipy.gui.gui import Gui
- def test_multiple_instance(gui_server, helpers):
- gui1 = Gui("<|gui1|>", server=gui_server)
- gui2 = Gui("<|gui2|>", server=gui_server)
- gui1.run(run_server=False)
- gui2.run(run_server=False)
- client1 = gui1._server.test_client()
- client2 = gui2._server.test_client()
- assert_multiple_instance(client1, helpers, 'value="gui1"')
- assert_multiple_instance(client2, helpers, 'value="gui2"')
- def assert_multiple_instance(client, helpers, expected_value):
- response = client.get("/taipy-jsx/TaiPy_root_page")
- response_data = helpers.get_response_data(response)
- assert response.status_code == 200
- assert isinstance(response_data, dict)
- assert "jsx" in response_data
- assert expected_value in response_data["jsx"]
|