Skip to content

Commit 2bb2392

Browse files
author
Anders Breid
authored
Fix tests in EI front-end (#262)
* Fix tests in EI front-end * Update query missed notification test
1 parent 2164e34 commit 2bb2392

File tree

8 files changed

+36
-18
lines changed

8 files changed

+36
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void tearDown() throws Exception {
7373
protected void initBaseMocks(CloseableHttpClient mockedHttpClient) throws ClientProtocolException, IOException {
7474
CloseableHttpResponse responseData = createMockedHTTPResponse("\"\":\"\"", 200);
7575
Mockito.doReturn(responseData).when(mockedHttpClient)
76-
.execute(Mockito.argThat(request -> (request).getURI().toString().contains("/auth/checkStatus")));
76+
.execute(Mockito.argThat(request -> (request).getURI().toString().contains("/status")));
7777

7878
Mockito.doReturn(responseData).when(mockedHttpClient)
7979
.execute(Mockito.argThat(request -> (request).getURI().toString().contains("/auth")));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void testJourneyToFindAggregatedObjectButton() throws Exception {
7676
public static void setUpMocks() throws IOException {
7777
mockServer = startClientAndServer();
7878
mockClient = new MockServerClient(BASE_URL, mockServer.getLocalPort());
79-
mockClient.when(request().withMethod("GET").withPath("/auth/checkStatus"))
79+
mockClient.when(request().withMethod("GET").withPath("/status"))
8080
.respond(response().withStatusCode(200));
8181
}
8282

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ private void setupMockEndpoints(boolean security, String user) throws IOExceptio
330330
clientAndServer.when(request().withMethod("GET").withPath("/subscriptions/Subscription1"))
331331
.respond(response().withStatusCode(200).withBody(subscriptionResponse2));
332332

333-
String responseStatus = "{\"status\":\"OK\"}";
334-
clientAndServer.when(request().withMethod("GET").withPath("/auth/checkStatus"))
333+
String responseStatus = "{\"eiffelIntelligenceStatus\" : \"AVAILABLE\"}";
334+
clientAndServer.when(request().withMethod("GET").withPath("/status"))
335335
.respond(response().withStatusCode(200).withBody(responseStatus));
336336

337337
String mockedTemplateResponse = getJSONStringFromFile(SUBSCRIPTION_TEMPLATE_FILE_PATH);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void addBackendInstances() {
127127
}
128128

129129
private static void setupMockEndpoints() throws IOException {
130-
mockClient2.when(request().withMethod("GET").withPath("/auth/checkStatus")).respond(response().withStatusCode(200).withBody(""));
130+
mockClient2.when(request().withMethod("GET").withPath("/status")).respond(response().withStatusCode(200).withBody("{\"eiffelIntelligenceStatus\" : \"AVAILABLE\"}"));
131131

132132
mockClient2.when(request().withMethod("GET").withPath("/auth")).respond(response().withStatusCode(200).withBody("{\"security\":false}"));
133133

@@ -139,7 +139,7 @@ private static void setupMockEndpoints() throws IOException {
139139
mockClient1.when(request().withMethod("GET").withPath("/subscriptions"))
140140
.respond(response().withStatusCode(200).withBody(defaultInstanceSubscriptionResponse));
141141

142-
mockClient1.when(request().withMethod("GET").withPath("/auth/checkStatus")).respond(response().withStatusCode(200).withBody(""));
142+
mockClient1.when(request().withMethod("GET").withPath("/status")).respond(response().withStatusCode(200).withBody("{\"eiffelIntelligenceStatus\" : \"AVAILABLE\"}"));
143143

144144
mockClient1.when(request().withMethod("GET").withPath("/auth")).respond(response().withStatusCode(200).withBody("{\"security\":false}"));
145145
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.ericsson.ei.frontend;
2+
3+
import org.junit.runner.RunWith;
4+
5+
import cucumber.api.CucumberOptions;
6+
import cucumber.api.junit.Cucumber;
7+
8+
@RunWith(Cucumber.class)
9+
@CucumberOptions(features = "src/integrationtest/resources/features/status.feature", glue = {
10+
"com.ericsson.ei.frontend" }, plugin = {
11+
"html:target/cucumber-reports/StatusRunnerIT" })
12+
public class StatusRunnerIT {
13+
14+
}

src/integrationtest/resources/features/auth.feature

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ Feature: Authentication test
99
Then response code 200 is received
1010
And response body '{"security":true}' is received
1111

12-
@AuthCheckStatusScenario
13-
Scenario: Check status test
14-
Given frontend is up and running
15-
When a 'GET' request is prepared for REST API '/auth/checkStatus'
16-
And username "gauss" and password "password" is used as credentials
17-
And request is sent
18-
Then response code 200 is received
19-
And response body 'Backend server is up and running' is received
20-
2112
@AuthMultipleUsersLoginAndLogoutScenario
2213
Scenario: Multiple Users Login And Logout test
2314
Given frontend is up and running
@@ -75,13 +66,13 @@ Feature: Authentication test
7566
Given frontend is up and running
7667

7768
# Invalid Username
78-
When a 'GET' request is prepared for REST API '/auth/checkStatus'
69+
When a 'GET' request is prepared for REST API '/auth/login'
7970
And username "invalid_username" and password "password" is used as credentials
8071
And request is sent
8172
Then response code 401 is received
8273

8374
# Invalid Password
84-
When a 'GET' request is prepared for REST API '/auth/checkStatus'
75+
When a 'GET' request is prepared for REST API '/auth/login'
8576
And username "gauss" and password "invalid_password" is used as credentials
8677
And request is sent
8778
Then response code 401 is received

src/integrationtest/resources/features/query.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Feature: Query test
55
Scenario: Query missed notifications
66
Given frontend is up and running
77
When a 'GET' request is prepared for REST API '/queryMissedNotifications'
8-
And param key 'SubscriptionName' with value 'NonExistingSubscription' is added
8+
And param key 'subscriptionName' with value 'NonExistingSubscription' is added
99
And request is sent
1010
Then response code 200 is received
1111
And response body '{"queryResponseEntity":{}}' is received
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@StatusFeature
2+
Feature: Status test
3+
4+
@StatusScenario
5+
Scenario: Check status test
6+
Given frontend is up and running
7+
When a 'GET' request is prepared for REST API '/status'
8+
And request is sent
9+
Then response code 200 is received
10+
And response body contains '"eiffelIntelligenceStatus" : "AVAILABLE"'
11+
And response body contains '"rabbitMQStatus" : "AVAILABLE"'
12+
And response body contains '"mongoDBStatus" : "AVAILABLE"'
13+

0 commit comments

Comments
 (0)