From e2b89b2542fcc5b7528d964d812be27fc11fa96d Mon Sep 17 00:00:00 2001 From: Cich0sza Date: Thu, 25 Jul 2019 17:24:39 +0200 Subject: [PATCH 01/14] fix User-Agent header --- .../cognifide/aet/proxy/RestProxyServer.java | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java index 401344118..e6d321556 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java @@ -21,6 +21,8 @@ import com.github.detro.browsermobproxyclient.exceptions.BMPCUnableToConnectException; import com.google.gson.GsonBuilder; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.Date; import org.apache.http.client.methods.CloseableHttpResponse; @@ -39,6 +41,8 @@ public class RestProxyServer implements ProxyServerWrapper { private static final String HTTP = "http"; + private static final String USER_AGENT_HEADER = "user-agent"; + public static final int STATUS_CODE_OK = 200; private BMPCProxy server; @@ -99,14 +103,13 @@ public void addHeader(String name, String value) { CloseableHttpClient httpClient = HttpClients.createSystem(); try { URIBuilder uriBuilder = new URIBuilder().setScheme(HTTP).setHost(server.getAPIHost()) - .setPort(server.getAPIPort()); - // Request BMP to add header - HttpPost request = new HttpPost(uriBuilder.setPath( - String.format("/proxy/%d/headers", server.getProxyPort())).build()); - request.setHeader("Content-Type", "application/json"); - JSONObject json = new JSONObject(); - json.put(name, value); - request.setEntity(new StringEntity(json.toString())); + .setPort(server.getAPIPort()); + HttpPost request; + if (USER_AGENT_HEADER.equalsIgnoreCase(name)) { + request = createUserAgentChangeRequest(uriBuilder, value); + } else { + request = createHeaderRequest(uriBuilder, name, value); + } // Execute request CloseableHttpResponse response = httpClient.execute(request); int statusCode = response.getStatusLine().getStatusCode(); @@ -134,4 +137,26 @@ public void stop() { proxyManager.detach(this); } + private HttpPost createHeaderRequest(URIBuilder uriBuilder, String name, String value) + throws URISyntaxException, UnsupportedEncodingException { + HttpPost request = new HttpPost(uriBuilder.setPath( + String.format("/proxy/%d/headers", server.getProxyPort())).build()); + request.setHeader("Content-Type", "application/json"); + JSONObject json = new JSONObject(); + json.put(name, value); + request.setEntity(new StringEntity(json.toString())); + return request; + } + + private HttpPost createUserAgentChangeRequest(URIBuilder uriBuilder, String value) + throws URISyntaxException, UnsupportedEncodingException { + HttpPost request = new HttpPost(uriBuilder.setPath( + String.format("/proxy/%d/filter/request", server.getProxyPort())).build()); + request.setHeader("Content-Type", "text/plain"); + String data = String.format( + "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", value); + request.setEntity(new StringEntity(data)); + return request; + } + } From 3e7a60432fc147eca917b3ac3719be20cf865573 Mon Sep 17 00:00:00 2001 From: Cich0sza Date: Fri, 26 Jul 2019 08:50:11 +0200 Subject: [PATCH 02/14] code refactoring --- .../cognifide/aet/proxy/RestProxyServer.java | 39 +++++-------------- .../proxy/headers/CommonHeaderStrategy.java | 38 ++++++++++++++++++ .../proxy/headers/HeaderRequestStrategy.java | 26 +++++++++++++ .../headers/UserAgentHeaderStrategy.java | 37 ++++++++++++++++++ 4 files changed, 110 insertions(+), 30 deletions(-) create mode 100644 osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java create mode 100644 osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java create mode 100644 osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java index e6d321556..93354be31 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java @@ -17,22 +17,22 @@ import com.cognifide.aet.job.api.collector.ProxyServerWrapper; import com.cognifide.aet.proxy.exceptions.UnableToAddHeaderException; +import com.cognifide.aet.proxy.headers.CommonHeaderStrategy; +import com.cognifide.aet.proxy.headers.HeaderRequestStrategy; +import com.cognifide.aet.proxy.headers.UserAgentHeaderStrategy; import com.github.detro.browsermobproxyclient.BMPCProxy; import com.github.detro.browsermobproxyclient.exceptions.BMPCUnableToConnectException; import com.google.gson.GsonBuilder; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.Date; + import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; -import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.browsermob.core.har.Har; -import org.json.JSONObject; import org.openqa.selenium.Proxy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,12 +104,14 @@ public void addHeader(String name, String value) { try { URIBuilder uriBuilder = new URIBuilder().setScheme(HTTP).setHost(server.getAPIHost()) .setPort(server.getAPIPort()); - HttpPost request; + HeaderRequestStrategy headerRequestStrategy; if (USER_AGENT_HEADER.equalsIgnoreCase(name)) { - request = createUserAgentChangeRequest(uriBuilder, value); + headerRequestStrategy = new UserAgentHeaderStrategy(); } else { - request = createHeaderRequest(uriBuilder, name, value); + headerRequestStrategy = new CommonHeaderStrategy(); } + + HttpPost request = headerRequestStrategy.createRequest(uriBuilder, server.getProxyPort(), name, value); // Execute request CloseableHttpResponse response = httpClient.execute(request); int statusCode = response.getStatusLine().getStatusCode(); @@ -136,27 +138,4 @@ public void stop() { server.close(); proxyManager.detach(this); } - - private HttpPost createHeaderRequest(URIBuilder uriBuilder, String name, String value) - throws URISyntaxException, UnsupportedEncodingException { - HttpPost request = new HttpPost(uriBuilder.setPath( - String.format("/proxy/%d/headers", server.getProxyPort())).build()); - request.setHeader("Content-Type", "application/json"); - JSONObject json = new JSONObject(); - json.put(name, value); - request.setEntity(new StringEntity(json.toString())); - return request; - } - - private HttpPost createUserAgentChangeRequest(URIBuilder uriBuilder, String value) - throws URISyntaxException, UnsupportedEncodingException { - HttpPost request = new HttpPost(uriBuilder.setPath( - String.format("/proxy/%d/filter/request", server.getProxyPort())).build()); - request.setHeader("Content-Type", "text/plain"); - String data = String.format( - "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", value); - request.setEntity(new StringEntity(data)); - return request; - } - } diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java new file mode 100644 index 000000000..981b93aec --- /dev/null +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java @@ -0,0 +1,38 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.proxy.headers; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.StringEntity; +import org.json.JSONObject; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; + +public class CommonHeaderStrategy implements HeaderRequestStrategy { + @Override + public HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) + throws URISyntaxException, UnsupportedEncodingException { + HttpPost request = new HttpPost(uriBuilder.setPath( + String.format("/proxy/%d/headers", proxyPort)).build()); + request.setHeader("Content-Type", "application/json"); + JSONObject json = new JSONObject(); + json.put(name, value); + request.setEntity(new StringEntity(json.toString())); + return request; + } +} diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java new file mode 100644 index 000000000..5a13a7b8c --- /dev/null +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java @@ -0,0 +1,26 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.proxy.headers; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; + +public interface HeaderRequestStrategy { + HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) throws URISyntaxException, UnsupportedEncodingException; +} diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java new file mode 100644 index 000000000..5b51e88c1 --- /dev/null +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java @@ -0,0 +1,37 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.proxy.headers; + +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.StringEntity; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; + +public class UserAgentHeaderStrategy implements HeaderRequestStrategy { + @Override + public HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) + throws URISyntaxException, UnsupportedEncodingException { + HttpPost request = new HttpPost(uriBuilder.setPath( + String.format("/proxy/%d/filter/request", proxyPort)).build()); + request.setHeader("Content-Type", "text/plain"); + String data = String.format( + "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", value); + request.setEntity(new StringEntity(data)); + return request; + } +} From 9dc4602635aac11dc4d500090f45cd5d4b461b59 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 29 Jul 2019 11:02:49 +0200 Subject: [PATCH 03/14] code refactoring --- .../cognifide/aet/proxy/RestProxyServer.java | 15 +++++------ ...nHeaderStrategy.java => CommonHeader.java} | 27 ++++++++++++++++--- .../proxy/headers/HeaderRequestStrategy.java | 3 +-- ...aderStrategy.java => UserAgentHeader.java} | 24 ++++++++++++++--- 4 files changed, 53 insertions(+), 16 deletions(-) rename osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/{CommonHeaderStrategy.java => CommonHeader.java} (64%) rename osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/{UserAgentHeaderStrategy.java => UserAgentHeader.java} (67%) diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java index 93354be31..8dae58be6 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java @@ -17,9 +17,9 @@ import com.cognifide.aet.job.api.collector.ProxyServerWrapper; import com.cognifide.aet.proxy.exceptions.UnableToAddHeaderException; -import com.cognifide.aet.proxy.headers.CommonHeaderStrategy; +import com.cognifide.aet.proxy.headers.CommonHeader; import com.cognifide.aet.proxy.headers.HeaderRequestStrategy; -import com.cognifide.aet.proxy.headers.UserAgentHeaderStrategy; +import com.cognifide.aet.proxy.headers.UserAgentHeader; import com.github.detro.browsermobproxyclient.BMPCProxy; import com.github.detro.browsermobproxyclient.exceptions.BMPCUnableToConnectException; import com.google.gson.GsonBuilder; @@ -29,7 +29,6 @@ import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.browsermob.core.har.Har; @@ -102,16 +101,16 @@ public void setCaptureContent(boolean captureContent) { public void addHeader(String name, String value) { CloseableHttpClient httpClient = HttpClients.createSystem(); try { - URIBuilder uriBuilder = new URIBuilder().setScheme(HTTP).setHost(server.getAPIHost()) - .setPort(server.getAPIPort()); HeaderRequestStrategy headerRequestStrategy; if (USER_AGENT_HEADER.equalsIgnoreCase(name)) { - headerRequestStrategy = new UserAgentHeaderStrategy(); + headerRequestStrategy = new UserAgentHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort(), value); } else { - headerRequestStrategy = new CommonHeaderStrategy(); + headerRequestStrategy = new CommonHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort(), name, value); } - HttpPost request = headerRequestStrategy.createRequest(uriBuilder, server.getProxyPort(), name, value); + HttpPost request = headerRequestStrategy.createRequest(); // Execute request CloseableHttpResponse response = httpClient.execute(request); int statusCode = response.getStatusLine().getStatusCode(); diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java similarity index 64% rename from osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java rename to osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java index 981b93aec..cb9a79585 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeaderStrategy.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java @@ -23,15 +23,36 @@ import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; -public class CommonHeaderStrategy implements HeaderRequestStrategy { +public class CommonHeader implements HeaderRequestStrategy { + + private final String apiHost; + + private final int apiPort; + + private final int proxyPort; + + private final String headerName; + + private final String headerValue; + + public CommonHeader(String apiHost, int apiPort, int proxyPort, String headerName, String headerValue) { + this.apiHost = apiHost; + this.apiPort = apiPort; + this.proxyPort = proxyPort; + this.headerName = headerName; + this.headerValue = headerValue; + } + @Override - public HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) + public HttpPost createRequest() throws URISyntaxException, UnsupportedEncodingException { + URIBuilder uriBuilder = new URIBuilder().setScheme("http") + .setHost(apiHost).setPort(apiPort); HttpPost request = new HttpPost(uriBuilder.setPath( String.format("/proxy/%d/headers", proxyPort)).build()); request.setHeader("Content-Type", "application/json"); JSONObject json = new JSONObject(); - json.put(name, value); + json.put(headerName, headerValue); request.setEntity(new StringEntity(json.toString())); return request; } diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java index 5a13a7b8c..563c28f3f 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java @@ -16,11 +16,10 @@ package com.cognifide.aet.proxy.headers; import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; public interface HeaderRequestStrategy { - HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) throws URISyntaxException, UnsupportedEncodingException; + HttpPost createRequest() throws URISyntaxException, UnsupportedEncodingException; } diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java similarity index 67% rename from osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java rename to osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java index 5b51e88c1..ec6ad87a6 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeaderStrategy.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java @@ -22,15 +22,33 @@ import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; -public class UserAgentHeaderStrategy implements HeaderRequestStrategy { +public class UserAgentHeader implements HeaderRequestStrategy { + + private final String apiHost; + + private final int apiPort; + + private final int proxyPort; + + private final String headerValue; + + public UserAgentHeader(String apiHost, int apiPort, int proxyPort, String headerValue) { + this.apiHost = apiHost; + this.apiPort = apiPort; + this.proxyPort = proxyPort; + this.headerValue = headerValue; + } + @Override - public HttpPost createRequest(URIBuilder uriBuilder, int proxyPort, String name, String value) + public HttpPost createRequest() throws URISyntaxException, UnsupportedEncodingException { + URIBuilder uriBuilder = new URIBuilder().setScheme("http") + .setHost(apiHost).setPort(apiPort); HttpPost request = new HttpPost(uriBuilder.setPath( String.format("/proxy/%d/filter/request", proxyPort)).build()); request.setHeader("Content-Type", "text/plain"); String data = String.format( - "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", value); + "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", headerValue); request.setEntity(new StringEntity(data)); return request; } From 9e6f2d2520776e73eee420b89d1a81482aa6a6e8 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 29 Jul 2019 13:06:40 +0200 Subject: [PATCH 04/14] Add 'override' parameter to headerModifier --- .../job/common/modifiers/header/HeaderModifier.java | 11 ++++++++++- .../common/modifiers/header/HeaderModifierTest.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/jobs/src/main/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifier.java b/core/jobs/src/main/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifier.java index 11b60ef6c..a6d5135d6 100644 --- a/core/jobs/src/main/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifier.java +++ b/core/jobs/src/main/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifier.java @@ -30,12 +30,16 @@ public class HeaderModifier implements CollectorJob { private static final String PARAM_VALUE = "value"; + private static final String PARAM_OVERRIDE = "override"; + private final WebCommunicationWrapper webCommunicationWrapper; private String key; private String value; + private Boolean override; + public HeaderModifier(WebCommunicationWrapper webCommunicationWrapper) { this.webCommunicationWrapper = webCommunicationWrapper; } @@ -46,7 +50,7 @@ public CollectorStepResult collect() throws ProcessingException { if (!webCommunicationWrapper.isUseProxy()) { throw new ProcessingException("Cannot modify header without using proxy"); } - webCommunicationWrapper.getProxyServer().addHeader(key, value); + webCommunicationWrapper.getProxyServer().addHeader(key, value, override); webCommunicationWrapper.getHttpRequestExecutor().addHeader(key, value); return CollectorStepResult.newModifierResult(); } @@ -59,6 +63,11 @@ public void setParameters(Map params) throws ParametersException } else { throw new ParametersException("Missing Key or Value on Header Modifier"); } + if (params.containsKey(PARAM_OVERRIDE)) { + override = Boolean.parseBoolean(params.get(PARAM_OVERRIDE)); + } else { + override = false; + } } } diff --git a/core/jobs/src/test/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifierTest.java b/core/jobs/src/test/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifierTest.java index 191e034e1..65d20e1c0 100644 --- a/core/jobs/src/test/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifierTest.java +++ b/core/jobs/src/test/java/com/cognifide/aet/job/common/modifiers/header/HeaderModifierTest.java @@ -58,7 +58,7 @@ public void testCollect() throws Exception { headerModifier.setParameters(ImmutableMap.of("key", "header", "value", "value1")); headerModifier.collect(); - verify(proxyServer).addHeader("header", "value1"); + verify(proxyServer).addHeader("header", "value1", false); verify(requestExecutor).addHeader("header", "value1"); } From dae997e50a705b8a7eb559d0341cb48a8967a1d2 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 29 Jul 2019 13:23:42 +0200 Subject: [PATCH 05/14] Handle new 'override' parameter --- .../job/api/collector/ProxyServerWrapper.java | 2 +- .../cognifide/aet/proxy/RestProxyServer.java | 18 +++++++++--------- .../{CommonHeader.java => AddHeader.java} | 14 ++++---------- .../proxy/headers/HeaderRequestStrategy.java | 2 +- ...serAgentHeader.java => OverrideHeader.java} | 12 +++++------- 5 files changed, 20 insertions(+), 28 deletions(-) rename osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/{CommonHeader.java => AddHeader.java} (80%) rename osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/{UserAgentHeader.java => OverrideHeader.java} (80%) diff --git a/api/jobs-api/src/main/java/com/cognifide/aet/job/api/collector/ProxyServerWrapper.java b/api/jobs-api/src/main/java/com/cognifide/aet/job/api/collector/ProxyServerWrapper.java index b3185b3da..38b502050 100644 --- a/api/jobs-api/src/main/java/com/cognifide/aet/job/api/collector/ProxyServerWrapper.java +++ b/api/jobs-api/src/main/java/com/cognifide/aet/job/api/collector/ProxyServerWrapper.java @@ -34,7 +34,7 @@ public interface ProxyServerWrapper { void setCaptureContent(boolean captureContent); - void addHeader(String name, String value); + void addHeader(String name, String value, Boolean override); void stop() throws ProxyException; diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java index 8dae58be6..564473ef4 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java @@ -17,9 +17,9 @@ import com.cognifide.aet.job.api.collector.ProxyServerWrapper; import com.cognifide.aet.proxy.exceptions.UnableToAddHeaderException; -import com.cognifide.aet.proxy.headers.CommonHeader; +import com.cognifide.aet.proxy.headers.AddHeader; import com.cognifide.aet.proxy.headers.HeaderRequestStrategy; -import com.cognifide.aet.proxy.headers.UserAgentHeader; +import com.cognifide.aet.proxy.headers.OverrideHeader; import com.github.detro.browsermobproxyclient.BMPCProxy; import com.github.detro.browsermobproxyclient.exceptions.BMPCUnableToConnectException; import com.google.gson.GsonBuilder; @@ -98,19 +98,19 @@ public void setCaptureContent(boolean captureContent) { } @Override - public void addHeader(String name, String value) { + public void addHeader(String name, String value, Boolean override) { CloseableHttpClient httpClient = HttpClients.createSystem(); try { HeaderRequestStrategy headerRequestStrategy; - if (USER_AGENT_HEADER.equalsIgnoreCase(name)) { - headerRequestStrategy = new UserAgentHeader(server.getAPIHost(), server.getAPIPort(), - server.getProxyPort(), value); + if (override) { + headerRequestStrategy = new OverrideHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort()); } else { - headerRequestStrategy = new CommonHeader(server.getAPIHost(), server.getAPIPort(), - server.getProxyPort(), name, value); + headerRequestStrategy = new AddHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort()); } - HttpPost request = headerRequestStrategy.createRequest(); + HttpPost request = headerRequestStrategy.createRequest(name, value); // Execute request CloseableHttpResponse response = httpClient.execute(request); int statusCode = response.getStatusLine().getStatusCode(); diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/AddHeader.java similarity index 80% rename from osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java rename to osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/AddHeader.java index cb9a79585..28685dd3e 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/CommonHeader.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/AddHeader.java @@ -23,7 +23,7 @@ import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; -public class CommonHeader implements HeaderRequestStrategy { +public class AddHeader implements HeaderRequestStrategy { private final String apiHost; @@ -31,20 +31,14 @@ public class CommonHeader implements HeaderRequestStrategy { private final int proxyPort; - private final String headerName; - - private final String headerValue; - - public CommonHeader(String apiHost, int apiPort, int proxyPort, String headerName, String headerValue) { + public AddHeader(String apiHost, int apiPort, int proxyPort) { this.apiHost = apiHost; this.apiPort = apiPort; this.proxyPort = proxyPort; - this.headerName = headerName; - this.headerValue = headerValue; } @Override - public HttpPost createRequest() + public HttpPost createRequest(String name, String value) throws URISyntaxException, UnsupportedEncodingException { URIBuilder uriBuilder = new URIBuilder().setScheme("http") .setHost(apiHost).setPort(apiPort); @@ -52,7 +46,7 @@ public HttpPost createRequest() String.format("/proxy/%d/headers", proxyPort)).build()); request.setHeader("Content-Type", "application/json"); JSONObject json = new JSONObject(); - json.put(headerName, headerValue); + json.put(name, value); request.setEntity(new StringEntity(json.toString())); return request; } diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java index 563c28f3f..7738a7994 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestStrategy.java @@ -21,5 +21,5 @@ import java.net.URISyntaxException; public interface HeaderRequestStrategy { - HttpPost createRequest() throws URISyntaxException, UnsupportedEncodingException; + HttpPost createRequest(String name, String value) throws URISyntaxException, UnsupportedEncodingException; } diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/OverrideHeader.java similarity index 80% rename from osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java rename to osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/OverrideHeader.java index ec6ad87a6..03ad9b117 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/UserAgentHeader.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/OverrideHeader.java @@ -22,7 +22,7 @@ import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; -public class UserAgentHeader implements HeaderRequestStrategy { +public class OverrideHeader implements HeaderRequestStrategy { private final String apiHost; @@ -30,17 +30,14 @@ public class UserAgentHeader implements HeaderRequestStrategy { private final int proxyPort; - private final String headerValue; - - public UserAgentHeader(String apiHost, int apiPort, int proxyPort, String headerValue) { + public OverrideHeader(String apiHost, int apiPort, int proxyPort) { this.apiHost = apiHost; this.apiPort = apiPort; this.proxyPort = proxyPort; - this.headerValue = headerValue; } @Override - public HttpPost createRequest() + public HttpPost createRequest(String name, String value) throws URISyntaxException, UnsupportedEncodingException { URIBuilder uriBuilder = new URIBuilder().setScheme("http") .setHost(apiHost).setPort(apiPort); @@ -48,7 +45,8 @@ public HttpPost createRequest() String.format("/proxy/%d/filter/request", proxyPort)).build()); request.setHeader("Content-Type", "text/plain"); String data = String.format( - "request.headers().remove('User-Agent'); request.headers().add('User-Agent', '%s');", headerValue); + "request.headers().remove('%s'); request.headers().add('%s', '%s');", + name, name, value); request.setEntity(new StringEntity(data)); return request; } From 4381d91c63071641ddeecf043bd60096d7aaaad4 Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 29 Jul 2019 15:44:05 +0200 Subject: [PATCH 06/14] Code refactoring --- .../cognifide/aet/proxy/RestProxyServer.java | 33 +++++--------- .../proxy/headers/HeaderRequestFactory.java | 43 +++++++++++++++++++ 2 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestFactory.java diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java index 564473ef4..059d5fc3b 100644 --- a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/RestProxyServer.java @@ -17,16 +17,10 @@ import com.cognifide.aet.job.api.collector.ProxyServerWrapper; import com.cognifide.aet.proxy.exceptions.UnableToAddHeaderException; -import com.cognifide.aet.proxy.headers.AddHeader; -import com.cognifide.aet.proxy.headers.HeaderRequestStrategy; -import com.cognifide.aet.proxy.headers.OverrideHeader; +import com.cognifide.aet.proxy.headers.HeaderRequestFactory; import com.github.detro.browsermobproxyclient.BMPCProxy; import com.github.detro.browsermobproxyclient.exceptions.BMPCUnableToConnectException; import com.google.gson.GsonBuilder; -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.Date; - import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; @@ -36,15 +30,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class RestProxyServer implements ProxyServerWrapper { - - private static final String HTTP = "http"; +import java.io.IOException; +import java.util.Date; - private static final String USER_AGENT_HEADER = "user-agent"; +public class RestProxyServer implements ProxyServerWrapper { public static final int STATUS_CODE_OK = 200; - private BMPCProxy server; + private final BMPCProxy server; private boolean captureContent; @@ -52,15 +45,18 @@ public class RestProxyServer implements ProxyServerWrapper { private RestProxyManager proxyManager; + private final HeaderRequestFactory requestFactory; + private static final Logger LOGGER = LoggerFactory.getLogger(RestProxyServer.class); public RestProxyServer(BMPCProxy bmpcProxy, RestProxyManager restProxyManager) { this.server = bmpcProxy; this.proxyManager = restProxyManager; + this.requestFactory = new HeaderRequestFactory(bmpcProxy); } @Override - public Proxy seleniumProxy() throws UnknownHostException { + public Proxy seleniumProxy() { return server.asSeleniumProxy() .setHttpProxy(String.format("%s:%d", proxyManager.getServer(), getPort())) .setSslProxy(String.format("%s:%d", proxyManager.getServer(), getPort())); @@ -101,16 +97,7 @@ public void setCaptureContent(boolean captureContent) { public void addHeader(String name, String value, Boolean override) { CloseableHttpClient httpClient = HttpClients.createSystem(); try { - HeaderRequestStrategy headerRequestStrategy; - if (override) { - headerRequestStrategy = new OverrideHeader(server.getAPIHost(), server.getAPIPort(), - server.getProxyPort()); - } else { - headerRequestStrategy = new AddHeader(server.getAPIHost(), server.getAPIPort(), - server.getProxyPort()); - } - - HttpPost request = headerRequestStrategy.createRequest(name, value); + HttpPost request = requestFactory.create(name, value, override); // Execute request CloseableHttpResponse response = httpClient.execute(request); int statusCode = response.getStatusLine().getStatusCode(); diff --git a/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestFactory.java b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestFactory.java new file mode 100644 index 000000000..94ea72f08 --- /dev/null +++ b/osgi-dependencies/proxy/src/main/java/com/cognifide/aet/proxy/headers/HeaderRequestFactory.java @@ -0,0 +1,43 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.proxy.headers; + +import com.github.detro.browsermobproxyclient.BMPCProxy; +import org.apache.http.client.methods.HttpPost; + +import java.io.UnsupportedEncodingException; +import java.net.URISyntaxException; + +public class HeaderRequestFactory { + + private final BMPCProxy server; + + public HeaderRequestFactory(BMPCProxy server) { + this.server = server; + } + + public HttpPost create(String name, String value, Boolean override) throws UnsupportedEncodingException, URISyntaxException { + HeaderRequestStrategy headerRequestStrategy; + if (override) { + headerRequestStrategy = new OverrideHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort()); + } else { + headerRequestStrategy = new AddHeader(server.getAPIHost(), server.getAPIPort(), + server.getProxyPort()); + } + return headerRequestStrategy.createRequest(name, value); + } +} From b6c2a90f079733a9f2c3526bf55daf725d1b15ea Mon Sep 17 00:00:00 2001 From: Bartek Date: Mon, 29 Jul 2019 16:13:36 +0200 Subject: [PATCH 07/14] HeaderModifier wiki update --- documentation/src/main/wiki/HeaderModifier.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/src/main/wiki/HeaderModifier.md b/documentation/src/main/wiki/HeaderModifier.md index 3ad2d473e..90575cade 100644 --- a/documentation/src/main/wiki/HeaderModifier.md +++ b/documentation/src/main/wiki/HeaderModifier.md @@ -14,6 +14,7 @@ In order to use this modifier it must be declared before the open module in the | --------- | ----- | ----------- | --------- | | `key` | x | Key for the header | yes | | `value` | y | Value for the header | yes | +| `override` | `true`/`false` | Replace existing header instead of adding new one | no (default false) | ##### Example Usage @@ -23,6 +24,9 @@ In order to use this modifier it must be declared before the open module in the ... +
+
... From 7caa37aa12e91e1198852ae5a130ed4bf0160c5d Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 30 Jul 2019 10:37:58 +0200 Subject: [PATCH 08/14] Changelog update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 789f231d4..8ce0ec0a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to AET will be documented in this file. - [PR-462](https://github.com/Cognifide/aet/pull/462) Popup window unification([#367](https://github.com/Cognifide/aet/issues/367)) - [PR-489](https://github.com/Cognifide/aet/pull/489) Cleaner integration tests - [PR-480](https://github.com/Cognifide/aet/pull/480) Test summary stats on the main report page. ([#474](https://github.com/Cognifide/aet/issues/474)) +- [PR-516](https://github.com/Cognifide/aet/pull/516) Added option to change headers added by Chrome instance. ([#515](https://github.com/Cognifide/aet/issues/515)) ## Version 3.2.2 From 26519b93bda10b391c4f54c17746fb7c6d9023a7 Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 30 Jul 2019 10:43:13 +0200 Subject: [PATCH 09/14] Wiki change --- documentation/src/main/wiki/HeaderModifier.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/main/wiki/HeaderModifier.md b/documentation/src/main/wiki/HeaderModifier.md index 90575cade..ecb543ac1 100644 --- a/documentation/src/main/wiki/HeaderModifier.md +++ b/documentation/src/main/wiki/HeaderModifier.md @@ -14,7 +14,7 @@ In order to use this modifier it must be declared before the open module in the | --------- | ----- | ----------- | --------- | | `key` | x | Key for the header | yes | | `value` | y | Value for the header | yes | -| `override` | `true`/`false` | Replace existing header instead of adding new one | no (default false) | +| `override` | `true`/`false` | Override option should be set at `true` when your want change header added by Chrome instance, otherwise it should by `false` | no (default false) | ##### Example Usage From e5b2c2471180cd2bdc66cba7799c367df3c61aa6 Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 30 Jul 2019 14:43:56 +0200 Subject: [PATCH 10/14] Wiki change --- documentation/src/main/wiki/HeaderModifier.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/documentation/src/main/wiki/HeaderModifier.md b/documentation/src/main/wiki/HeaderModifier.md index ecb543ac1..602a17f44 100644 --- a/documentation/src/main/wiki/HeaderModifier.md +++ b/documentation/src/main/wiki/HeaderModifier.md @@ -14,7 +14,11 @@ In order to use this modifier it must be declared before the open module in the | --------- | ----- | ----------- | --------- | | `key` | x | Key for the header | yes | | `value` | y | Value for the header | yes | -| `override` | `true`/`false` | Override option should be set at `true` when your want change header added by Chrome instance, otherwise it should by `false` | no (default false) | +| `override` | `true`/`false` | Override option should be set at `true` when your want replace header added by Chrome instance, otherwise it should by `false` | no (default false) | + +Important note. + +When you want add another value to Accept header and leave the default value create by Chrome instance, you can use `override=false`. ##### Example Usage From da55a5d6ca10962cbd82244c4fb062374b24f3a0 Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 31 Jul 2019 11:25:54 +0200 Subject: [PATCH 11/14] Integration tests for header modifier --- .../sanity/modifiers/header/show_headers.jsp | 41 +++++++++++++++ .../test-suite/partials/header.xml | 51 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 integration-tests/sample-site/src/main/webapp/sanity/modifiers/header/show_headers.jsp diff --git a/integration-tests/sample-site/src/main/webapp/sanity/modifiers/header/show_headers.jsp b/integration-tests/sample-site/src/main/webapp/sanity/modifiers/header/show_headers.jsp new file mode 100644 index 000000000..a9121cfac --- /dev/null +++ b/integration-tests/sample-site/src/main/webapp/sanity/modifiers/header/show_headers.jsp @@ -0,0 +1,41 @@ +<%-- + + AET + + Copyright (C) 2013 Cognifide Limited + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--%> +<%@ page import="java.util.*" %> + + + + Headers test + + + +

HTTP Request Headers Received

+ + <% Enumeration enumeration = request.getHeaderNames(); while (enumeration.hasMoreElements()) + { + String name=(String) enumeration.nextElement(); + String value = request.getHeader(name); %> + + + + + <% } %> +
<%=name %><%=value %>
+ + \ No newline at end of file diff --git a/integration-tests/test-suite/partials/header.xml b/integration-tests/test-suite/partials/header.xml index 84997a938..8576c98a6 100644 --- a/integration-tests/test-suite/partials/header.xml +++ b/integration-tests/test-suite/partials/header.xml @@ -39,4 +39,55 @@ + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + From 44a01370e9fa245ea066c7d676ad74e427114e41 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 9 Aug 2019 13:56:37 +0200 Subject: [PATCH 12/14] Update integration tests --- .../src/test/resources/features/filtering.feature | 2 +- integration-tests/test-suite/partials/header.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/sanity-functional/src/test/resources/features/filtering.feature b/integration-tests/sanity-functional/src/test/resources/features/filtering.feature index de70a55a8..ccfbdf576 100644 --- a/integration-tests/sanity-functional/src/test/resources/features/filtering.feature +++ b/integration-tests/sanity-functional/src/test/resources/features/filtering.feature @@ -74,7 +74,7 @@ Feature: Tests Results Filtering Given I have opened sample tests report page When I search for tests containing "header" Then There are 1 tiles visible - And Statistics text contains "1 ( 0 / 0 / 1 (0) / 0 )" + And Statistics text contains "4 ( 0 / 0 / 4 (0) / 0 )" Scenario: Filtering Tests Results: sleep-modifier Given I have opened sample tests report page diff --git a/integration-tests/test-suite/partials/header.xml b/integration-tests/test-suite/partials/header.xml index 8576c98a6..bd1540654 100644 --- a/integration-tests/test-suite/partials/header.xml +++ b/integration-tests/test-suite/partials/header.xml @@ -38,7 +38,6 @@ -
@@ -90,4 +89,5 @@ + From a58a352edef45ab65671a911bf3a7bd2d2a6de67 Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 9 Aug 2019 13:57:12 +0200 Subject: [PATCH 13/14] Update integration tests --- .../src/test/resources/features/filtering.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/sanity-functional/src/test/resources/features/filtering.feature b/integration-tests/sanity-functional/src/test/resources/features/filtering.feature index ccfbdf576..a3fb34ee2 100644 --- a/integration-tests/sanity-functional/src/test/resources/features/filtering.feature +++ b/integration-tests/sanity-functional/src/test/resources/features/filtering.feature @@ -73,7 +73,7 @@ Feature: Tests Results Filtering Scenario: Filtering Tests Results: header Given I have opened sample tests report page When I search for tests containing "header" - Then There are 1 tiles visible + Then There are 4 tiles visible And Statistics text contains "4 ( 0 / 0 / 4 (0) / 0 )" Scenario: Filtering Tests Results: sleep-modifier From 4b11a3e77ea5edb2ad98373c8be455d963b67edf Mon Sep 17 00:00:00 2001 From: Bartek Date: Fri, 9 Aug 2019 14:44:29 +0200 Subject: [PATCH 14/14] Update integration tests --- .../cognifide/aet/sanity/functional/HomePageTilesTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/sanity-functional/src/test/java/com/cognifide/aet/sanity/functional/HomePageTilesTest.java b/integration-tests/sanity-functional/src/test/java/com/cognifide/aet/sanity/functional/HomePageTilesTest.java index ed0c3a51c..7015c751b 100644 --- a/integration-tests/sanity-functional/src/test/java/com/cognifide/aet/sanity/functional/HomePageTilesTest.java +++ b/integration-tests/sanity-functional/src/test/java/com/cognifide/aet/sanity/functional/HomePageTilesTest.java @@ -29,9 +29,9 @@ @Modules(GuiceModule.class) public class HomePageTilesTest { - private static final int TESTS = 149; + private static final int TESTS = 152; - private static final int EXPECTED_TESTS_SUCCESS = 85; + private static final int EXPECTED_TESTS_SUCCESS = 88; private static final int EXPECTED_TESTS_CONDITIONALLY_PASSED = 11;