Use Firefox instead of Chrome for selenium tests (#3732)

* Debug gwt failure

* show debug log

* show debug log

* replace chrome with firefox

* remove debugging

* remove unneccessary change
This commit is contained in:
Lauri Tulmin 2021-07-30 20:07:02 +03:00 committed by GitHub
parent cbd8bb29fd
commit 080b8cd25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 29 deletions

View File

@ -91,10 +91,6 @@ tasks {
} }
named<Test>("test") { named<Test>("test") {
// TODO(anuraaga): Reenable after fixing
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3724
enabled = gradle.startParameter.taskNames.any { it.contains(":gwt-2.0") }
dependsOn(sourceSets["testapp"].output) dependsOn(sourceSets["testapp"].output)
dependsOn(copyTestWebapp) dependsOn(copyTestWebapp)

View File

@ -12,7 +12,7 @@ import java.util.concurrent.TimeUnit
import org.eclipse.jetty.server.Server import org.eclipse.jetty.server.Server
import org.eclipse.jetty.util.resource.Resource import org.eclipse.jetty.util.resource.Resource
import org.eclipse.jetty.webapp.WebAppContext import org.eclipse.jetty.webapp.WebAppContext
import org.openqa.selenium.chrome.ChromeOptions import org.openqa.selenium.firefox.FirefoxOptions
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.testcontainers.Testcontainers import org.testcontainers.Testcontainers
@ -24,7 +24,7 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
private static final Logger logger = LoggerFactory.getLogger(GwtTest) private static final Logger logger = LoggerFactory.getLogger(GwtTest)
@Shared @Shared
BrowserWebDriverContainer<?> chrome BrowserWebDriverContainer<?> browser
@Override @Override
Server startServer(int port) { Server startServer(int port) {
@ -52,16 +52,16 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
def setupSpec() { def setupSpec() {
Testcontainers.exposeHostPorts(port) Testcontainers.exposeHostPorts(port)
chrome = new BrowserWebDriverContainer<>() browser = new BrowserWebDriverContainer<>()
.withCapabilities(new ChromeOptions()) .withCapabilities(new FirefoxOptions())
.withLogConsumer(new Slf4jLogConsumer(logger)) .withLogConsumer(new Slf4jLogConsumer(logger))
chrome.start() browser.start()
address = new URI("http://host.testcontainers.internal:$port" + getContextPath() + "/") address = new URI("http://host.testcontainers.internal:$port" + getContextPath() + "/")
} }
def cleanupSpec() { def cleanupSpec() {
chrome?.stop() browser?.stop()
} }
@Override @Override
@ -70,7 +70,7 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
} }
def getDriver() { def getDriver() {
def driver = chrome.getWebDriver() def driver = browser.getWebDriver()
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS) driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS)
return driver return driver
} }
@ -94,14 +94,14 @@ class GwtTest extends AgentInstrumentationSpecification implements HttpServerTes
trace(1, 1) { trace(1, 1) {
serverSpan(it, 0, getContextPath() + "/*") serverSpan(it, 0, getContextPath() + "/*")
} }
// /xyz/greeting/1B105441581A8F41E49D5DF3FB5B55BA.cache.html
trace(2, 1) {
serverSpan(it, 0, getContextPath() + "/*")
}
// /favicon.ico // /favicon.ico
trace(3, 1) { trace(2, 1) {
serverSpan(it, 0, "HTTP GET") serverSpan(it, 0, "HTTP GET")
} }
// /xyz/greeting/1B105441581A8F41E49D5DF3FB5B55BA.cache.html
trace(3, 1) {
serverSpan(it, 0, getContextPath() + "/*")
}
} }
clearExportedData() clearExportedData()

View File

@ -41,12 +41,6 @@ tasks {
val vaadin16Test by existing val vaadin16Test by existing
val vaadin14LatestTest by existing val vaadin14LatestTest by existing
withType<Test>().configureEach {
// TODO(anuraaga): Reenable after fixing
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3724
enabled = gradle.startParameter.taskNames.any { it.contains(":vaadin-14.2") }
}
named<Test>("test") { named<Test>("test") {
dependsOn(vaadin142Test) dependsOn(vaadin142Test)
dependsOn(vaadin16Test) dependsOn(vaadin16Test)

View File

@ -12,7 +12,7 @@ import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
import io.opentelemetry.instrumentation.test.asserts.TraceAssert import io.opentelemetry.instrumentation.test.asserts.TraceAssert
import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait import io.opentelemetry.instrumentation.test.base.HttpServerTestTrait
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import org.openqa.selenium.chrome.ChromeOptions import org.openqa.selenium.firefox.FirefoxOptions
import org.slf4j.Logger import org.slf4j.Logger
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import org.springframework.boot.SpringApplication import org.springframework.boot.SpringApplication
@ -27,7 +27,7 @@ abstract class AbstractVaadinTest extends AgentInstrumentationSpecification impl
private static final Logger logger = LoggerFactory.getLogger(AbstractVaadinTest) private static final Logger logger = LoggerFactory.getLogger(AbstractVaadinTest)
@Shared @Shared
BrowserWebDriverContainer<?> chrome BrowserWebDriverContainer<?> browser
@SpringBootApplication @SpringBootApplication
@EnableVaadin("test.vaadin") @EnableVaadin("test.vaadin")
@ -46,16 +46,16 @@ abstract class AbstractVaadinTest extends AgentInstrumentationSpecification impl
def setupSpec() { def setupSpec() {
Testcontainers.exposeHostPorts(port) Testcontainers.exposeHostPorts(port)
chrome = new BrowserWebDriverContainer<>() browser = new BrowserWebDriverContainer<>()
.withCapabilities(new ChromeOptions()) .withCapabilities(new FirefoxOptions())
.withLogConsumer(new Slf4jLogConsumer(logger)) .withLogConsumer(new Slf4jLogConsumer(logger))
chrome.start() browser.start()
address = new URI("http://host.testcontainers.internal:$port" + getContextPath() + "/") address = new URI("http://host.testcontainers.internal:$port" + getContextPath() + "/")
} }
def cleanupSpec() { def cleanupSpec() {
chrome?.stop() browser?.stop()
} }
@Override @Override
@ -91,7 +91,7 @@ abstract class AbstractVaadinTest extends AgentInstrumentationSpecification impl
} }
def getWebDriver() { def getWebDriver() {
return chrome.getWebDriver() return browser.getWebDriver()
} }
abstract List<String> getRequestHandlers() abstract List<String> getRequestHandlers()