Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import scala.collection.JavaConversions._
import scala.xml.Node

import com.gargoylesoftware.htmlunit.DefaultCssErrorHandler
import org.json4s._
import org.json4s.jackson.JsonMethods
import org.openqa.selenium.htmlunit.HtmlUnitDriver
Expand All @@ -31,6 +32,7 @@ import org.scalatest._
import org.scalatest.concurrent.Eventually._
import org.scalatest.selenium.WebBrowser
import org.scalatest.time.SpanSugar._
import org.w3c.css.sac.CSSParseException

import org.apache.spark.LocalSparkContext._
import org.apache.spark._
Expand All @@ -39,6 +41,31 @@ import org.apache.spark.deploy.history.HistoryServerSuite
import org.apache.spark.shuffle.FetchFailedException
import org.apache.spark.status.api.v1.{JacksonMessageWriter, StageStatus}

private[spark] class SparkUICssErrorHandler extends DefaultCssErrorHandler {

private val cssWhiteList = List("bootstrap.min.css", "vis.min.css")

private def isInWhileList(uri: String): Boolean = cssWhiteList.exists(uri.endsWith)

override def warning(e: CSSParseException): Unit = {
if (!isInWhileList(e.getURI)) {
super.warning(e)
}
}

override def fatalError(e: CSSParseException): Unit = {
if (!isInWhileList(e.getURI)) {
super.fatalError(e)
}
}

override def error(e: CSSParseException): Unit = {
if (!isInWhileList(e.getURI)) {
super.error(e)
}
}
}

/**
* Selenium tests for the Spark Web UI.
*/
Expand All @@ -49,7 +76,9 @@ class UISeleniumSuite extends SparkFunSuite with WebBrowser with Matchers with B


override def beforeAll(): Unit = {
webDriver = new HtmlUnitDriver
webDriver = new HtmlUnitDriver {
getWebClient.setCssErrorHandler(new SparkUICssErrorHandler)
}
}

override def afterAll(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import scala.util.Random
import org.apache.hadoop.hive.conf.HiveConf.ConfVars
import org.openqa.selenium.WebDriver
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.scalatest.{BeforeAndAfterAll, Matchers}
import org.scalatest.concurrent.Eventually._
import org.scalatest.selenium.WebBrowser
import org.scalatest.time.SpanSugar._
import org.scalatest.{BeforeAndAfterAll, Matchers}

import org.apache.spark.sql.hive.HiveContext
import org.apache.spark.ui.SparkUICssErrorHandler

class UISeleniumSuite
extends HiveThriftJdbcTest
Expand All @@ -40,7 +41,9 @@ class UISeleniumSuite
override def mode: ServerMode.Value = ServerMode.binary

override def beforeAll(): Unit = {
webDriver = new HtmlUnitDriver
webDriver = new HtmlUnitDriver {
getWebClient.setCssErrorHandler(new SparkUICssErrorHandler)
}
super.beforeAll()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

.tooltip-inner {
max-width: 500px !important; // Make sure we only have one line tooltip
max-width: 500px !important; /* Make sure we only have one line tooltip */
}

.line {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ import org.scalatest.selenium.WebBrowser
import org.scalatest.time.SpanSugar._

import org.apache.spark._
import org.apache.spark.ui.SparkUICssErrorHandler

/**
* Selenium tests for the Spark Web UI.
* Selenium tests for the Spark Streaming Web UI.
*/
class UISeleniumSuite
extends SparkFunSuite with WebBrowser with Matchers with BeforeAndAfterAll with TestSuiteBase {

implicit var webDriver: WebDriver = _

override def beforeAll(): Unit = {
webDriver = new HtmlUnitDriver
webDriver = new HtmlUnitDriver {
getWebClient.setCssErrorHandler(new SparkUICssErrorHandler)
}
}

override def afterAll(): Unit = {
Expand Down