Skip to content

Instantly share code, notes, and snippets.

@slawekradzyminski
Created June 4, 2016 06:56
Show Gist options
  • Save slawekradzyminski/e9353b5b4af7fc9b6dbde2036475ffe9 to your computer and use it in GitHub Desktop.
Save slawekradzyminski/e9353b5b4af7fc9b6dbde2036475ffe9 to your computer and use it in GitHub Desktop.
public class FileDownloadTest extends FluentTestNg {
private static final String FILE_TO_DL_SELECTOR = "ul li a";
private static final String URL = "http://www.developsense.com";
@Test
public void statusCode200() throws IOException, URISyntaxException {
Request request = prepareRequest();
assertThat(request.getHTTPStatusCodeFromResponse()).isEqualTo(SC_OK);
}
private Request prepareRequest() throws MalformedURLException, URISyntaxException {
String fileUrl = getUrlFromSite();
Request request = new Request(getDriver());
request.setURIToCheck(fileUrl);
return request;
}
private String getUrlFromSite() {
goTo(URL);
await().until(FILE_TO_DL_SELECTOR).isEnabled();
return findFirst(FILE_TO_DL_SELECTOR).getAttribute("href");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment