# Path: tests/helpers.py
# def convert_sec_to_ms(timeout):
#     return timeout * 1000


import os
from tests.helpers import convert_sec_to_ms
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


EMPTY_PAGE_URL = (
    'file://'
    + os.path.abspath(os.path.dirname(__file__))
    + '/../../resources/empty.html'
)


class LoadingHtmlPage:
    def __init__(self, timeout=0, body=''):
        self._body = body
        self._timeout = timeout

    def load_in(self, driver):
        driver.get(EMPTY_PAGE_URL)

# Path: tests/helpers.py
# def convert_sec_to_ms(timeout):
#     return timeout * 1000


# Path: tests/integration/helpers/givenpage.py
import os
from tests.helpers import convert_sec_to_ms

# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


EMPTY_PAGE_URL = (
    'file://'
    + os.path.abspath(os.path.dirname(__file__))
    + '/../../resources/empty.html'
)


class LoadingHtmlPage:
    def __init__(self, timeout=0, body=''):
        self._body = body
        self._timeout = timeout

    def load_in(self, driver):
        driver.get(EMPTY_PAGE_URL)

        return LoadedHtmlPage(driver).render_body(self._body, self._timeout)