Skip to content

[java]: fix return type and docstring for getDownloadableFiles #15293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java/src/org/openqa/selenium/remote/RemoteWebDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ public void removeVirtualAuthenticator(VirtualAuthenticator authenticator) {
}

/**
* Retrieves the downloadable files as a map of file names and their corresponding URLs.
* Retrieves the names of the downloadable files.
*
* @return A map containing file names as keys and URLs as values.
* @return A list containing the names of the downloadable files.
* @throws WebDriverException if capability to enable downloads is not set
*/
@Override
Expand Down
17 changes: 17 additions & 0 deletions java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,4 +807,21 @@ void noArgConstructorEmptyCapabilitiesTest() {
RemoteWebDriver driver = new RemoteWebDriver() {}; // anonymous subclass
assertThat(driver.getCapabilities()).isEqualTo(new ImmutableCapabilities());
}

@Test
void getDownloadableFilesReturnsType() {
List<String> expectedFiles = Arrays.asList("file1.txt", "file2.pdf");

WebDriverFixture fixture =
new WebDriverFixture(
new ImmutableCapabilities("se:downloadsEnabled", true),
echoCapabilities,
valueResponder(ImmutableMap.of("names", expectedFiles)));

List<String> result = fixture.driver.getDownloadableFiles();

assertThat(result).isInstanceOf(List.class).isEqualTo(expectedFiles);

fixture.verifyCommands(new CommandPayload(DriverCommand.GET_DOWNLOADABLE_FILES, emptyMap()));
}
}
Loading