Esempio n. 1
0
    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)
Esempio n. 2
0
 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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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_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)
Esempio n. 8
0
    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)