Skip to content

Commit

Permalink
Remove 'test_the_editor_forgets_its_content_on_form_submission()'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D committed Sep 18, 2024
1 parent e66e741 commit 45be765
Showing 1 changed file with 4 additions and 33 deletions.
37 changes: 4 additions & 33 deletions zds/tutorialv2/tests/tests_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_collaborative_article_edition_and_editor_persistence(self):
intro = self.find_element("div#div_id_introduction div.CodeMirror")
# ActionChains: Support for CodeMirror https://stackoverflow.com/a/48969245/2226755
action_chains = ActionChains(selenium)
scrollDriverTo(selenium, 0, 312)
scroll_driver_to(selenium, 0, 312)
action_chains.click(intro).perform()
action_chains.send_keys("intro").perform()

Expand All @@ -144,36 +144,7 @@ def test_collaborative_article_edition_and_editor_persistence(self):

self.assertEqual("new intro", self.find_element(".md-editor#id_introduction").get_attribute("value"))

def test_the_editor_forgets_its_content_on_form_submission(self):
selenium = self.selenium

author = ProfileFactory()

self.login(author)
selenium.execute_script('localStorage.setItem("editor_choice", "new")') # we want the new editor
new_article_url = self.live_server_url + reverse(
"content:create-content", kwargs={"created_content_type": "ARTICLE"}
)
selenium.get(new_article_url)
WebDriverWait(self.selenium, 10).until(ec.element_to_be_clickable((By.CSS_SELECTOR, "#id_title"))).click()

self.find_element("#id_title").send_keys("Oulipo")

intro = self.find_element("div#div_id_introduction div.CodeMirror")
action_chains = ActionChains(selenium)
scrollDriverTo(selenium, 0, 312)
action_chains.click(intro).perform()
action_chains.send_keys("Le cadavre exquis boira le vin nouveau.").perform()

self.find_element(".content-container button[type=submit]").click()

self.assertTrue(WebDriverWait(selenium, 10).until(ec.title_contains("Oulipo")))

selenium.get(new_article_url)

self.assertEqual("", self.find_element(".md-editor#id_introduction").get_attribute("value"))


def scrollDriverTo(driver, x, y):
scriptScrollTo = f"window.scrollTo({x}, {y});"
driver.execute_script(scriptScrollTo)
def scroll_driver_to(driver, x, y):
script_scroll_to = f"window.scrollTo({x}, {y});"
driver.execute_script(script_scroll_to)

0 comments on commit 45be765

Please sign in to comment.