def test_login_invalid_username(self): driver = self.driver start = StartPage(driver) driver.get('https://lesemester.no/logg-inn/') driver.maximize_window() time.sleep(3) #driver.implicitly_wait(5) try: driver.find_element_by_id("menu-item-3895") except NoSuchElementException: print("yes") print("not") time.sleep(3) login = LoginPage(driver) time.sleep(2) login.enter_username("baeru-teacher") time.sleep(2) login.enter_password("TestLesemester2020") time.sleep(2) login.click_login_page_login() time.sleep(2) message_invalid = self.driver.find_element_by_id("errorMsg").text time.sleep(3) self.assertTrue(message_invalid == "Brukernavn eller passord er feil") time.sleep(3)
def test_login_valid(self): driver = self.driver driver.get('http://www.demo.guru99.com/V4/') path = "C://FireFoxProfile/login1.xlsx" rows = spreadsheet.getRowCount(path, 'Sheet1') login = LoginPage(driver) for r in range(2, rows + 1): username = spreadsheet.readData(path, "Sheet1", r, 1) password = spreadsheet.readData(path, "Sheet1", r, 2) login.enter_username(username) login.enter_password(password) login.click_login() if driver.title == "Guru99 Bank Manager HomePage": print("test is passed") spreadsheet.writeData(path, "Sheet1", r, 3, "test passed") driver.get('http://www.demo.guru99.com/V4/') else: print("test failed") spreadsheet.writeData(path, "Sheet1", r, 3, "test failed") # return to homepage and insert password/username for next row in spreadsheet this line does not work WebDriverWait(driver, 300).until(EC.alert_is_present).accept time.sleep(5)
def test_TC_01(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("123456") login.click_login()
def test_login_logout_automation(self): driver = self.driver driver.get('http://3.131.49.106/') login = LoginPage(driver) login.enter_username("*****@*****.**") login.enter_password('qpzm123456\n') homepage = HomePage(driver) homepage.click_logout()
def test_01_login(self): self.driver.get("https://github.com/") # self.driver.find_element_by_link_text("").click() github = LoginPage(self.driver) github.click_signin_button() github.enter_username("shivam1808") github.enter_password("********") github.click_signin()
def test_TC_07(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("123455") login.click_login() openElement = driver.find_element_by_xpath("//form/div/div") elementText = openElement.text Text = "Login or password is incorrect!" assert Text == elementText
def test_TC_03(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("12345") login.click_login() openElement = driver.find_element_by_xpath("//form/div[2]/div") elementText = openElement.text Text = "The entered password must be not less than 6 symbols." assert Text == elementText
def test_02_login_invalid(self): driver = self.driver driver.get("https://opensource-demo.orangehrmlive.com/") login = LoginPage(driver) login.enter_username('Admin1') login.enter_password('admin123') login.click_login() message = login.check_invalid() self.assertEqual(message, "Invalid credentials") time.sleep(2)
def test_TC_01(self): driver = self.driver driver.get("https://area.mtg-bi.com") #Сценарий логина - Начало login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("123456") login.click_login() homepage = HomePage(driver) homepage.open_profile_menu() homepage.click_logout() time.sleep(3)
def test_TC_02(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("") login.enter_password("") login.click_login() openElement = driver.find_element_by_css_selector( "div.invalid-feedback") elementText = openElement.text Text = "Login is not given." assert Text == elementText openElement2 = driver.find_element_by_xpath("//form/div[2]/div") elementText2 = openElement2.text Text2 = "Password is not given." assert Text2 == elementText2
def test_TC_10(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("123456") login.click_login() homepage = HomePage(driver) homepage.open_profile_menu() homepage.open_profile() homepage.select_country("Russia") homepage.enter_phone("9181234567") homepage.select_business_segment("Finance") homepage.click_update() homepage.open_profile_menu() homepage.click_logout()
def test_login_valid(self): driver = self.driver driver.get('https://lesemester.no/logg-inn/') driver.set_window_size(1024, 600) driver.maximize_window() driver.implicitly_wait(5) time.sleep(3) login = LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") login.click_login_page_login() time.sleep(2) homepage = HomePage(driver) time.sleep(4) homepage.click_welcome() time.sleep(3) homepage.click_logout() time.sleep(3)
def test_TC_14(self): driver = self.driver driver.get("https://area.mtg-bi.com") login = LoginPage(driver) login.sign_in() login.enter_username("*****@*****.**") login.enter_password("123456") login.click_login() homepage = HomePage(driver) homepage.open_profile_menu() homepage.open_profile() homepage.select_country("United States") homepage.enter_phone_code("+1") homepage.enter_phone("202 679 45 01") homepage.select_business_segment("Health Care") homepage.click_update() homepage.open_profile_menu() homepage.click_logout()
def test_quiz(self): driver = self.driver driver.get('https://lesemester.no/logg-inn/') driver.maximize_window() time.sleep(3) login = LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") time.sleep(2) login.click_login_page_login() time.sleep(7) driver.find_element_by_xpath( "/html[1]/body[1]/div[1]/div[2]/div[1]/div[3]/div[5]/div[1]" ).click() time.sleep(3) driver.find_element_by_xpath( "//div[contains(@class,'selectContainer latoFont quizFilterViewsSelectionSelector')]//img[contains(@class,'selectArrow')]" ).click() options = driver.find_elements_by_class_name("selectOptionText") time.sleep(3) options[1].click() time.sleep(3) driver.find_element_by_xpath( "//div[contains(@class,'selectContainer latoFont quizFilterViewsSelectionSelector')]//img[contains(@class,'selectArrow')]" ).click() time.sleep(4) options = driver.find_elements_by_class_name("selectOptionText") options[0].click() time.sleep(3) driver.execute_script("window.scrollTo(0, 2000)") time.sleep(3) driver.execute_script("window.scrollTo(2000, 0)") time.sleep(3) driver.find_element_by_class_name("quizFilterEnableQuizButton").click() time.sleep(5) driver.find_element_by_class_name("quizFilterEnableQuizButton").click() time.sleep(3) driver.find_element_by_class_name("searchContainer").click() time.sleep(2) driver.find_element_by_class_name("searchInput").send_keys("10") time.sleep(4) driver.find_element_by_class_name("searchInput").clear() time.sleep(3)
def test_students(self): driver = self.driver driver.get('https://lesemester.no/logg-inn/') driver.maximize_window() time.sleep(3) login = LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") time.sleep(2) login.click_login_page_login() students = StudentsPage(driver) time.sleep(7) students.click_tab_students() time.sleep(4) statics = StaticPage(driver) time.sleep(2) statics.filter_period() time.sleep(2) statics.select_data_filter_from() time.sleep(3) statics.select_data_filter_to() time.sleep(3) driver.find_element_by_xpath( "//div[contains(text(),'Remove all filters')]").click() time.sleep(4) driver.find_element_by_class_name("fullWidth").click() time.sleep(3) driver.find_element_by_xpath( "//div[contains(text(),'BOOK ACTIVITY')]").click() time.sleep(3) driver.find_element_by_class_name("studentDetailsGoBackButton").click() time.sleep(3) driver.find_element_by_xpath( "//div[contains(@class,'selectContainer latoFont studentsTabFilterGroupSelector')]//div[contains(@class,'selectValueComponent centerVertically')]" ).click() options = driver.find_elements_by_class_name("selectOptionText") options[1].click() time.sleep(3) students.filter_by_student_click("10") time.sleep(4) students.clear_filter() time.sleep(2)
def test_automation(self): driver = self.driver driver.maximize_window() driver.get(self.page) homepage = HomePage(driver) homepage.click_sign_in() time.sleep(3) login = LoginPage(driver) login.enter_username(self.user) login.enter_password(self.password) login.click_login() time.sleep(3) home = driver.find_element_by_xpath("//*[@id='header_logo']/a/img") home.click() homepage.buy_cheapest() checkout = CheckoutPage(driver) checkout.perform_checkout() payment = PayPage(driver) payment.pay_by_bank()
def test_01_login_valid(self): driver = self.driver driver.get("https://opensource-demo.orangehrmlive.com/") login = LoginPage(driver) login.enter_username('Admin') login.enter_password('admin123') login.click_login() homepage = HomePage(driver) homepage.click_welcome() homepage.click_logout() # self.driver.find_element_by_id('txtUsername').send_keys("Admin") # self.driver.find_element_by_id('txtPassword').send_keys('admin123') # self.driver.find_element_by_id('btnLogin').click() # self.driver.find_element_by_id('welcome').click() # self.driver.find_element_by_link_text("Logout").click() time.sleep(2)
def test_statistics(self): driver = self.driver driver.get('https://lesemester.no/logg-inn/') driver.maximize_window() time.sleep(3) login = LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") time.sleep(2) login.click_login_page_login() time.sleep(2) statics = StaticPage(driver) driver.execute_script("window.scrollBy(0,document.body.scrollHeight)") time.sleep(8) statics.filter_period() time.sleep(3) statics.select_data_filter_from() time.sleep(3) statics.select_data_filter_to() time.sleep(6)
def test_activity(self): driver=self.driver driver.get('https://lesemester.no/logg-inn/') driver.maximize_window() time.sleep(3) login=LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") time.sleep(2) login.click_login_page_login() time.sleep(7) driver.find_element_by_xpath("/html[1]/body[1]/div[1]/div[2]/div[1]/div[3]/div[6]/div[1]").click() time.sleep(2) time.sleep(2) driver.execute_script("window.scrollTo(0, 2000)") time.sleep(3) driver.execute_script("window.scrollTo(2000, 0)") time.sleep(3) driver.find_element_by_class_name("selectValueComponent").click() options=driver.find_elements_by_class_name("selectOptionText") options[-1].click() time.sleep(3)
def test_library(self): #INDICATE THE LINK TO DRIVER driver = self.driver driver.set_window_size(1024, 600) driver.maximize_window() driver.get('https://lesemester.no/') driver.implicitly_wait(5) #USING STARPAGE CLASS start = StartPage(driver) start.click_login() time.sleep(3) #USING LOGINPAGE CLASS login = LoginPage(driver) login.enter_username("baerum-teacher19") login.enter_password("TestLesemester2020") login.click_login_page_login() time.sleep(2) library = libraryPage(driver) library.click_library() time.sleep(2) library.click_select_book_by_className() book_name_library = library.capture_name_book_select() time.sleep(5) print("book name from library:") print(book_name_library) time.sleep(2) library.click_add_book_to_group() time.sleep(2) library.click_select_group() time.sleep(2) library.verify_details_book() time.sleep(2) library.click_add_book_challenge() time.sleep(4) bookshelf = BookshielfPage(driver) time.sleep(2) bookshelf.click_bookshelf() time.sleep(2) book_name_bookshelf = bookshelf.capture_name_book() time.sleep(5) print("book name from bookshelf") print(book_name_bookshelf) if (book_name_bookshelf == book_name_library): print("book added success") library.click_library() library.search_book_by_name("a good idea") time.sleep(3) library.click_select_book_by_className() time.sleep(3) library.click_add_book_to_group() time.sleep(3) driver.find_element_by_class_name("cancelAddBookToClass").click() time.sleep(3) driver.find_element_by_class_name("bookTabFilterGoBackButton").click() time.sleep(3) library.search_book_by_name("Apropos forelska") time.sleep(3) driver.find_element_by_class_name("bookCoverContainer").click() time.sleep(3) driver.find_element_by_class_name( "bookProfileStartReadingButton").click() time.sleep(7)
def test_book_valid(self): driver = self.driver driver.maximize_window() driver.get('https://lesemester.no/') driver.implicitly_wait(5) driver.get('https://lesemester.no/logg-inn/') login = LoginPage(self.driver) login.enter_username("baerum-teacher19") time.sleep(1) login.enter_password("TestLesemester2020") login.click_login_page_login() try: element_present = EC.presence_of_element_located( (By.XPATH, "//div[@id='root']/div[2]/div/div[3]/div[3]/div/div")) WebDriverWait(self.driver, timeout).until(element_present) except TimeoutException: print("Timed out waiting for page to load") bookshelf = BookshielfPage(self.driver) time.sleep(4) bookshelf.click_bookshelf() time.sleep(3) bookshelf.click_icon_add_book() nums_books = driver.find_elements_by_class_name("bookCoverAddBookIcon") nums_books_len = len(nums_books) print(nums_books_len) num_random_book = randint(0, nums_books_len) time.sleep(3) nums_books[num_random_book].click() time.sleep(3) bookshelf.click_button_select_add() time.sleep(3) bookshelf.select_book_by_className() time.sleep(3) bookshelf.click_button_new_challenge() time.sleep(3) bookshelf.create_new_challenge_select_student_by_group() time.sleep(5) message_success = self.driver.find_element_by_class_name( "notificationItemMessage").text self.assertTrue(message_success == "Challenge sent") time.sleep(3) driver.find_element_by_class_name("bookTabFilterGoBackButton").click() bookshelf.change_group() bookshelf.filter_by_language() bookshelf.filter_by_genre() bookshelf.filter_by_level() time.sleep(2) bookshelf.filter_by_sound() bookshelf.filter_by_quiz() bookshelf.click_remove_filter() time.sleep(2) bookshelf.click_toggle_filter_button() time.sleep(2) element = driver.find_element_by_class_name("bookCoverImage") ActionChains(driver).click_and_hold(element).perform() time.sleep(3) driver.find_element_by_class_name("bookCoverRemoveBookIcon").click() time.sleep(3) driver.find_element_by_class_name("deleteBookModalOkButton").click() time.sleep(3)