forked from fediversity/fediversity
		
	Clean up Mastodon and Peertube tests
This commit is contained in:
		
							parent
							
								
									9d27f2d98e
								
							
						
					
					
						commit
						e43296dce0
					
				
					 2 changed files with 18 additions and 27 deletions
				
			
		|  | @ -8,9 +8,6 @@ | |||
| let | ||||
|   lib = pkgs.lib; | ||||
| 
 | ||||
|   ## FIXME: this binding was not used, but maybe we want a side-effect or something? | ||||
|   # rebuildableTest = import ./rebuildableTest.nix pkgs; | ||||
| 
 | ||||
|   testImage = pkgs.copyPathToStore ./green.png; | ||||
|   testImageColour = "#00FF00"; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,6 @@ | |||
| ## This file is a basic test of Peertube functionalities. | ||||
| ## | ||||
| ## NOTE: This test needs Peertube >= 6.3. | ||||
| 
 | ||||
| { pkgs, self }: | ||||
| 
 | ||||
|  | @ -12,7 +14,11 @@ let | |||
|     pkgs.writers.writePython3Bin "post-video-in-browser" | ||||
|       { | ||||
|         libraries = with pkgs.python3Packages; [ selenium ]; | ||||
|         flakeIgnore = [ "E501" ]; # welcome to the 21st century | ||||
|         flakeIgnore = [ | ||||
|           "E302" | ||||
|           "E305" | ||||
|           "E501" # welcome to the 21st century | ||||
|         ]; | ||||
|       } | ||||
|       '' | ||||
|         import sys | ||||
|  | @ -24,31 +30,18 @@ let | |||
|         from selenium.webdriver.support.ui import WebDriverWait | ||||
|         from selenium.common.exceptions import NoSuchElementException | ||||
| 
 | ||||
|         print("Create and configure driver...", file=sys.stderr) | ||||
|         options = Options() | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("A", file=sys.stderr) | ||||
|         options.add_argument("--headless") | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("B", file=sys.stderr) | ||||
|         service = webdriver.FirefoxService(executable_path="${lib.getExe pkgs.geckodriver}") | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("C", file=sys.stderr) | ||||
|         driver = webdriver.Firefox(options=options, service=service) | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("D", file=sys.stderr) | ||||
|         driver.set_window_size(4096, 2160) | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("E", file=sys.stderr) | ||||
|         driver.implicitly_wait(360) | ||||
|         print("########################################", file=sys.stderr) | ||||
|         print("F", file=sys.stderr) | ||||
|         wait = WebDriverWait(driver, timeout=360, poll_frequency=10) | ||||
|         print("########################################", file=sys.stderr) | ||||
| 
 | ||||
|         ############################################################ | ||||
|         # Login | ||||
| 
 | ||||
| 
 | ||||
|         def load(driver, page): | ||||
|             print(f"Loading page {page}...", file=sys.stderr) | ||||
|             driver.get(page) | ||||
|  | @ -84,7 +77,6 @@ let | |||
| 
 | ||||
|             print(f"Done loading page {page}.", file=sys.stderr) | ||||
| 
 | ||||
| 
 | ||||
|         ############################################################ | ||||
|         # Upload video and take a screenshot | ||||
| 
 | ||||
|  | @ -115,9 +107,9 @@ let | |||
|         # driver.find_element(By.XPATH, "//*[contains(text(), 'Failed to play video')]") | ||||
|         # | ||||
|         # def detect_image_in_screen(d): | ||||
|         #     print("Taking a screenshot...", file=sys.stderr) | ||||
|         #     print("  Taking a screenshot...", file=sys.stderr) | ||||
|         #     d.save_screenshot("/screenshot.png") | ||||
|         #     print("Checking it...", file=sys.stderr) | ||||
|         #     print("  Checking it...", file=sys.stderr) | ||||
|         #     displayed_colours = subprocess.run( | ||||
|         #         [ | ||||
|         #             "magick", | ||||
|  | @ -132,7 +124,10 @@ let | |||
|         #         text=True, | ||||
|         #         check=True, | ||||
|         #     ).stdout | ||||
|         #     return bool(re.match(".*#${testVideoColour}.*", displayed_colours, re.S)) | ||||
|         #     result = bool(re.search("${testVideoColour}", displayed_colours, re.IGNORECASE)) | ||||
|         #     if not result: | ||||
|         #         print("  Could not find the video in the screenshot.", file=sys.stderr) | ||||
|         #     return result | ||||
|         # | ||||
|         # print("Wait until the image shows in screen...", file=sys.stderr) | ||||
|         # wait.until(detect_image_in_screen) | ||||
|  | @ -187,15 +182,15 @@ pkgs.nixosTest { | |||
|           expect | ||||
|         ]; | ||||
| 
 | ||||
|         ## FIXME: The CI is very slow, so the default timeout of 120s is not | ||||
|         ## good enough. We bump it drastically. | ||||
|         systemd.services.postgresql.serviceConfig.TimeoutSec = lib.mkForce 3600; | ||||
| 
 | ||||
|         environment.variables = { | ||||
|           AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.peertube.id; | ||||
|           AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.peertube.secret; | ||||
|           PT_INITIAL_ROOT_PASSWORD = "testtest"; | ||||
|         }; | ||||
| 
 | ||||
|         ## FIXME: The CI is very slow, so the default timeout of 120s is not | ||||
|         ## good enough. We bump it drastically. | ||||
|         systemd.services.postgresql.serviceConfig.TimeoutSec = lib.mkForce 3600; | ||||
|       }; | ||||
|   }; | ||||
| 
 | ||||
|  | @ -206,7 +201,6 @@ pkgs.nixosTest { | |||
| 
 | ||||
|       # FIXME: I think this trick to look for a password can be replaced by | ||||
|       # services.peertube.serviceEnvironmentFile.PT_INITIAL_ROOT_PASSWORD=testtest | ||||
| 
 | ||||
|       with subtest("Peertube starts"): | ||||
|         server.wait_for_unit("peertube.service") | ||||
|         root_password = server.succeed("acquire-root-password").rstrip() | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue