26
26
import org .openqa .selenium .OutputType ;
27
27
import org .openqa .selenium .chrome .ChromeOptions ;
28
28
import org .slf4j .bridge .SLF4JBridgeHandler ;
29
- import org .testcontainers .containers .BrowserWebDriverContainer ;
30
29
import org .testcontainers .utility .MountableFile ;
31
30
32
31
import software .xdev .chartjs .model .charts .Chart ;
33
- import software .xdev .chartjs .model .container .SimpleBrowserWebDriverContainer ;
32
+ import software .xdev .chartjs .model .container .SeleniumBrowserWebDriverContainer ;
33
+ import software .xdev .testcontainers .selenium .containers .browser .BrowserWebDriverContainer ;
34
34
35
35
36
36
public abstract class AbstractChartTest
@@ -43,36 +43,34 @@ public abstract class AbstractChartTest
43
43
protected static final String CONTAINER_TEST_TEMPLATE_HTML_FILE = "/home/user/" + TEST_TEMPLATE_HTML_FILE ;
44
44
45
45
// One Container is started once and only the rendered HTML is changed. Improves performance.
46
- protected static final SimpleBrowserWebDriverContainer WEB_CONTAINER = createBrowserWithTempDirectoryMounted ();
46
+ protected static final SeleniumBrowserWebDriverContainer WEB_CONTAINER = createBrowserWithTempDirectoryMounted ();
47
47
48
- private static SimpleBrowserWebDriverContainer createBrowserWithTempDirectoryMounted ()
48
+ private static SeleniumBrowserWebDriverContainer createBrowserWithTempDirectoryMounted ()
49
49
{
50
50
if (!SLF4JBridgeHandler .isInstalled ())
51
51
{
52
52
SLF4JBridgeHandler .removeHandlersForRootLogger ();
53
53
SLF4JBridgeHandler .install ();
54
54
}
55
55
56
- final SimpleBrowserWebDriverContainer browserContainer = new SimpleBrowserWebDriverContainer ()
57
- .withRecordingMode (
58
- BrowserWebDriverContainer .VncRecordingMode .SKIP ,
59
- null )
60
- .withCapabilities (new ChromeOptions ())
61
- .withCopyFileToContainer (
62
- MountableFile .forClasspathResource ("/" + TEST_TEMPLATE_HTML_FILE ),
63
- CONTAINER_TEST_TEMPLATE_HTML_FILE );
56
+ final SeleniumBrowserWebDriverContainer browserContainer =
57
+ new SeleniumBrowserWebDriverContainer (new ChromeOptions ())
58
+ .withRecordingMode (BrowserWebDriverContainer .RecordingMode .SKIP )
59
+ .withCopyFileToContainer (
60
+ MountableFile .forClasspathResource ("/" + TEST_TEMPLATE_HTML_FILE ),
61
+ CONTAINER_TEST_TEMPLATE_HTML_FILE );
64
62
browserContainer .start ();
65
63
return browserContainer ;
66
64
}
67
65
68
- protected SimpleBrowserWebDriverContainer getWebContainer ()
66
+ protected SeleniumBrowserWebDriverContainer getWebContainer ()
69
67
{
70
68
return WEB_CONTAINER ;
71
69
}
72
70
73
71
protected void createScreenshotAndCompare (
74
72
final Chart <?, ?, ?> chart ,
75
- final SimpleBrowserWebDriverContainer browserContainer ,
73
+ final SeleniumBrowserWebDriverContainer browserContainer ,
76
74
final String screenshotReference )
77
75
{
78
76
try
@@ -93,7 +91,7 @@ protected void createScreenshotAndCompare(
93
91
}
94
92
95
93
protected void assertCurrentBrowserViewEqualsScreenshot (
96
- final SimpleBrowserWebDriverContainer browserContainer ,
94
+ final SeleniumBrowserWebDriverContainer browserContainer ,
97
95
final String screenshotReference ) throws IOException
98
96
{
99
97
final byte [] actual = browserContainer .webDriver ().getScreenshotAs (OutputType .BYTES );
0 commit comments