rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests - new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts - drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette - recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-* - _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes) - NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py - 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
80
src/functional_tests/test_applet_new_post_line_validation.py
Normal file
80
src/functional_tests/test_applet_new_post_line_validation.py
Normal file
@@ -0,0 +1,80 @@
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from .base import FunctionalTest
|
||||
from .post_page import PostPage
|
||||
|
||||
|
||||
class LineValidationTest(FunctionalTest):
|
||||
# Helper functions
|
||||
def get_error_element(self):
|
||||
return self.browser.find_element(By.CSS_SELECTOR, ".invalid-feedback")
|
||||
|
||||
# Test methods
|
||||
def test_cannot_add_empty_post_lines(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.browser.get(self.live_server_url + '/billboard/')
|
||||
post_page = PostPage(self)
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_text:invalid")
|
||||
)
|
||||
|
||||
post_page.get_line_input_box().send_keys("Purchase milk")
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_text:valid")
|
||||
)
|
||||
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
post_page.wait_for_row_in_post_table("Purchase milk", 1)
|
||||
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
|
||||
post_page.wait_for_row_in_post_table("Purchase milk", 1)
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(By.CSS_SELECTOR, "#id_text:invalid")
|
||||
)
|
||||
|
||||
post_page.get_line_input_box().send_keys("Make tea")
|
||||
self.wait_for(
|
||||
lambda: self.browser.find_element(
|
||||
By.CSS_SELECTOR,
|
||||
"#id_text:valid",
|
||||
)
|
||||
)
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
post_page.wait_for_row_in_post_table("Make tea", 2)
|
||||
|
||||
def test_cannot_add_duplicate_lines(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.browser.get(self.live_server_url + '/billboard/')
|
||||
post_page = PostPage(self)
|
||||
post_page.add_post_line("Witness divinity")
|
||||
|
||||
post_page.get_line_input_box().send_keys("Witness divinity")
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.assertEqual(
|
||||
self.get_error_element().text,
|
||||
"You've already logged this to your post",
|
||||
)
|
||||
)
|
||||
|
||||
def test_error_messages_are_cleared_on_input(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.browser.get(self.live_server_url + '/billboard/')
|
||||
post_page = PostPage(self)
|
||||
post_page.add_post_line("Gobbledygook")
|
||||
post_page.get_line_input_box().send_keys("Gobbledygook")
|
||||
post_page.get_line_input_box().send_keys(Keys.ENTER)
|
||||
self.wait_for(
|
||||
lambda: self.assertTrue(self.get_error_element().is_displayed())
|
||||
)
|
||||
|
||||
post_page.get_line_input_box().send_keys("a")
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.assertFalse(self.get_error_element().is_displayed())
|
||||
)
|
||||
Reference in New Issue
Block a user