File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import time
2
+ from pathlib import Path
3
+
4
+ from selenium .webdriver .common .by import By
5
+ from selenium .webdriver .remote .webdriver import WebDriver
6
+
7
+
8
+ def test_home_notification (selenium_driver , final_screenshot ):
9
+ selenium : WebDriver = selenium_driver ("start.ipynb" )
10
+ selenium .set_window_size (1000 , 941 )
11
+
12
+ config_dir = Path .home () / ".aiidalab"
13
+ warning_file = config_dir / "home_app_warning.md"
14
+
15
+ # If the file exists, we are testing locally
16
+ # We should make sure not to overwrite or remove the file
17
+ testing_locally = warning_file .exists ()
18
+
19
+ if not testing_locally :
20
+ config_dir .mkdir (exist_ok = True )
21
+ warning_file .write_text ("This is a test warning message." )
22
+ selenium .refresh ()
23
+ time .sleep (2 )
24
+
25
+ notifications = selenium .find_elements (By .CLASS_NAME , "home-notification" )
26
+ assert len (notifications ) == 1
27
+
28
+ home_warning = notifications [0 ]
29
+ content = warning_file .read_text ()
30
+ assert content in home_warning .text
31
+
32
+ if not testing_locally :
33
+ warning_file .unlink ()
You can’t perform that action at this time.
0 commit comments