|
1 | 1 | import path from "path"; |
2 | 2 | import { Browser, Builder } from "selenium-webdriver"; |
3 | | -import { GenericContainer, StartedTestContainer } from "testcontainers"; |
| 3 | +import { GenericContainer } from "testcontainers"; |
4 | 4 | import tmp from "tmp"; |
5 | 5 | import { SeleniumContainer, SELENIUM_VIDEO_IMAGE } from "./selenium-container"; |
6 | 6 |
|
7 | 7 | describe("SeleniumContainer", { timeout: 180_000 }, () => { |
8 | | - let ffmpegContainer: StartedTestContainer; |
9 | | - |
10 | | - beforeAll(async () => { |
11 | | - ffmpegContainer = await new GenericContainer(SELENIUM_VIDEO_IMAGE).withCommand(["sleep", "infinity"]).start(); |
12 | | - }); |
13 | | - |
14 | | - afterAll(async () => { |
15 | | - await ffmpegContainer.stop(); |
16 | | - }); |
17 | | - |
18 | 8 | const browsers = [ |
19 | 9 | ["CHROME", process.arch === "arm64" ? `seleniarm/standalone-chromium:112.0` : `selenium/standalone-chrome:112.0`], |
20 | 10 | ["FIREFOX", process.arch === "arm64" ? `seleniarm/standalone-firefox:112.0` : `selenium/standalone-firefox:112.0`], |
@@ -43,9 +33,13 @@ describe("SeleniumContainer", { timeout: 180_000 }, () => { |
43 | 33 | const videoFileName = path.basename(videoFilePath); |
44 | 34 | await stoppedContainer.saveRecording(videoFilePath); |
45 | 35 |
|
| 36 | + const ffmpegContainer = await new GenericContainer(SELENIUM_VIDEO_IMAGE) |
| 37 | + .withCommand(["sleep", "infinity"]) |
| 38 | + .start(); |
46 | 39 | await ffmpegContainer.copyFilesToContainer([{ source: videoFilePath, target: `/tmp/${videoFileName}` }]); |
47 | 40 | const { exitCode } = await ffmpegContainer.exec(["ffprobe", `/tmp/${videoFileName}`]); |
48 | 41 | expect(exitCode).toBe(0); |
| 42 | + await ffmpegContainer.stop(); |
49 | 43 | }); |
50 | 44 | }); |
51 | 45 | }); |
0 commit comments