" + queries[i].queryText +
+ "
" + queries[i].queryText.replaceAll("\"", "") +
"
" +
"
" + queries[i].queryDateTime +
"
" +
@@ -59,7 +59,7 @@ function updateQueryHistory(action,queryId) {
}
}
- refHistoryConatiner.html(queryListHTML);
+ refHistoryContainer.html(queryListHTML);
//$('.queryHistoryScroll-pane').jScrollPane();/*Custome scroll*/
// Set eventsAdded = false as list is refreshed and slide events
@@ -73,7 +73,7 @@ function updateQueryHistory(action,queryId) {
// This function displays error if occurred
function resErrHandler(data){
// Check for unauthorized access
- if (data.status == 401) {
+ if (data.status === 401) {
// redirect user on Login Page
window.location.href = "login.html?error=UNAUTH_ACCESS";
}else{
diff --git a/geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/ui/PulseAutomatedTest.java b/geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/ui/PulseAutomatedTest.java
index 5af912cfb058..3fc3f25f8f83 100644
--- a/geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/ui/PulseAutomatedTest.java
+++ b/geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/ui/PulseAutomatedTest.java
@@ -13,12 +13,6 @@
* the License.
*
*/
-/**
- * This test class contains automated tests for Pulse application related to 1. Different grid data
- * validations for example - Topology, Server Group, Redundancy Zone 2. Data Browser 3.
- *
- * @since GemFire 2014-04-02
- */
package org.apache.geode.tools.pulse.tests.ui;
import static org.apache.geode.tools.pulse.tests.ui.PulseTestUtils.assertMemberSortingByCpuUsage;
@@ -59,13 +53,16 @@
import static org.apache.geode.tools.pulse.tests.ui.PulseTestUtils.verifyTextPresrntById;
import static org.apache.geode.tools.pulse.tests.ui.PulseTestUtils.verifyTextPresrntByXpath;
import static org.apache.geode.tools.pulse.tests.ui.PulseTestUtils.waitForElementWithId;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.Collection;
import java.util.List;
+import java.util.stream.Collectors;
import org.junit.Assert;
import org.junit.Before;
@@ -84,6 +81,12 @@
import org.apache.geode.tools.pulse.tests.rules.ServerRule;
import org.apache.geode.tools.pulse.tests.rules.WebDriverRule;
+/**
+ * This test class contains automated tests for Pulse application related to 1. Different grid data
+ * validations for example - Topology, Server Group, Redundancy Zone 2. Data Browser 3.
+ *
+ * @since GemFire 2014-04-02
+ */
public class PulseAutomatedTest extends PulseBase {
@ClassRule
@@ -851,7 +854,7 @@ public void testDataBrowserClearButton() {
clickElementUsingXpath(PulseTestLocators.DataBrowser.btnClearXpath);
String editorTextAfterClear = getTextUsingId(PulseTestLocators.DataBrowser.queryEditorTxtBoxId);
- assertFalse(PulseTestData.DataBrowser.query1Text.equals(editorTextAfterClear));
+ assertNotEquals(PulseTestData.DataBrowser.query1Text, editorTextAfterClear);
}
@Ignore("WIP") // Data Browser's Query History not showing any data on button click, therefore
@@ -892,10 +895,50 @@ public void testDataBrowserHistoryQueue() {
System.out.println("Query Text from History Table: " + queryText);
System.out.println("Query Time from History Table: " + historyDateTime);
// verify the query text, query datetime in history panel
- assertTrue(DataBrowserResultLoader.QUERY_TYPE_ONE.equals(queryText));
- assertTrue(historyDateTime.contains(queryTime[0]));
-
+ assertThat(queryText).isEqualTo(DataBrowserResultLoader.QUERY_TYPE_ONE);
+ assertThat(historyDateTime).contains(queryTime[0]);
}
+ @Test
+ public void testDataBrowserHTMLEncode() {
+ // navigate to Data browser page
+ loadDataBrowserpage();
+
+ WebDriver driver = webDriverRule.getDriver();
+ List
numOfReg = driver
+ .findElements(By.xpath(PulseTestLocators.DataBrowser.divDataRegions));
+ for (int i = 1; i <= numOfReg.size(); i++) {
+ if (getTextUsingId("treeDemo_" + i + "_span").equals(PulseTestData.DataBrowser.regName)) {
+ searchByIdAndClick("treeDemo_" + i + "_check"); // driver.findElement(By.id("treeDemo_" + i
+ // + "_check")).click();
+ }
+ }
+
+ sendKeysUsingId(PulseTestLocators.DataBrowser.queryEditorTxtBoxId,
+ DataBrowserResultLoader.QUERY_TYPE_EIGHT);
+ clickElementUsingId(PulseTestLocators.DataBrowser.btnExecuteQueryId);
+
+ clickElementUsingId(PulseTestLocators.DataBrowser.historyIcon);
+ String queryText = findElementByXpath(PulseTestLocators.DataBrowser.historyLst)
+ .findElement(By.cssSelector(PulseTestLocators.DataBrowser.queryText)).getText();
+
+ assertThat(queryText).isEqualTo(DataBrowserResultLoader.QUERY_TYPE_EIGHT);
+
+ List elements =
+ driver.findElements(By.xpath(PulseTestData.DataBrowser.resultClusterHeadingsXPath));
+ List filteredElements = elements.stream().filter(webElement -> webElement.getText()
+ .equals("org.apache.geode.cache.query.data.Portfolio")).collect(
+ Collectors.toList());
+ List finalElements = filteredElements.stream().map(webElement -> {
+ webElement.click();
+ return webElement.findElements(By.xpath(PulseTestData.DataBrowser.resultClusterCellXPath));
+ }).flatMap(Collection::stream).collect(Collectors.toList());
+
+ // confirm script text is displayed
+ assertThat(finalElements).hasSize(2);
+ finalElements.forEach(webElement -> {
+ assertThat(webElement.getAttribute("title")).isEqualTo("");
+ });
+ }
}