import aiviro

if __name__ == "__main__":
    # init aiviro logger
    aiviro.init_logging()

    #################
    # Test case
    #################
    # create web-robot
    r = aiviro.create_web_robot(headless=False)  # only works in non-headless mode
    r.go_to_url("https://app.simplehq.co/login.html")

    # wait until page is fully loaded
    r.wait_for(aiviro.Text("Hello!"))

    # type login credentials & click log-in button
    r.type_text(aiviro.Input("Email"), "jelenovi.pivo.nelej@wtf.com")
    r.type_text(aiviro.Input("Password"), "123456789")
    r.click(aiviro.Button("Log In"))

    # check that the log-in was invalid
    r.wait_for(aiviro.Text("Information provided is incorrect."), timeout=10)

    # close the web-robot
    r.close()
