Skip to content

Commit 60eeb54

Browse files
Fixes to element aligments and responsive design (#58)
* Fixed missaligned buttons in Add subscription modal * Various changes to to alignments, responsive design and folder structure. * Further fixes to responsive design * Minor fix * Hide navbar menu when clicking a link * Fixed some testing errors * Fix merge errors * Fix Test Rules overlay * Minor fix
1 parent bfb1ef0 commit 60eeb54

File tree

117 files changed

+13997
-54532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+13997
-54532
lines changed

src/functionaltest/java/com/ericsson/ei/frontend/SubscriptionHandlingFunctionality.java

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,17 @@ public void testSubscription() throws Exception {
5252
// with names "Subscription1" and "Subscription2" are present AND there exists "edit" and
5353
// "delete buttons" for unauthorized user "ABCD"
5454
String response = this.getJSONStringFromFile(SUBSCRIPTION_FOR_RELOAD_TEST_FILE_PATH);
55-
String deleteButtonXPath = "//tr[td[contains(.,'Subscription1')]]/td/button[contains(text(),'Delete')]";
56-
String editButtonXPath = "//tr[td[contains(.,'Subscription1')]]/td/button[contains(text(),'Edit')]";
57-
String viewButtonXPath = "//tr[td[contains(.,'Subscription1')]]/td/button[contains(text(),'View')]";
55+
String viewButtonXPath = "(//button[@id='view-Subscription1'])[2]";
56+
String editButtonXPath = "(//button[@id='edit-Subscription1'])[2]";
57+
String deleteButtonXPath = "(//button[@id='delete-Subscription1'])[2]";
58+
String expandButtonXPath = "//tr[contains(.,'Subscription1')]/td[1]";
5859
subscriptionPage.clickReload(response);
5960
assert (subscriptionPage.textExistsInTable("Subscription1"));
6061
assert (subscriptionPage.textExistsInTable("Subscription2"));
61-
assert (subscriptionPage.buttonExist(deleteButtonXPath) == true);
62-
assert (subscriptionPage.buttonExist(editButtonXPath) == true);
63-
assert (subscriptionPage.buttonExist(viewButtonXPath) == true);
62+
assert (subscriptionPage.clickElementByXPath(expandButtonXPath));
63+
assert (subscriptionPage.buttonExist(deleteButtonXPath));
64+
assert (subscriptionPage.buttonExist(editButtonXPath));
65+
assert (subscriptionPage.buttonExist(viewButtonXPath));
6466

6567
// Given LDAP is enabled, "Reload" subscriptions and then click subscription
6668
// page with LDAP enabled with unauthorized user names
@@ -69,9 +71,10 @@ public void testSubscription() throws Exception {
6971
String responseAuth = "{\"security\":true}";
7072
subscriptionPage.clickReloadLDAP(responseSub, responseAuth);
7173
indexPageObject.clickSubscriptionPage();
72-
assert (subscriptionPage.buttonExist(deleteButtonXPath) == false);
73-
assert (subscriptionPage.buttonExist(editButtonXPath) == false);
74-
assert (subscriptionPage.buttonExist(viewButtonXPath) == true);
74+
assert (subscriptionPage.clickElementByXPath(expandButtonXPath));
75+
assert (!subscriptionPage.buttonExist(deleteButtonXPath));
76+
assert (!subscriptionPage.buttonExist(editButtonXPath));
77+
assert (subscriptionPage.buttonExist(viewButtonXPath));
7578

7679
// Given LDAP is enabled, "Reload" subscriptions and then click subscription
7780
// page with LDAP enabled with both unauthorized and unauthorized user names (in
@@ -85,21 +88,24 @@ public void testSubscription() throws Exception {
8588
js.executeScript(String.format("window.localStorage.setItem('%s','%s');", keyForUser, valueForUser));
8689
indexPageObject.clickSubscriptionPage();
8790
assert (subscriptionPage.textExistsInTable("Subscription1"));
88-
assert (subscriptionPage.buttonExist(deleteButtonXPath) == true);
89-
assert (subscriptionPage.buttonExist(editButtonXPath) == true);
90-
assert (subscriptionPage.buttonExist(viewButtonXPath) == true);
91+
assert (subscriptionPage.clickElementByXPath(expandButtonXPath));
92+
assert (subscriptionPage.buttonExist(deleteButtonXPath));
93+
assert (subscriptionPage.buttonExist(editButtonXPath));
94+
assert (subscriptionPage.buttonExist(viewButtonXPath));
9195

9296
// Now, path for "subscriptions2" with user name "DEF", so user "ABCD" is
9397
// unauthorized for this subscription
94-
String deleteButtonXPath2 = "//tr[td[contains(.,'Subscription2')]]/td/button[contains(text(),'Delete')]";
95-
String editButtonXPath2 = "//tr[td[contains(.,'Subscription2')]]/td/button[contains(text(),'Edit')]";
96-
String viewButtonXPath2 = "//tr[td[contains(.,'Subscription2')]]/td/button[contains(text(),'View')]";
97-
assert (subscriptionPage.buttonExist(deleteButtonXPath2) == false);
98-
assert (subscriptionPage.buttonExist(editButtonXPath2) == false);
99-
assert (subscriptionPage.buttonExist(viewButtonXPath2) == true);
98+
String viewButtonXPath2 = "(//button[@id='view-Subscription2'])[2]";
99+
String editButtonXPath2 = "(//button[@id='edit-Subscription2'])[2]";
100+
String deleteButtonXPath2 = "(//button[@id='delete-Subscription2'])[2]";
101+
String expandButtonXPath2 = "//tr[contains(.,'Subscription2')]/td[1]";
102+
assert (subscriptionPage.clickElementByXPath(expandButtonXPath2));
103+
assert (subscriptionPage.buttonExist(viewButtonXPath2));
104+
assert (!subscriptionPage.buttonExist(editButtonXPath2));
105+
assert (!subscriptionPage.buttonExist(deleteButtonXPath2));
100106

101107
// Test view button
102-
subscriptionPage.clickViewBtn();
108+
subscriptionPage.clickElementByXPath(viewButtonXPath2);
103109
assert (new WebDriverWait(driver, 10)
104110
.until((webdriver) -> driver.getPageSource().contains("View Subscription")));
105111
subscriptionPage.clickFormCloseBtn();
@@ -112,8 +118,8 @@ public void testSubscription() throws Exception {
112118
// subscriptions are deleted
113119
String mockedDeleteResponse = "";
114120
subscriptionPage.clickBulkDelete(mockedDeleteResponse);
115-
assert (subscriptionPage.textExistsInTable("Subscription1") == false);
116-
assert (subscriptionPage.textExistsInTable("Subscription2") == false);
121+
assert (!subscriptionPage.textExistsInTable("Subscription1"));
122+
assert (!subscriptionPage.textExistsInTable("Subscription2"));
117123

118124
// Verify that "get template" button works
119125
String mockedTemplateResponse = this.getJSONStringFromFile(SUBSCRIPTION_TEMPLATE_FILE_PATH);

src/functionaltest/java/com/ericsson/ei/frontend/pageobjects/SubscriptionPage.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ public void clickFormCloseBtn() {
166166

167167
public String getSubscriptionNameFromSubscription() {
168168
new WebDriverWait(driver, TIMEOUT_TIMER)
169-
.until(ExpectedConditions.elementToBeClickable(By.xpath("//tr[@class='odd']/td[2]")));
170-
WebElement subscriptionNameElement = driver.findElement(By.xpath("//tr[@class='odd']/td[2]"));
169+
.until(ExpectedConditions.elementToBeClickable(By.xpath("//tr[@class='odd']/td[3]")));
170+
WebElement subscriptionNameElement = driver.findElement(By.xpath("//tr[@class='odd']/td[3]"));
171171
return subscriptionNameElement.getText();
172172
}
173173

@@ -200,4 +200,14 @@ public boolean textExistsInTable(String txt) {
200200
}
201201
return true;
202202
}
203+
204+
public boolean clickElementByXPath(String loc) {
205+
try {
206+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath(loc)));
207+
driver.findElement(By.xpath(loc)).click();
208+
} catch (Exception e) {
209+
return false;
210+
}
211+
return true;
212+
}
203213
}

src/functionaltest/java/com/ericsson/ei/frontend/pageobjects/TestRulesPage.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,37 @@ public String getFirstRuleText() {
8989
}
9090

9191
public String getFirstEventText() {
92-
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("Events2")));
92+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("Events2")));
9393
WebElement textArea = driver.findElementsByClassName("formEvents").get(0);
9494
return textArea.getText().replaceAll("[\\n ]", "");
9595
}
9696

9797
public void clickDownloadRulesButton() {
98-
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.className("download_rules")));
98+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.className("download_rules")));
9999
WebElement downloadRulesButton = driver.findElement(By.className("download_rules"));
100100
downloadRulesButton.click();
101101
}
102102

103103
public void clickAddRuleButton() {
104-
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.className("add_rule")));
104+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.className("add_rule")));
105105
WebElement addRuleButton = driver.findElement(By.className("add_rule"));
106106
addRuleButton.click();
107107
}
108108

109109
public void clickRemoveRuleNumber(int number) {
110-
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("Rule" + number)));
110+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("Rule" + number)));
111111
WebElement removeRuleButton = driver.findElement(By.id("Rule" + number)).findElement(By.className("fa-trash"));
112112
removeRuleButton.click();
113113
}
114114

115115
public void clickAddEventButton() {
116-
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.className("add_event")));
116+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.className("add_event")));
117117
WebElement addEventButton = driver.findElement(By.className("add_event"));
118118
addEventButton.click();
119119
}
120120

121121
public void clickRemoveEventNumber(int number) {
122-
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("Events" + number)));
122+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("Events" + number)));
123123
WebElement removeEventButton = driver.findElement(By.id("Events" + number)).findElement(By.className("fa-trash"));
124124

125125
// We need the following two lines in order to be sure that the remove event button is not obscured...
@@ -130,7 +130,7 @@ public void clickRemoveEventNumber(int number) {
130130
}
131131

132132
public void clickFindAggregatedObject(String findAggregatedObjectResponse) throws IOException {
133-
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.className("find_aggregated_object")));
133+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.className("find_aggregated_object")));
134134
CloseableHttpResponse response = this.createMockedHTTPResponse(findAggregatedObjectResponse, 200);
135135
Mockito.doReturn(response).when(mockedHttpClient).execute(Mockito.argThat(request ->
136136
(request).getURI().toString().contains("/aggregation")));
@@ -140,7 +140,7 @@ public void clickFindAggregatedObject(String findAggregatedObjectResponse) throw
140140
}
141141

142142
public String getAggregatedResultData() {
143-
new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.id("aggregatedresultData")));
143+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("aggregatedresultData")));
144144
WebElement aggregatedResultDataElement = driver.findElement(By.id("aggregatedresultData"));
145145
return aggregatedResultDataElement.getAttribute("textContent").replaceAll("[\\n ]", "");
146146
}

0 commit comments

Comments
 (0)