Ejemplo n.º 1
0
 def add_contact_to_group_by_id(self, id, group):
     wd = self.app.wd
     NavigationHelper.open_home_page(self)
     self.select_contact_by_id(id)
     self.put_group_name_for_adding(group)
     NavigationHelper.open_home_page(self)
     self.contact_cache = None
Ejemplo n.º 2
0
 def get_contact_info_from_edit_page(self, index):
     wd = self.app.wd
     NavigationHelper.open_home_page(self)
     self.select_contact_by_index(index)
     self.edit_contact_by_index(index)
     firstname = wd.find_element_by_name("firstname").get_attribute("value")
     lastname = wd.find_element_by_name("lastname").get_attribute("value")
     address = wd.find_element_by_name("address").get_attribute("value")
     id = wd.find_element_by_name("id").get_attribute("value")
     home = wd.find_element_by_name("home").get_attribute("value")
     mobile = wd.find_element_by_name("mobile").get_attribute("value")
     phone2 = wd.find_element_by_name("phone2").get_attribute("value")
     email = wd.find_element_by_name("email").get_attribute("value")
     email2 = wd.find_element_by_name("email2").get_attribute("value")
     email3 = wd.find_element_by_name("email3").get_attribute("value")
     return Contacts(firstname=firstname,
                     lastname=lastname,
                     address=address,
                     id=id,
                     home=home,
                     mobile=mobile,
                     phone2=phone2,
                     email=email,
                     email2=email2,
                     email3=email3)
Ejemplo n.º 3
0
 def login(self, username, password):
     wd = self.app.wd
     NavigationHelper.open_home_page(self)
     wd.find_element_by_name("user").clear()
     wd.find_element_by_name("user").send_keys(username)
     wd.find_element_by_name("pass").clear()
     wd.find_element_by_name("pass").send_keys(password)
     wd.find_element_by_xpath("//input[@value='Login']").click()
Ejemplo n.º 4
0
 def create(self, group):
     wd = self.app.wd
     # init group creation
     wd.find_element_by_name("new").click()
     self.fill_group_form(group)
     # submit group creation
     wd.find_element_by_name("submit").click()
     NavigationHelper.return_to_groups_page(self)
     self.group_cache = None
Ejemplo n.º 5
0
 def remove_contact_from_group_by_id(self, group_with_contact_id):
     wd = self.app.wd
     NavigationHelper.open_home_page(self)
     wd.find_element_by_css_selector(
         "select[name='group'] option[value='%s']" %
         group_with_contact_id).click()
     wd.find_element_by_css_selector(
         "td[class='center'] input[type='checkbox']").click()
     wd.find_element_by_name("remove").click()
Ejemplo n.º 6
0
 def create(self, contacts):
     wd = self.app.wd
     # init contact creation
     wd.find_element_by_link_text("add new").click()
     self.fill_contact_form(contacts)
     # submit contact creation
     wd.find_element_by_xpath("(//input[@name='submit'])[2]").click()
     NavigationHelper.open_home_page(self)
     self.contact_cache = None
Ejemplo n.º 7
0
 def modify_contact_by_id(self, id, new_contacts_form):
     wd = self.app.wd
     # submit edit
     NavigationHelper.open_home_page(self)
     self.select_contact_by_id_and_edit(id)
     self.fill_contact_form(new_contacts_form)
     # submit contact modification
     wd.find_element_by_xpath("(//input[@name='update'])[2]").click()
     NavigationHelper.open_home_page(self)
     self.contact_cache = None
Ejemplo n.º 8
0
 def get_contact_from_view_page(self, index):
     wd = self.app.wd
     NavigationHelper.open_home_page(self)
     self.select_contact_by_index(index)
     self.open_contact_view_by_index(index)
     text = wd.find_element_by_id("content").text
     home = re.search("H: (.*)", text).group(1)
     mobile = re.search("M: (.*)", text).group(1)
     phone2 = re.search("P: (.*)", text).group(1)
     return Contacts(home=home, mobile=mobile, phone2=phone2)
Ejemplo n.º 9
0
    def __init__(self, browser, config):
        if browser == "firefox":
            self.wd = webdriver.Firefox(
                capabilities={"marionette": False},
                firefox_binary=
                "/media/WORK/JOB/education/software_testing/PythonForTesters/env/firefox_esr/firefox"
            )
            #self.wd = webdriver.Firefox(capabilities={"marionette": False},
            #                            firefox_binary="/Applications/Firefox 2.app/Contents/MacOS/firefox")
        elif browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "ie":
            self.wd = webdriver.Ie()
        else:
            raise ValueError("Unrecognized browser: %s" % browser)

        self.config = config
        self.base_url = config['web']['baseUrl']

        self.session = SessionHelper(self)
        self.navigation = NavigationHelper(self)
        self.projects = ProjectHelper(self)
        self.mantis_signup = MantisSignUpHelper(self)
        self.mantis_soap_api = MantisSoapApiHelper(self)

        self.james = JamesHelper(self)
        self.mail = MailHelper(self)
Ejemplo n.º 10
0
 def __init__(self):
     self.wd = WebDriver(capabilities={"marionette": False})
     self.wd.implicitly_wait(60)
     self.navigation = NavigationHelper(self)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.contact = ContactHelper(self)
Ejemplo n.º 11
0
 def __init__(self,
              admin_root,
              admin_countries_url,
              admin_zones_url,
              admin_catalog_url,
              admin_name,
              admin_password,
              shop_root,
              browser='Chrome'):
     if browser == 'Chrome':
         self.wd = webdriver.Chrome()
     elif browser == 'Firefox':
         self.wd = webdriver.Firefox()
     elif browser == 'IE':
         self.wd = webdriver.Ie()
     elif browser == 'Safari':
         self.wd = webdriver.Safari()
     else:
         raise ValueError('Unrecognized browser "%s"' % browser)
     self.admin_root = admin_root
     self.admin_countries_url = admin_countries_url
     self.admin_zones_url = admin_zones_url
     self.admin_catalog_url = admin_catalog_url
     self.admin_name = admin_name
     self.admin_password = admin_password
     self.shop_root = shop_root
     self.navigation = NavigationHelper(self)
     self.session = SessionHelper(self)
     self.shop = ShopHelper(self)
     self.admin_catalog = AdminCatalogHelper(self)
Ejemplo n.º 12
0
 def __init__(self):
     # capabilities
     caps = DesiredCapabilities.FIREFOX
     caps['binary'] = 'C:/Program Files/Mozilla Firefox/firefox.exe'
     self.driver = Firefox(capabilities=caps)
     self.session = SessionHelper(self)
     self.navigation = NavigationHelper(self)
Ejemplo n.º 13
0
 def __init__(self):
     self.wd = WebDriver()
     self.wd.implicitly_wait(60)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.contact = ContactHelper(self)
     self.navigation = NavigationHelper(self)
Ejemplo n.º 14
0
 def __init__(self, browser):
     browser_locale = 'en,en_US'
     if browser == "chrome":
         options = Options()
         path = "C:\Tools\Selenium\chromedriver.exe"
         options.add_argument('start-maximized')
         options.add_experimental_option('prefs', {'intl.accept_languages': browser_locale})
         self.wd = webdriver.Chrome(options=options, executable_path=path)
     elif browser == "firefox":
         # binary = FirefoxBinary(r'"C:\Program Files\Mozilla Firefox\firefox.exe"')
         binary = r"C:\Program Files\Mozilla Firefox\firefox.exe"
         path = r"C:\Tools\Selenium\geckodriver.exe"
         profile = webdriver.FirefoxProfile()
         profile.set_preference('intl.accept_languages', browser_locale)
         # self.wd = webdriver.Firefox(firefox_profile=profile)
         self.wd = webdriver.Firefox(firefox_binary=binary, firefox_profile=profile, executable_path=path)
     elif browser == "opera":
         path = "C:\Tools\Selenium\geckodriver.exe"
         options = webdriver.ChromeOptions()
         options.binary_location = r"C:\Program Files\Opera\60.0.3255.118\opera.exe"
         self.wd = webdriver.Opera(options=options)
     elif browser == "edge":
         self.wd = webdriver.Edge()
     else:
         raise ValueError("Failed to start browser: {}. Value not found".format(browser))
     # self.wd.implicitly_wait(5)
     self.session = SessionHelper(self)
     self.file = FileHelper(self)
     self.album = AlbumHelper(self)
     self.menu = MenuHelper(self)
     self.navigation = NavigationHelper(self)
Ejemplo n.º 15
0
 def __init__(self):
     self.wd = WebDriver()
     self.wd.implicitly_wait(5)
     self.session = SessionHelper(self)
     self.payment = PaymentHelper(self)
     self.localization = LocalizationHelper(self)
     self.navigation = NavigationHelper(self)
     self.login_page = LoginPage(self)
     self.currency = Currency(self)
     self.payment_systems = PaymentSystems(self)
Ejemplo n.º 16
0
 def get_contact_list(self):
     if self.contact_cache is None:
         wd = self.app.wd
         NavigationHelper.open_home_page(self)
         self.contact_cache = []
         for element in wd.find_elements_by_xpath("//tr[@name='entry']"):
             cells = element.find_elements_by_tag_name("td")
             contact_id = element.find_element_by_name(
                 "selected[]").get_attribute("value")
             lastname = element.find_element_by_xpath("./td[2]").text
             firstname = element.find_element_by_xpath("./td[3]").text
             address = element.find_element_by_xpath("./td[4]").text
             all_phones = cells[5].text
             all_emails = cells[4].text
             self.contact_cache.append(
                 Contacts(id=contact_id,
                          lastname=lastname,
                          firstname=firstname,
                          address=address,
                          all_phones_from_home_page=all_phones,
                          all_emails_from_home_page=all_emails))
     return self.contact_cache
Ejemplo n.º 17
0
 def __init__(self, browser, base_url):
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.contact = ContactHelper(self)
     self.navigation = NavigationHelper(self)
     self.base_url = base_url
Ejemplo n.º 18
0
 def __init__(self, browser, base_url):
     if browser == "firefox":
         self.wd = WebDriver(capabilities={"marionette": False}, firefox_binary="C:/Program Files/MozillaFirefox2/firefox.exe")
         #self.wd = webdriver.FireFox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome(executable_path='C:\Devel\chromedriver.exe')
     elif browser == "ie":
         self.wd = webdriver.Ie(executable_path='C:\Devel\IEDriverServer.exe')
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.contact = ContactHelper(self)
     self.navigation = NavigationHelper(self)
     self.base_url = base_url
Ejemplo n.º 19
0
 def __init__(self, browser, config):
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.session = SessionHelper(self)
     self.navigation = NavigationHelper(self)
     self.subject = SubjectHelper(self)
     self.assertation = AssertationHelper(self)
     self.config = config
     self.base_url = config['web']['baseURL']
Ejemplo n.º 20
0
 def __init__(self, browser, baseUrl):
     if browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.wd.implicitly_wait(0)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.helper = HelperBase(self)
     self.navigator = NavigationHelper(self)
     self.baseUrl = baseUrl
Ejemplo n.º 21
0
 def __init__(self, browser, host_url):
     if browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     elif browser == "edge":
         self.wd = webdriver.Edge()
     else:
         raise ValueError(f"There is no executable for {browser}")
     self.navigation = NavigationHelper(self, host_url)
     self.auth = AuthorizationHelper(self)
     self.group_helper = GroupHelper(self)
     self.contact_helper = ContactHelper(self)
Ejemplo n.º 22
0
 def __init__(self, browser, base_url, user, password):
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.base_url = base_url
     self.user = user
     self.password = password
     self.navigation = NavigationHelper(self)
     self.session = SessionHelper(self)
     self.project = ProjectHelper(self)
     self.soap = SOAPHelper(self)
Ejemplo n.º 23
0
 def __init__(self, browser, config):
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.session = SessionHelper(self)
     self.navigation = NavigationHelper(self)
     self.project = ProjectHelper(self)
     self.james = JamesHelper(self)
     self.signup = SignupHelper(self)
     self.config = config
     self.base_url = config['web']['baseUrl']
Ejemplo n.º 24
0
 def __init__(self, browser, base_url):
     #self.wd = WebDriver(firefox_binary=FirefoxBinary("C:\\Program Files\\FF_ESR\\firefox.exe"))
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "ie":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser %s" % browser)
     self.wd.implicitly_wait(1)
     self.session = SessionHelper(self)
     self.group = GroupHelper(self)
     self.contact = ContactHelper(self)
     self.navigation = NavigationHelper(self)
     self.base_url = base_url
Ejemplo n.º 25
0
 def __init__(self, browser, baseurl):
     if browser == 'firefox':
         self.wd = webdriver.Firefox()
     elif browser == 'chrome':
         self.wd = webdriver.Chrome()
     elif browser == 'ie':
         self.wd = webdriver.Ie()
         self.wd.implicitly_wait(10)
     elif browser == 'edge':
         self.wd = webdriver.Edge()
     else:
         raise ValueError('Unrecognized browser %s' % browser)
     self.session = SessionHelper(self)
     self.contact = ContactHelper(self)
     self.group = GroupHelper(self)
     self.navigation = NavigationHelper(self)
     self.baseurl = baseurl
Ejemplo n.º 26
0
 def __init__(self, browser, config):
     if browser == "firefox":
         self.wd = webdriver.Firefox()
     elif browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "IE":
         self.wd = webdriver.Ie()
     else:
         raise ValueError("Unrecognized browser: %s", browser)
     self.wd.implicitly_wait(1)
     self.config = config
     self.navigation = NavigationHelper(self, config['web']["baseUrl"])
     self.session = SessionHelper(self)
     self.project = ProjectHelper(self)
     self.james = JamesHelper(self)
     self.signup = SignupHelper(self)
     self.mail = MailHelper(self)
     self.soap = SoapHelper(self)
Ejemplo n.º 27
0
 def __init__(self, browser, config):
     if browser == "chrome":
         self.wd = webdriver.Chrome()
     elif browser == "firefox":
         self.wd = webdriver.Firefox()
     else:
         raise ValueError("Unknown browser: %s" % browser)
     # self.wd.implicitly_wait(5)
     self.session = SessionHelper(self)
     self.filler = FillerHelper(self)
     self.navigation = NavigationHelper(self)
     self.mantis_project = MantisProjectHelper(self)
     self.james = JamesHelper(self)
     self.mail = MailHelper(self)
     self.signup = SignupHelper(self)
     self.soap = SoapHelper(self)
     self.config = config
     self.base_url = config["app"]["baseurl"]
     self.username = config["app"]["username"]
     self.password = config["app"]["password"]
Ejemplo n.º 28
0
    def __init__(self, browser, base_url):
        if browser == "firefox":
            self.wd = webdriver.Firefox(
                capabilities={"marionette": False},
                firefox_binary=
                "/media/WORK/JOB/education/software_testing/PythonForTesters/env/firefox_esr/firefox"
            )
            #self.wd = webdriver.Firefox(capabilities={"marionette": False},
            #                            firefox_binary="/Applications/Firefox 2.app/Contents/MacOS/firefox")
        elif browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "ie":
            self.wd = webdriver.Ie()
        else:
            raise ValueError("Unrecognized browser: %s" % browser)

        self.base_url = base_url

        self.session = SessionHelper(self)
        self.navigation = NavigationHelper(self)
        self.groups = GroupHelper(self)
        self.contacts = ContactHelper(self)
Ejemplo n.º 29
0
 def del_contact_by_id(self, id):
     wd = self.app.wd
     # select contact
     NavigationHelper.open_home_page(self)
     self.select_contact_by_id(id)
     wd.find_element_by_xpath("//input[@value='Delete']").click()
     try:
         WebDriverWait(wd, 1).until(EC.alert_is_present(), 'No alert')
         alert = wd.switch_to.alert
         alert.accept()
         wd.find_element_by_css_selector("div.msgbox")
     except TimeoutException:
         print("no alert")
     finally:
         NavigationHelper.open_home_page(self)
     NavigationHelper.open_home_page(self)
     self.contact_cache = None
Ejemplo n.º 30
0
 def __init__(self):
     self.wd = WebDriver()
     self.wd.implicitly_wait(5)
     self.session = SessionHelper(self)
     self.search = SearchHelper(self)
     self.navigation = NavigationHelper(self)