def setUp(self): self.driver = webdriver.Firefox() self.driver.get(static_data.base_url + "login") fields.get_components_by_name(self.driver, ["username=Radni", "password=testtest", "submit"])[2].click() self.driver.get(static_data.base_url + "profile/clerks-table") self.driver.find_element_by_id("addShow").click()
def setUp(self): self.driver = webdriver.Firefox() self.driver.get(static_data.base_url + "login") fields.get_components_by_name( self.driver, ["username=user", "password=testtest", "submit"])[2].click() self.driver.get(static_data.base_url + "/profile/int-trans")
def test_app_pay_charge_empty(self): before = int(self.driver.find_element_by_tag_name("tbody").find_elements_by_tag_name("tr")[0]. \ find_elements_by_tag_name("td")[1].text) fields.get_components_by_name(self.driver, ["buy"])[0].click() after = int(self.driver.find_element_by_tag_name("tbody").find_elements_by_tag_name("tr")[0]. \ find_elements_by_tag_name("td")[1].text) assert after - before == 0
def setUp(self): self.driver = webdriver.Firefox() self.driver.get(static_data.base_url + "login") fields.get_components_by_name( self.driver, ["username=boss", "password=bossboss", "submit"])[2].click() self.driver.get(static_data.base_url + "profile/clerks-table")
def test_ret_money_fail(self): # Assume Money < Needed self.driver.find_element_by_id("Curr_Type").send_keys("Rial") fields.get_components_by_name( self.driver, ["payee-id=1111222233334444", "price=100000000", "submit" ])[2].click() assert "Enough" in self.driver.find_element_by_tag_name("body").text
def test_pay_rial(self): # Assume Money > Needed self.driver.find_element_by_id("Curr_Type").send_keys("Rial") fields.get_components_by_name( self.driver, ["payee-id=" + static_data.valid_rial_wallet_address, "price=10"]) self.driver.find_element_by_id('login').click() assert "profile/int-trans" in self.driver.current_url
def test_pay_price_format(self): self.driver.find_element_by_id("Curr_Type").send_keys("Rial") fields.get_components_by_name(self.driver, [ "payee-id=" + static_data.valid_rial_wallet_address, "price=1dfsd0", "login" ])[2].click() assert "int-trans" in self.driver.current_url
def test_login_empty_username(self): driver = self.driver driver.get(static_data.base_url + "login") fields.get_components_by_name(driver, ["password=1234567", "submit"])[1].click() assert "login" in driver.current_url
def test_pay_too_low(self): self.driver.find_element_by_id("Curr_Type").send_keys("Rial") fields.get_components_by_name(self.driver, [ "payee-id=" + static_data.valid_rial_wallet_address, "price=-10", "login" ])[2].click() assert "Enough" in self.driver.find_element_by_tag_name("body").text
def test_login_password(self): driver = self.driver driver.get(static_data.base_url + "login") fields.get_components_by_name( driver, ["username=smjfas", "password=123", "submit"])[2].click() assert "login" in driver.current_url
def setUp(self): self.driver = webdriver.Firefox() self.driver.get(static_data.base_url + "login") fields.get_components_by_name( self.driver, ["username=smjfas", "password=smjfas", "submit"])[2].click() self.driver.get(static_data.base_url + "/profile/ret-mon")
def test_pay_too_low(self): driver = self.driver driver.get(static_data.base_url + self.address) fields.get_components_by_name( driver, ["payee-id=1111222233334444", "price=-2", "submit"])[2].click() assert driver.find_element_by_id("inValid") is not None
def test_pay_euro_fail(self): # Assume Money < Needed self.driver.find_element_by_id("Curr_Type").send_keys("Euro") fields.get_components_by_name(self.driver, [ "payee-id=" + static_data.valid_euro_wallet_address, "price=10", "login" ])[2].click() assert "Enough" in self.driver.find_element_by_tag_name("body").text
def test_user_inf_pass_mismatch(self): driver = self.driver driver.get(static_data.base_url + self.address) fields.get_components_by_name(driver, ["phonenumber=09398604014", "avatar=m.jpg", "password=1234", "ret-password=12234", "[email protected]", "change"])[5].click() assert driver.find_element_by_id("inValid") is not None
def test_empty_address(self): driver = self.driver driver.get(static_data.base_url + "register") fields.get_components_by_name(driver, ["name=smjfas", "family=feyzabadisani", "[email protected]", "person_id=1234565987", "username=smjfas", "password=hello123", "repass=hello123", "cellphone=09398604014", "submit"])[8].click() assert "register" in driver.current_url
def test_pay_dollar(self): # Assume Money > Needed self.driver.find_element_by_id("Curr_Type").send_keys("Rial") fields.get_components_by_name(self.driver, [ "payee-id=" + static_data.valid_dollar_wallet_address, "price=10", "login" ])[2].click() assert "successful" in self.driver.find_element_by_tag_name( "body").text
def test_contact_not_registered_username(self): driver = self.driver driver.get(static_data.base_url + "contact") fields.get_components_by_name(driver, ["name=smj", "family=feyz", "username=ali", "[email protected]", "cellphone=09398604014", "message=this is a test.", "captcha=1234", "submit"])[7].click() assert driver.find_element_by_id("inValid") is not None
def setUp(self): self.driver = webdriver.Firefox() self.driver.get(static_data.base_url + "login") fields.get_components_by_name( self.driver, ["username=clerk", "password=clerk", "submit"])[2].click() self.driver.get(static_data.base_url + "profile/show-clerk-send-message")
def test_criticism(self): driver = self.driver driver.get(static_data.base_url + "criticism") fields.get_components_by_name(driver, ["name=smj", "family=fas", "[email protected]", "message_topic=test", "message_body=This is a test message", "phonenumber=09398604014", "captcha=1234", "submit"])[7].click() assert driver.find_element_by_id("response") is not None
def test_empty_income(self): a = len(self.driver.find_elements_by_tag_name('tr')) fields.get_components_by_name(self.driver, ["name=smjfas", "family=feyzabadisani", "[email protected]", "person_id=1234565987", "username=smjfas", "password=hello123", "repass=hello123", "cellphone=09398604014", "captcha=1234", "address=21st number baker st.", "submit"])[9].click() b = len(self.driver.find_elements_by_tag_name('tr')) assert a -b is 0
def test_sql_injection(self): driver = self.driver driver.get(static_data.base_url + "login") fields.get_components_by_name( driver, ["username=select * from x_users", "password=1234567", "submit" ])[2].click() assert "login" in driver.current_url
def test_register_phone_number_long_length(self): driver = self.driver driver.get(static_data.base_url + "register") fields.get_components_by_name(driver, ["name=smjfas", "family=feyzabadisani", "[email protected]", "person_id=1234565987", "username=smjfas", "password=hello123", "repass=hello123", "cellphone=0939833604014", "address=21st number baker st.", "submit"])[9].click() assert "register" in driver.current_url
def test_add_clerk(self): num_of_clerks = len(self.driver.find_elements_by_tag_name('tr')) fields.get_components_by_name(self.driver, [ "name=clerk", "family=feyzabadisani", "[email protected]", "person_id=0019998888", "username=rade", "password=hello123", "repass=hello123", "cellphone=09398604014", "income=100", "address=21st number baker st.", "submit" ])[10].click() new_number = len(self.driver.find_elements_by_tag_name('tr')) assert new_number - num_of_clerks is 1
def test_exchanger(self): elements = fields.get_components_by_name( self.driver, ["CURR_FR_VAL=1", "CURR_FR", "CURR_TO", "convert", "CURR_VAL"]) elements[3].click() time.sleep(2) assert elements[4].get_attribute('value') != "0"
def test_forget_empty_checkbox(self): driver = self.driver driver.get(static_data.base_url + "forget") components = fields.get_components_by_name(driver, ["phone-number=09398604014", "[email protected]", "captcha=1234", "submit"]) components[3].click() assert driver.find_element_by_id("inValid") is not None
def test_communication(self): driver = self.driver driver.get(static_data.base_url + self.address) ways = fields.get_components_by_name(driver, ["smsReport", "tgReport", "emailReport", "change"]) ways[0].click() ways[1].click() ways[3].click() assert driver.find_element_by_id("successful") is not None
def test_forget_sms(self): driver = self.driver driver.get(static_data.base_url + "forget") components = fields.get_components_by_name(driver, ["sms-check", "phone-number=09398604014", "[email protected]", "captcha=1234", "submit"]) components[0].click() components[4].click() assert driver.find_element_by_id("successful") is not None
def test_forget_phone_short_length(self): driver = self.driver driver.get(static_data.base_url + "forget") components = fields.get_components_by_name(driver, [ "telegram-check", "phone-number=0939140", "[email protected]", "captcha=1234", "submit" ]) components[0].click() components[4].click() assert driver.find_element_by_id("inValid") is not None
def test_forgot_sql_injection(self): driver = self.driver driver.get(static_data.base_url + "forget") components = fields.get_components_by_name(driver, [ "telegram-check", "phone-number=09398604014", "email=select * from users", "captcha=1234", "submit" ]) components[0].click() components[4].click() assert driver.find_element_by_id("inValid") is not None
def test_exchanger_format(self): elements = fields.get_components_by_name( self.driver, ["CURR_FR_VAL", "CURR_FR", "CURR_TO", "convert", "CURR_VAL"]) elements[0].clear() elements[0].send_keys("as") elements[3].click() wait = WebDriverWait(self.driver, 10) wait.until(EC.alert_is_present()) alert = self.driver.switch_to.alert time.sleep(2) assert "enter a number" in alert.text alert.accept()