Exemplo n.º 1
0
def test_del_alladr(app):
    if app.addline.count() == 0:
        app.addline.add_new(
            Addrress(fname="test",
                     mname="test",
                     lname="test",
                     niname="test",
                     comp="test",
                     addrr="test",
                     homephone="+7777444test",
                     mail="ehgsl@test"))
        app.addline.add_new(
            Addrress(fname="test 2",
                     mname="test 2",
                     lname="test 2",
                     niname="test 2",
                     comp="test 2",
                     addrr="test 2",
                     homephone="+7777444test",
                     mail="ehgsl@test 2"))
    app.addline.delete_alladr()
    assert app.addline.count() == 0


#def test_del_first_adr(app):
#    if app.addline.count()==0:
#        app.addline.add_new(Addrress(fname="test", mname="test", lname="test", niname="test", comp="test", addrr="test", homephone="+7777444test", mail="ehgsl@test"))
#    old_list_adr = app.addline.get_adr_list()
#    app.addline.del_first_adr()
#    assert len(old_list_adr)-1 == app.addline.count()
#    new_list_adr = app.addline.get_adr_list()
#    old_list_adr[0:1]=[]
#    assert old_list_adr == new_list_adr
Exemplo n.º 2
0
def test_add_adr(app):
    old_list_adr = app.addline.get_adr_list()
    addrrss=(Addrress(fname="F29092019", mname="tr", lname="L29092019", niname="hs", comp="yjj", addrr="aa", homtel="+77774444455", mail="ehgsl@dp"))
    app.addline.add_new(addrrss)
    assert len(old_list_adr)+1 == app.addline.count()
    new_list_adr = app.addline.get_adr_list()
    old_list_adr.append(addrrss)
    assert sorted(old_list_adr, key=Addrress.id_or_max) == sorted(new_list_adr, key=Addrress.id_or_max)
Exemplo n.º 3
0
def test_adr_in_group(app):
# сейчас и при (0.7 и 2) срабатывает.....ранее работало корректно при self.wd.implicitly_wait(60), при 5, 30 - падает - происходит выделение чекбокса группы, а его быть не может.
    if app.group.count() == 0:
        app.group.create(Group(name="Test"))
    else:
        if app.addline.count() == 0:
            app.addline.add_new(Addrress(fname="test 3", mname="test 3", lname="test 3", niname="test 3", comp="test 3", addrr="test 3",
                     homtel="+7777444test3", mail="3ehgsl@test"))
    app.addline.first_adr_fist_group()
Exemplo n.º 4
0
def test_edit_fname(app):
    if app.addline.count() == 0:
        app.addline.add_new(
            Addrress(fname="edit",
                     mname="edit",
                     lname="edit",
                     niname="test8",
                     comp="test8",
                     addrr="test8",
                     homephone="+7777444test8",
                     mail="8ehgsl@test"))
    old_list_adr = app.addline.get_adr_list()
    index = randrange(len(old_list_adr))
    addrrss = Addrress(fname="13102019")
    addrrss.id = old_list_adr[index].id
    app.addline.edit_adr_by_index(index, addrrss)
    addrrss.lname = old_list_adr[index].lname
    assert len(old_list_adr) == app.addline.count()
    new_list_adr = app.addline.get_adr_list()
    old_list_adr[index] = addrrss
    assert sorted(old_list_adr,
                  key=Addrress.id_or_max) == sorted(new_list_adr,
                                                    key=Addrress.id_or_max)
Exemplo n.º 5
0
def test_del_some_adr(app):
    if app.addline.count() == 0:
        app.addline.add_new(
            Addrress(fname="test",
                     mname="test",
                     lname="test",
                     niname="test",
                     comp="test",
                     addrr="test",
                     homephone="+7777444test",
                     mail="ehgsl@test"))
    old_list_adr = app.addline.get_adr_list()
    index = randrange(len(old_list_adr))
    app.addline.del_adr_by_index(index)
    assert len(old_list_adr) - 1 == app.addline.count()
    new_list_adr = app.addline.get_adr_list()
    old_list_adr[index:index + 1] = []
    assert old_list_adr == new_list_adr
Exemplo n.º 6
0
 def get_contact_info_from_edit_page(self, index):
     wd = self.app.wd
     self.open_adr_to_edit_by_index(index)
     firstname = wd.find_element_by_name("firstname").get_attribute("value")
     lastname = wd.find_element_by_name("lastname").get_attribute("value")
     id = wd.find_element_by_name("id").get_attribute("value")
     adr = wd.find_element_by_name("address").get_attribute("textarea")
     mail1 = wd.find_element_by_name("email").get_attribute("value")
     mail2 = wd.find_element_by_name("email2").get_attribute("value")
     mail3 = wd.find_element_by_name("email3").get_attribute("value")
     homephone = wd.find_element_by_name("home").get_attribute("value")
     mobilephone = wd.find_element_by_name("mobile").get_attribute("value")
     workphone = wd.find_element_by_name("work").get_attribute("value")
     secondaryphone = wd.find_element_by_name("phone2").get_attribute("value")
     return Addrress(fname=firstname, lname=lastname, id=id, addrr=adr,
                     mail1=mail1, mail2=mail2, mail3=mail3,
                     homephone=homephone, mobilephone=mobilephone,
                     workphone=workphone, secondaryphone=secondaryphone)
Exemplo n.º 7
0
 def get_adr_list(self):
     if self.adrlist_cache is None:
         wd = self.app.wd
         self.app.open_home_page()
         self.adrlist_cache=[]
         #for element in wd.find_elements_by_css_selector("tr"):
         for element in wd.find_elements_by_name("entry"):
 #            text = element.find_element_by_name("selected[]").get_attribute("title")
 #            textL = element.find_element_by_css_selector("td").text
             cells = element.find_elements_by_css_selector("td")
             lastname = cells[1].text
             firstname = cells[2].text
             id=element.find_element_by_name("selected[]").get_attribute("value")
             adr = cells[3].text
             mail = cells[4].text
             all_phones = cells[5].text
             self.adrlist_cache.append(Addrress(lname=lastname, fname=firstname, id=id, addrr = adr, mail = mail,
                                                all_phones_from_home_page = all_phones))
     return list(self.adrlist_cache)
Exemplo n.º 8
0
 def get_contact_from_view_page(self,index):
     wd = self.app.wd
     self.open_adr_view_by_index(index)
     text = wd.find_element_by_id("content").text
     if re.search("H: (.*)", text) is not None:
         homephone = re.search("H: (.*)", text).group(1)
     else:
         homephone=None
     if re.search("M: (.*)", text) is not None:
         mobilephone = re.search("M: (.*)", text).group(1)
     else:
         mobilephone=None
     if re.search("W: (.*)", text) is not None:
         workphone = re.search("W: (.*)", text).group(1)
     else:
         workphone = None
     if re.search("P: (.*)", text) is not None:
         secondaryphone = re.search("P: (.*)", text).group(1)
     else:
         secondaryphone = None
     return Addrress(homephone=homephone, mobilephone=mobilephone, workphone=workphone, secondaryphone=secondaryphone)