@Test
	public void testAskFile() throws Exception {

		// Create a temporary files, then create a temporary .properties file that contains
		// the path to one of the temporary file.
		String tempDirPath = AbstractGTest.getTestDirectoryPath();
		File tempDir = new File(tempDirPath);
		File tempFile = new File(tempDir, "tempFile.exe");
		File anotherTempFile = new File(tempDir, "MyTempFile.txt");
		File tempPropertiesFile = new File(tempDir, "tempPropertiesFile.properties");

		tempFile.delete();
		anotherTempFile.delete();
		tempPropertiesFile.delete();

		// First, create temporary files
		assertTrue("File '" + tempFile.getAbsolutePath() + "' should have been created!",
			tempFile.createNewFile());

		assertTrue("File '" + anotherTempFile.getAbsolutePath() + "' should have been created!",
			anotherTempFile.createNewFile());

		// Next, create .properties file that contains the path to the first temporary file
		assertTrue("File '" + tempPropertiesFile.getAbsolutePath() + "' should have been created!",
			tempPropertiesFile.createNewFile());

		// Write the path to the file to the .properties file
		FileWriter output = new FileWriter(tempPropertiesFile);
		BufferedWriter writer = new BufferedWriter(output);
		writer.write("Choose a file: Done! = " + tempFile.getAbsolutePath());
		writer.close();

		createScript();
		final File[] myFile = new File[1];

		// Load .properties value(s)
		script.setPropertiesFile(tempPropertiesFile);

		executeOnSwingWithoutBlocking(() -> {
			try {
				myFile[0] = script.askFile("Choose a file:", "Done!");
			}
			catch (Exception e) {
				failWithException("Exception was caught in this test: " + e.getMessage(), e);
			}
		});

		GhidraFileChooser fileChooser = waitForDialogComponent(GhidraFileChooser.class);

		waitForUpdateOnDirectory(fileChooser);

		assertNotNull(fileChooser);
		pressButtonByText(fileChooser, "Done!");

		waitForSwing();

		// Compare default value to expected properties value
		assertEquals(tempFile, myFile[0]);

		// Choose another file and press ok
		executeOnSwingWithoutBlocking(() -> {
			try {
				myFile[0] = script.askFile("Choose a file:", "Done!");
			}
			catch (Exception e) {
				failWithException("Exception was caught in this test: " + e.getMessage(), e);
			}
		});

		fileChooser = waitForDialogComponent(GhidraFileChooser.class);

		fileChooser.setSelectedFile(anotherTempFile);
		waitForUpdateOnDirectory(fileChooser);

		pressButtonByText(fileChooser, "Done!");
		waitForSwing();

		// Verify the chosen file is auto-populated when the dialog comes up again
		executeOnSwingWithoutBlocking(() -> {
			try {
				myFile[0] = script.askFile("Choose a file:", "Done!");
			}
			catch (Exception e) {
				failWithException("Exception was caught in this test: " + e.getMessage(), e);
			}
		});

		fileChooser = waitForDialogComponent(GhidraFileChooser.class);

		fileChooser.setSelectedFile(anotherTempFile);
		waitForUpdateOnDirectory(fileChooser);

		pressButtonByText(fileChooser, "Done!");
		waitForSwing();

		assertEquals(anotherTempFile, myFile[0]);
	}
A large timeout period that is usually not reached
Ghidra/Features/Base/src/test.slow/java/ghidra/app/script/GhidraScriptAskMethodsTest.java