def test_bookshelf06(self):

        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Bookshelf nav")
        utils.Find_and_Click(xpath['bookshelf_btn'])
        self.assertIn("Shared With Me",
                      utils.Get_element_text(xpath['page_title']))

        print("Clicking on My Bookshelf button")
        utils.Find_and_Click(xpath['my_bookshelf_nav'])
        self.assertIn("My Bookshelf",
                      utils.Get_element_text(xpath['page_title']))

        print("Opening the window: Select Resource Type")
        utils.Find_and_Click(xpath['add_resource_btn'])
        utils.Find_and_Click(xpath['add_type_resource'])

        print("Selecting Video as resource")
        utils.Wait_For_Element(xpath['video_btn'])
        utils.Find_and_Click(xpath['video_btn'])
        utils.Wait_For_Element(
            "//span[contains(text(),'Record Video')]//ancestor::button")
        self.assertTrue(utils.Is_Text_in_Page("Add Video"))

        utils.Find_and_Click(
            "//span[contains(text(),'Record Video')]//ancestor::button")
        time.sleep(2)
        utils.Find_and_Click("//button[@title='Device']")
        utils.Find_and_Click("//button[@title='Record']")
        time.sleep(2)
        utils.Find_and_Click("//button[@title='Stop']")
        utils.Find_and_Input("//input[contains(@class,'attach-video__input')]",
                             "videoTest01")
        utils.Find_and_Click(xpath['save_btn'])

        #validate resource and delete
        print("Verifing file was added")
        Document_to_Verify = "//span[contains(text(),'videoTest01')]"
        utils.Wait_For_Element(Document_to_Verify)
        self.assertTrue(utils.Is_Element_Displayed(Document_to_Verify))

        print("Deleting added file ")
        utils.Find_and_Click(
            "//button[@aria-label='open actions menu' and @color='transparent']"
        )
        utils.Find_and_Click("//span[contains(text(),'Delete')]")
        utils.Find_and_Click("//button[contains(text(),'Delete')]")
        time.sleep(2)
        self.assertFalse(utils.Validate_if_Element_exist(Document_to_Verify))

        print("Document was deleted")
    def test_bookshelf02(self):

        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Bookshelf nav")
        utils.Find_and_Click(xpath['bookshelf_btn'])
        self.assertIn("Shared With Me",
                      utils.Get_element_text(xpath['page_title']))

        print("Clicking on My Bookshelf button")
        utils.Find_and_Click(xpath['my_bookshelf_nav'])
        self.assertIn("My Bookshelf",
                      utils.Get_element_text(xpath['page_title']))

        print("Opening the window: Select Resource Type")
        utils.Find_and_Click(xpath['add_resource_btn'])
        utils.Find_and_Click(xpath['add_type_resource'])

        print("Selecting Google Drive as resource")
        utils.Wait_For_Element(xpath['googleDrive_btn'])
        utils.Find_and_Click(xpath['googleDrive_btn'])
        utils.Wait_For_Element("(//button[contains(text(),'My Drive')])[1]")
        self.assertTrue(utils.Is_Text_in_Page("Add from Google Drive"))

        print("Adding File " + self.Resource_To_Add_Name)
        Document_To_Add_Xpath = "//td[contains(text(),'" + self.Resource_To_Add_Name + "')]"
        time.sleep(1)
        utils.Wait_For_Element(Document_To_Add_Xpath)
        utils.Find_and_Click(Document_To_Add_Xpath)
        utils.Wait_For_Element(xpath['google_drive_save_btn'])
        utils.Send_Keys(Keys.PAGE_DOWN)
        utils.Find_and_Click(xpath['google_drive_save_btn'])

        print("Verifing file was added")
        Document_to_Verify = "//span[contains(text(),'" + self.Resource_To_Add_Name + "')]"
        utils.Wait_For_Element(Document_to_Verify)
        self.assertTrue(utils.Is_Element_Displayed(Document_to_Verify))

        print("Deleting added file " + self.Resource_To_Add_Name)
        utils.Find_and_Click(
            "//button[@aria-label='open actions menu' and @color='transparent']"
        )
        utils.Find_and_Click("//span[contains(text(),'Delete')]")
        utils.Find_and_Click("//button[contains(text(),'Delete')]")
        time.sleep(2)
        self.assertFalse(utils.Validate_if_Element_exist(Document_to_Verify))
    def test_bookshelf04(self):

        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Bookshelf nav")
        utils.Find_and_Click(xpath['bookshelf_btn'])
        self.assertIn("Shared With Me",
                      utils.Get_element_text(xpath['page_title']))

        print("Clicking on My Bookshelf button")
        utils.Find_and_Click(xpath['my_bookshelf_nav'])
        self.assertIn("My Bookshelf",
                      utils.Get_element_text(xpath['page_title']))

        print("Opening the window: Select Resource Type")
        utils.Find_and_Click(xpath['add_resource_btn'])
        utils.Find_and_Click(xpath['add_type_resource'])

        print("Selecting Add Link as resource")
        utils.Wait_For_Element(xpath['link_btn'])
        utils.Find_and_Click(xpath['link_btn'])
        utils.Wait_For_Element(
            "(//input[contains(@class,'attach-link__input')])[1]")
        self.assertTrue(utils.Is_Text_in_Page("Add Link"))

        print("Adding link information")
        utils.Find_and_Input(xpath['add_link_input'], self.Link)
        utils.Find_and_Input(xpath['add_link__name_input'], self.LinkName)
        utils.Find_and_Click(xpath["save_btn"])

        #validate resource and delete
        print("Verifing file was added")
        Document_to_Verify = "//span[contains(text(),'" + self.LinkName + "')]"
        utils.Wait_For_Element(Document_to_Verify)
        self.assertTrue(utils.Is_Element_Displayed(Document_to_Verify))

        print("Deleting added file " + self.LinkName)
        utils.Find_and_Click(
            "//button[@aria-label='open actions menu' and @color='transparent']"
        )
        utils.Find_and_Click("//span[contains(text(),'Delete')]")
        utils.Find_and_Click("//button[contains(text(),'Delete')]")
        time.sleep(2)
        self.assertFalse(utils.Validate_if_Element_exist(Document_to_Verify))

        print("Document was deleted")
Exemple #4
0
    def test_Classboard01(self):
        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Classes nav")
        utils.Find_and_Click(xpath['classes_btn'])
        self.assertIn("Classes", utils.Get_element_text(xpath['page_title']))

        print("Clicking on class : " + self.class_to_validate)
        utils.Find_and_Click("//span[contains(text(),'" +
                             self.class_to_validate + "')]/parent::div")
        self.assertTrue(utils.Is_Text_in_Page("Class Board"))

        print("Clicking class summary")
        utils.Find_and_Click("//div[@class='ot-post-summary__post-header']")
        self.assertTrue(
            utils.Is_Element_Displayed("//div[@class='ot-page-header-title']"))
    def test_bookshelf10(self):

        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Bookshelf nav")
        utils.Find_and_Click(xpath['bookshelf_btn'])
        self.assertIn("Shared With Me",
                      utils.Get_element_text(xpath['page_title']))

        print("Clicking on My Bookshelf button")
        utils.Find_and_Click(xpath['my_bookshelf_nav'])
        self.assertIn("My Bookshelf",
                      utils.Get_element_text(xpath['page_title']))

        print("Opening the window: Select Resource Type")
        utils.Find_and_Click(xpath['add_resource_btn'])
        utils.Find_and_Click(xpath['add_type_resource'])

        print("Selecting Page as resource")
        utils.Wait_For_Element(xpath['Page_btn'])
        utils.Find_and_Click(xpath['Page_btn'])
        utils.Wait_For_Element(
            "//input[contains(@class,'attach-page__input')]")
        self.assertTrue(utils.Is_Text_in_Page("Add Page"))

        print("Creating Page")
        utils.Find_and_Input("//input[contains(@class,'attach-page__input')]",
                             "My Test Page")
        utils.Find_and_Click("//span[contains(text(),'Next')]//parent::button")

        print("Writting a new page")
        utils.Wait_For_Element("//iframe[contains(@title,'Rich Text Editor')]")

        utils.Find_and_Click("//a[@title='HTML']")
        utils.Find_and_Input("//div[contains(@id,'_contents')]/textarea",
                             "I'm a Test :D")
        time.sleep(1)
        utils.Find_and_Click("//a[@title='HTML']")
        time.sleep(2)
        utils.Find_and_Click(
            "//span[contains(text(),'Done')]/ancestor::button")

        #validate resource and delete
        print("Verifing file was added")
        Document_to_Verify = "//span[contains(text(),'My Test Page')]"
        utils.Wait_For_Element(Document_to_Verify)
        self.assertTrue(utils.Is_Element_Displayed(Document_to_Verify))

        print("Deleting added file ")
        utils.Find_and_Click(
            "//button[@aria-label='open actions menu' and @color='transparent']"
        )
        utils.Find_and_Click("//span[contains(text(),'Delete')]")
        utils.Find_and_Click("//button[contains(text(),'Delete')]")
        time.sleep(2)
        self.assertFalse(utils.Validate_if_Element_exist(Document_to_Verify))
        print("Document was deleted")
    def test_bookshelf09(self):

        print("Validating if log in was successful")
        # to verify if the search results page loaded
        self.assertIn("Otus", self.driver.title)

        # to verify if the search results page contains any results or no results were found.
        self.assertNotIn("No results found.", self.driver.page_source)

        print("Clicking on Bookshelf nav")
        utils.Find_and_Click(xpath['bookshelf_btn'])
        self.assertIn("Shared With Me",
                      utils.Get_element_text(xpath['page_title']))

        print("Clicking on My Bookshelf button")
        utils.Find_and_Click(xpath['my_bookshelf_nav'])
        self.assertIn("My Bookshelf",
                      utils.Get_element_text(xpath['page_title']))

        print("Opening the window: Select Resource Type")
        utils.Find_and_Click(xpath['add_resource_btn'])
        utils.Find_and_Click(xpath['add_type_resource'])

        print("Selecting OneDrive as resource")
        utils.Wait_For_Element(xpath['oneDrive_btn'])
        utils.Find_and_Click(xpath['oneDrive_btn'])
        utils.Wait_For_Element(
            "//otus-button[contains(@buttontext,'Get OneDrive Resources')]")
        self.assertTrue(utils.Is_Text_in_Page("Add from OneDrive"))

        print("Opening One Drive")
        time.sleep(2)
        utils.Find_and_Click(
            "//otus-button[contains(@buttontext,'Get OneDrive Resources')]/button"
        )
        time.sleep(3)

        print("Switching to oneDrive window")
        utils.switch_to_new_window()

        print("sign in to oneDrive")
        utils.Find_and_Input("//input[@id='i0116']", self.oneDriveUser)
        utils.Find_and_Click("//input[@id='idSIButton9']")
        utils.Find_and_Input("//input[@id='i0118']", self.OneDrivePassword)
        utils.Find_and_Click("//input[@id='idSIButton9']")
        utils.Wait_For_Element(
            "//span[@class='od-ItemPickerHeader-applicationLogo']")

        print("Selecting File")
        utils.hover_element(
            "//img[contains(@src,'" + self.fileName_from_oneDrive +
            "')]//ancestor::div[contains(@class,'ms-List-cell')]//button")
        time.sleep(1)
        utils.hover_and_click(
            "//img[contains(@src,'cv.docx')]//ancestor::div[contains(@class,'ms-List-cell')]//button/following-sibling::span"
        )
        print("saving File")
        utils.Find_and_Click("(//span[@class='od-ButtonBar-main']/button)[1]")
        time.sleep(2)
        utils.switch_to_previous_windwo()
        time.sleep(2)
        utils.Find_and_Click(xpath['save_btn'])

        #validate resource and delete
        print("Verifing file was added")
        Document_to_Verify = "//span[contains(text(),'" + self.fileName_from_oneDrive + "')]"
        utils.Wait_For_Element(Document_to_Verify)
        self.assertTrue(utils.Is_Element_Displayed(Document_to_Verify))

        print("Deleting added file ")
        utils.Find_and_Click(
            "//button[@aria-label='open actions menu' and @color='transparent']"
        )
        utils.Find_and_Click("//span[contains(text(),'Delete')]")
        utils.Find_and_Click("//button[contains(text(),'Delete')]")
        time.sleep(2)
        self.assertFalse(utils.Validate_if_Element_exist(Document_to_Verify))
        print("Document was deleted")