Exemplo n.º 1
0
def test_something():
     application = Application.Launch('c:\\Program Files (x86)\\GAS Softwares\\Free Address Book\\AddressBook.exe')
     main_window = application.GetWindow("Free Address Book")
     main_window.Get(SearchCriteria.ByAutomationId("groupButton")).Click()
     modal = main_window.ModalWindow('Group editor')
     modal.Get(SearchCriteria.ByAutomationId("uxCloseAddressButton")).Click()
     main_window.Get(SearchCriteria.ByAutomationId("uxExitAddressButton")).Click()
    def _attach_application(sut_identifier, timeout=0):
        exception_message = "Unable to locate application with identifier: {}".format(
            sut_identifier)
        if timeout == 0:
            try:
                return Application.Attach(sut_identifier)
            except WhiteException:
                raise AssertionError(exception_message)

        # using hack due to 2.7 doesnt support nonlocal keyword
        # and inner function cant modify primitive datatypes.
        # aand im trying to avoid calling Application.Attach()
        # multiple times as it allocates memory on python .net
        # side.

        hack = {"sut": None}

        def search_application():
            try:
                hack["sut"] = Application.Attach(sut_identifier)  # noqa: F841
                return True
            except WhiteException:
                return False

        Wait.until_true(search_application, timeout, exception_message)

        return hack["sut"]
    def launch_application(self, sut_path, args=None):
        """Launches an application.

        ``sut_path`` is the absolute path to the application to launch.

        ``args`` is a string of arguments to use when starting the application (optional).

        Examples:
        | Launch Application | C:/path/to/MyApp.exe | | # Launch without arguments |
        | Launch Application | C:/path/to/MyApp.exe | /o log.txt | # Launch with arguments |
        """
        if args is not None:
            process_start_info = ProcessStartInfo(sut_path)
            process_start_info.Arguments = args
            self.state.app = Application.Launch(process_start_info)
        else:
            self.state.app = Application.Launch(sut_path)
    def attach_application_by_id(self, sut_id):
        """Attaches a running application by process id.

        ``sut_id`` is the application process id.

        Example:
        | Attach Application By Id | 12188 |
        """
        self.state.app = Application.Attach(int(sut_id))
    def attach_application_by_name(self, sut_name):
        """Attaches a running application by name.

        ``sut_name`` is the name of the process.

        Example:
        | Attach Application By Name | UIAutomationTest |
        """
        self.state.app = Application.Attach(sut_name)
def test_something():
    application = Application.Launch("C:\\Program Files (x86)\\GAS Softwares\\Free Address Book\\AddressBook.exe")
    main_window = application.GetWindow("Free Address Book")
    old_list = get_group_list(main_window)
    add_new_group(main_window, 'test group')
    new_list = get_group_list(main_window)
    old_list.append('test group')
    assert sorted(old_list) == sorted(new_list)
    main_window.Get(SearchCriteria.ByAutomationId("uxExitAddressButton")).Click()
Exemplo n.º 7
0
def test_1():
    application = Application.Launch("C:\\addressbook_exe\\AddressBook.exe")
    main_window = application.GetWindow("Free Address Book")
    old_list = get_group_list(main_window)
    add_new_group(main_window, 'test group')
    new_list = get_group_list(main_window)
    old_list.append('test group')
    assert sorted(old_list) == sorted(new_list)
    main_window.Get(
        SearchCriteria.ByAutomationId("uxExitAddressButton")).Click()
Exemplo n.º 8
0
def test_something():
    application = Application.Launch(
        "c:\\Tools\\AppsForTesting\\AddressbookNative4\\AddressBook.exe")
    main_window = application.GetWindow("Free Address Book")
    old_list = get_group_list(main_window)
    add_new_group(main_window, 'test group')
    new_list = get_group_list(main_window)
    old_list.append('test group')
    assert sorted(old_list) == sorted(new_list)
    main_window.Get(
        SearchCriteria.ByAutomationId("uxExitAddressButton")).Click()
Exemplo n.º 9
0
def test_something():
    application = Application.Launch(
        "C:\\Program Files (x86)\\GAS Softwares\\Free Address Book\\AddressBook.exe"
    )
    main_window = application.GetWindow("Free Address Book")
    main_window.Get(SearchCriteria.ByAutomationId("groupButton")).Click()
    modal = main_window.ModalWindow("Group editor")

    modal.Get(SearchCriteria.ByAutomationId("uxNewAddressButton")).Click()
    modal.Get(SearchCriteria.ByControlType(
        ControlType.Edit)).Enter('test group')
    Keyboard.Instance.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN)

    time.sleep(10)

    modal.Get(SearchCriteria.ByAutomationId("uxCloseAddressButton")).Click()

    main_window.Get(
        SearchCriteria.ByAutomationId("uxExitAddressButton")).Click()
Exemplo n.º 10
0
def test_smth():
    Application.Launch("notepad.exe")
    print("ok")
def test_something():
    application = Application.Launch("iexplore.exe")
    main_window = application.GetWindow('Free Address Book')
    
    print('ok')
Exemplo n.º 12
0

#IronPython case use other .NET testing framework like MS UI Automation or White

import sys
import os
import clr

clr.AddReferenceToFile("nautoit.dll")   

clr.AddReferenceToFile("TestStack.White.dll")     

from nautoit import au
from  TestStack.White import Application
from  TestStack.White.InputDevices import Keyboard

application = Application.Launch("notepad.exe");
window = application.GetWindow("Untitled - Notepad");
window.Focus()
Keyboard.Instance.Enter("This is some text.");
window.Close()
#Allows step by step migration from AutoIt to anything else
close = au.WinWaitActive("Notepad", "Save")
au.Send("!n")
Exemplo n.º 13
0
 def launch_application(self, sut_path):
     self.state.app = Application.Launch(sut_path)
Exemplo n.º 14
0
    def attach_application_by_id(self, sut_id):
        """ Attaches to a running application by id.

        ``sut_id`` is the application process id.
        """
        self.state.app = Application.Attach(int(sut_id))
Exemplo n.º 15
0
    def attach_application_by_name(self, sut_name):
        """ Attaches to a running application by name.

        ``sut_name`` is the application process name.
        """
        self.state.app = Application.Attach(sut_name)
Exemplo n.º 16
0
def launch_application(app_path):
    application = Application.Launch(app_path)
    main_window = application.GetWindow("Free Address Book")
    return main_window
 def __init__(self, appname):
     self.application = Application.Launch(appname)
     self.main_window = self.application.GetWindow("Free Address Book")
 def search_application():
     try:
         hack["sut"] = Application.Attach(sut_identifier)  # noqa: F841
         return True
     except WhiteException:
         return False
Exemplo n.º 19
0
def  test_something():
    Application.Launch("notepad.exe")
    print("ok")
Exemplo n.º 20
0
 def __init__(self):
     self.group = GroupHelper(self)
     self.application = Application.Launch(
         "C:\\Program Files (x86)\\GAS Softwares\\Free Address Book\\AddressBook.exe"
     )
     self.main_window = self.application.GetWindow("Free Address Book")
Exemplo n.º 21
0
 def __init__(self, path_to_app, main_window_header):
     self.application = Application.Launch(path_to_app)
     self.group = GroupHelper(self)
     self.main_window_header = main_window_header
Exemplo n.º 22
0
 def __init__(self, base_address):
     self.group = GroupHelper(self)
     application = Application.Launch(base_address)
     self.main_window = application.GetWindow("Free Address Book")
Exemplo n.º 23
0
 def __init__(self, path):
     self.application = Application.Launch(path)
     self.main_window = self.application.GetWindow("Free Address Book")
     self.group = GroupHelper(self)