Skip to content

Commit a2972e9

Browse files
committed
Add some ui tests for StreamingPage
1 parent fd03ad0 commit a2972e9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
322322
val numActiveBatches = batchTimes.length - numCompletedBatches
323323
val table =
324324
// scalastyle:off
325-
<table class="table table-bordered" style="width: auto">
325+
<table id="stat-table" class="table table-bordered" style="width: auto">
326326
<thead>
327327
<tr>
328328
<th style="width: 160px;"></th>

streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@ class UISeleniumSuite
9797
val h3Text = findAll(cssSelector("h3")).map(_.text).toSeq
9898
h3Text should contain("Streaming Statistics")
9999

100+
// Check stat table
101+
val statTableHeaders = findAll(cssSelector("#stat-table th")).map(_.text).toSeq
102+
statTableHeaders.exists(
103+
_.matches("Timelines \\(Last \\d+ batches, \\d+ active, \\d+ completed\\)")) should be
104+
(true)
105+
statTableHeaders should contain ("Histograms")
106+
107+
val statTableCells = findAll(cssSelector("#stat-table td")).map(_.text).toSeq
108+
println(statTableCells.toList)
109+
statTableCells.exists(_.contains("Input Rate")) should be (true)
110+
statTableCells.exists(_.contains("Streaming Scheduling Delay")) should be (true)
111+
statTableCells.exists(_.contains("Processing Time")) should be (true)
112+
statTableCells.exists(_.contains("Total Delay")) should be (true)
113+
114+
// Check batch tables
100115
val h4Text = findAll(cssSelector("h4")).map(_.text).toSeq
101116
h4Text.exists(_.matches("Active Batches \\(\\d+\\)")) should be (true)
102117
h4Text.exists(_.matches("Completed Batches \\(last \\d+ out of \\d+\\)")) should be (true)

0 commit comments

Comments
 (0)