def test_change_text_on_doc(self): page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') page_new_doc = GrammarlyNewDocument(self.driver) page_new_doc.make_new_document("") page_doc = GrammarlyDocument(self.driver) self.assert_text(page_doc)
def tests_all_in_one(self): from selenium import webdriver self.driver = webdriver.Firefox() filename = "demo_document.txt" demo_data_text = None with open(filename, 'r+') as f: demo_data_text = f.read().decode("utf-8") page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') page_new_doc = GrammarlyNewDocument(self.driver) page_new_doc.make_new_document("") page_doc = GrammarlyDocument(self.driver) page_doc.put_title("DEMO DATA TEXT") page_doc.put_text(demo_data_text) page_source = GrammarlyDocument(self.driver) actual_source = page_source.get_page_source() scraper = DocumentScraper(actual_source) found_issues = scraper.find_all_issues() assert len(found_issues) == 14 issues_by_type = scraper.return_issues_by_type() assert len(issues_by_type) == 2 assert u'_ed4374-plainTextTitle' in issues_by_type assert u'_ed4374-titleReplacement' in issues_by_type assert len(issues_by_type['_ed4374-plainTextTitle']) == 3 assert len(issues_by_type['_ed4374-titleReplacement']) == 11 self.driver.maximize_window() # making a screenshot!: self.driver.save_screenshot('grammarly_checks.png') self.driver.get_screenshot_as_file('grammarly_checks2.png')
def test_simple_text_gather_html(self): """ This test is suppose to return html """ page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') page_new_doc = GrammarlyNewDocument(self.driver) page_new_doc.make_new_document("") page_doc = GrammarlyDocument(self.driver) text_to_put = "A simple \n\ Multiline \n\ text \n\ That wraps \n\ after max \n\ 2 words. \n\ " page_doc.text = text_to_put time.sleep(10)
def test_get_page_source(self): page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') page_new_doc = GrammarlyNewDocument(self.driver) page_new_doc.make_new_document("") page_doc = GrammarlyDocument(self.driver) text_to_put = "A simple \n\ Multiline \n\ text \n\ That wraps \n\ after max \n\ 2 words. \n\ " page_doc.put_text(text_to_put) page_source = GrammarlyDocument(self.driver) actual_source = page_source.get_page_source() self.assertTrue("<html" in actual_source and "</html" in actual_source)
def test_make_new_doc(self): page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') page_new_doc = GrammarlyNewDocument(self.driver) page_new_doc.make_new_document("TEST") assert "https://app.grammarly.com/docs/" in self.driver.current_url
def test_login(self): page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') assert self.driver.current_url == "https://app.grammarly.com/"
def test_grammarly_in_title(self): page_login = GrammarlyLogin(self.driver) self.driver.get(page_login.uri) assert "Grammarly" in self.driver.title
def test_login(self): page_login = GrammarlyLogin(self.driver) page_login.make_login('*****@*****.**', 'test123') assert self.driver.current_url == "https://louiscklaw.github.io/html-example-page/signin_ok.html"