Exemplo n.º 1
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)

    automator.element(With.link_text("Posts")).click()
    automator.element(With.link_text("Add New")).click()

    automator.element(With.id("title")).set_text("Sample")

    tinymce = With.id("tinymce")
    publish = With.id("publish")

    # Frame by identifier and jump to root
    automator.Frame(With.id("content_ifr")).focus()
    automator.element(tinymce).set_text("This is a test - frame by name.")
    automator.DomRoot().focus()
    automator.element(publish).click()

    # Frame by index
    automator.Frame(With.index(0)).focus()
    automator.element(tinymce).set_text("This is a test - frame by index.")
    automator.DomRoot().focus()
    automator.element(publish).click()

    # jump to parent frame
    frame = automator.Frame(With.xpath("//iframe"))
    frame.focus()
    automator.element(tinymce).set_text(
        "This is a test - jumping to parent after this.")
    frame.ParentFrame().focus()
    automator.element(publish).click()

    WPLoginLogout.logout(automator)
Exemplo n.º 2
0
def test(my):

    automator = Arjuna.create_gui_automator()

    # Create Gui. Provide GNS file path
    app = DefaultGui(automator, "WordPress", "simpleapp/WordPress.gns")

    # Login
    app.Browser().go_to_url(automator.get_config().get_user_option_value("wp.login.url").as_string())
    app.Element("login").set_text("user")
    app.Element("password").set_text("bitnami")
    app.Element("submit").click()
    app.Element("view-site").wait_until_clickable()

    # Tweak Settings
    app.Element("settings").click()

    role_select = app.DropDown("role")
    print(role_select.has_visible_text_selected("Subscriber"))
    print(role_select.has_value_selected("subscriber"))
    print(role_select.has_index_selected(2))
    print(role_select.get_first_selected_option_text())
    role_select.select_by_value("editor")
    role_select.select_by_visible_text("Subscriber")
    role_select.select_by_index(4)

    # Logout
    app.Browser().go_to_url(automator.get_config().get_user_option_value("wp.logout.url").as_string())
    app.get_automator().quit()
def test(my):

    automator = Arjuna.create_gui_automator()

    home = HomePage(automator)
    home\
    .login()\
    .left_nav\
    .go_to_settings()\
    .tweak_settings()\
    .top_nav\
    .logout()

    automator.quit()
Exemplo n.º 4
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)

    automator.element(With.link_text("Settings")).click()

    data_format = automator.RadioGroup(With.name("date_format"))
    print(data_format.has_value_selected("Y-m-d"))
    print(data_format.has_index_selected(1))
    print(data_format.get_first_selected_option_value())
    data_format.select_by_value(r"\c\u\s\t\o\m")
    data_format.select_by_index(2)

    WPLoginLogout.logout(automator)
Exemplo n.º 5
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)

    automator.element(With.link_text("Posts")).click()
    automator.element(With.link_text("Categories")).click()

    checkboxes = automator.multi_element(With.name("delete_tags[]"))
    checkboxes.IndexedElement(0).uncheck()
    checkboxes.IndexedElement(0).check()
    checkboxes.IndexedElement(0).check()
    checkboxes.IndexedElement(1).check()

    WPLoginLogout.logout(automator)
Exemplo n.º 6
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)
    automator.element(With.link_text("Settings")).click()

    role_select = automator.DropDown(With.id("default_role"))
    print(role_select.has_visible_text_selected("Subscriber"))
    print(role_select.has_value_selected("subscriber"))
    print(role_select.has_index_selected(2))
    print(role_select.get_first_selected_option_text())
    role_select.select_by_value("editor")
    role_select.select_by_visible_text("Subscriber")
    role_select.select_by_index(4)

    WPLoginLogout.logout(automator)
Exemplo n.º 7
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)

    main_win = automator.MainWindow()
    main_win.maximize()
    print(main_win.get_title())

    automator.execute_javascript("window.open('/abc')")
    win = automator.LatestChildWindow()
    win.focus()
    print(win.get_title())
    win.close()

    automator.execute_javascript("window.open('/def')")
    automator.execute_javascript("window.open('/xyz')")
    automator.close_all_child_windows()
    print(main_win.get_title())
    
    WPLoginLogout.logout(automator)
Exemplo n.º 8
0
def test(my):
    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)

    automator.execute_javascript("alert('dummy')")
    automator.Alert().confirm()
    automator.execute_javascript("alert('dummy')")
    automator.Alert().dismiss()

    automator.execute_javascript("alert('Sample')")
    alert = automator.Alert()
    assert alert.get_text() == "Sample"
    alert.confirm()

    automator.execute_javascript("prompt('Are You Sure?')")
    alert = automator.Alert()
    alert.send_text("Yes")
    alert.confirm()

    WPLoginLogout.logout(automator)
def test(my):

    automator = Arjuna.create_gui_automator()

    WPLoginLogout.login(automator)
    WPLoginLogout.logout(automator)
Exemplo n.º 10
0
 def __launch_automator(config=None, econfig=None):
     # Default Gui automation engine is Selenium
     config = config and config or Arjuna.get_ref_config()
     self.__automator = Arjuna.create_gui_automator(config=config,
                                                    extended_config=econfig)
Exemplo n.º 11
0
 def setUp(self):
     self.__automator = Arjuna.create_gui_automator()
     self.__config = self.automator.config