Skip to content

Commit

Permalink
test: do not create stray files when running tests (#1718)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Dec 18, 2024
1 parent eb08046 commit c591a14
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ void shouldUploadAFolder(@TempDir Path tmpDir) throws IOException {
}

@Test
void shouldUploadAFolderAndThrowForMultipleDirectories() throws IOException {
void shouldUploadAFolderAndThrowForMultipleDirectories(@TempDir Path tmpDir) throws IOException {
page.navigate(server.PREFIX + "/input/folderupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Path dir = tmpDir.resolve("file-upload-test");
Files.createDirectories(dir.resolve("folder1"));
writeFile(dir.resolve("folder1").resolve("file1.txt"), "file1 content");
Files.createDirectories(dir.resolve("folder2"));
Expand All @@ -485,11 +485,11 @@ void shouldUploadAFolderAndThrowForMultipleDirectories() throws IOException {
}

@Test
void shouldThrowIfADirectoryAndFilesArePassed() throws IOException {
void shouldThrowIfADirectoryAndFilesArePassed(@TempDir Path tmpDir) throws IOException {
// Skipping conditions based on environment not directly translatable to Java; needs custom implementation
page.navigate(server.PREFIX + "/input/folderupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Path dir = tmpDir.resolve("file-upload-test");
Files.createDirectories(dir.resolve("folder1"));
writeFile(dir.resolve("folder1").resolve("file1.txt"), "file1 content");
PlaywrightException e = assertThrows(PlaywrightException.class,
Expand All @@ -498,10 +498,10 @@ void shouldThrowIfADirectoryAndFilesArePassed() throws IOException {
}

@Test
void shouldThrowWhenUploadingAFolderInANormalFileUploadInput() throws IOException {
void shouldThrowWhenUploadingAFolderInANormalFileUploadInput(@TempDir Path tmpDir) throws IOException {
page.navigate(server.PREFIX + "/input/fileupload.html");
Locator input = page.locator("input[name=\"file1\"]");
Path dir = Paths.get("file-upload-test"); // Adjust path as necessary
Path dir = tmpDir.resolve("file-upload-test");
Files.createDirectories(dir);
writeFile(dir.resolve("file1.txt"), "file1 content");
PlaywrightException e = assertThrows(PlaywrightException.class,
Expand Down

0 comments on commit c591a14

Please sign in to comment.