@@ -24,63 +24,6 @@ def _wait_for_exact_text(self, by, locator, exact, timeout=2):
2424 lambda driver : driver .find_element (by , locator ).text == str (exact )
2525 )
2626
27- def test_sampleapp_display (self ):
28- heading = self .find_element (By .ID , "heading" )
29- titleInput = self .find_element (By .ID , "msgTitle" )
30- messageInput = self .find_element (By .ID , "msgTextArea" )
31- addMessageButton = self .find_element (By .ID , "sendBtn" )
32-
33- self .assertTrue (heading .is_displayed (), "Heading should be visible" )
34- self .assertTrue (titleInput .is_displayed (), "Title input should be visible" )
35- self .assertTrue (messageInput .is_displayed (), "Message input should be visible" )
36- self .assertTrue (
37- addMessageButton .is_displayed (), "Send button should be visible"
38- )
39-
40- def test_send_empty_title_and_message (self ):
41- addMessageButton = self .find_element (By .ID , "sendBtn" )
42- self .assertIsNotNone (addMessageButton , "Send button should be present" )
43- addMessageButton .click ()
44-
45- alert = self .web_driver .switch_to .alert
46- self .assertEqual (alert .text , "Please enter both title and message." )
47- alert .accept ()
48-
49- def test_create_message (self ):
50- self ._wait_for_exact_text (By .ID , "messageCount" , 0 )
51- titleInput = self .find_element (By .ID , "msgTitle" )
52- self .assertIsNotNone (titleInput , "Title input should be present" )
53- messageInput = self .find_element (By .ID , "msgTextArea" )
54- self .assertIsNotNone (messageInput , "Message input should be present" )
55- addMessageButton = self .find_element (By .ID , "sendBtn" )
56- self .assertIsNotNone (addMessageButton , "Send button should be present" )
57- titleInput .send_keys ("Test Title" )
58- messageInput .send_keys ("Test Message" )
59- addMessageButton .click ()
60-
61- self ._wait_for_exact_text (By .ID , "messageCount" , 1 )
62- messageCount = self .find_element (By .ID , "messageCount" )
63- self .assertIsNotNone (messageCount , "Message count should be present" )
64- self .assertEqual (messageCount .text , "1" )
65-
66- def test_delete_message (self ):
67- self ._create_message ()
68- self .web_driver .refresh ()
69-
70- self ._wait_for_exact_text (By .ID , "messageCount" , 1 )
71- messageCount = self .find_element (By .ID , "messageCount" )
72- self .assertIsNotNone (messageCount , "Message count should be present" )
73- self .assertEqual (messageCount .text , "1" )
74-
75- deleteButton = self .find_element (By .ID , "deleteBtn" )
76- self .assertIsNotNone (deleteButton , "Delete button should be present" )
77- deleteButton .click ()
78-
79- self ._wait_for_exact_text (By .ID , "messageCount" , 0 )
80- messageCount = self .find_element (By .ID , "messageCount" )
81- self .assertIsNotNone (messageCount , "Message count should be present" )
82- self .assertEqual (messageCount .text , "0" )
83-
8427 def test_real_time_create_message (self ):
8528 self .web_driver .switch_to .new_window ("tab" )
8629 tabs = self .web_driver .window_handles
0 commit comments