Skip to content

Commit e85d78a

Browse files
author
“Akshay
committed
Possible flaky test fix?
And removed unnecessary logging
1 parent 8e15c0a commit e85d78a

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

iterableapi/src/androidTest/java/com/iterable/iterableapi/IterableApiResponseTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ public class IterableApiResponseTest {
3737
private MockWebServer server;
3838

3939
@Before
40-
public void setUp() {
40+
public void setUp() throws IOException {
4141
server = new MockWebServer();
42+
// Explicitly start the server to ensure it's ready
43+
try {
44+
server.start();
45+
} catch (IllegalStateException e) {
46+
// Server may already be started by url() call below, which is fine
47+
}
4248
IterableApi.overrideURLEndpointPath(server.url("").toString());
4349
createIterableApi();
4450
}
@@ -138,7 +144,7 @@ public void onFailure(@NonNull String reason, @Nullable JSONObject data) {
138144
new IterableRequestTask().execute(request);
139145

140146
server.takeRequest(5, TimeUnit.SECONDS);
141-
assertTrue("onFailure is called", signal.await(1, TimeUnit.SECONDS));
147+
assertTrue("onFailure is called", signal.await(5, TimeUnit.SECONDS));
142148
}
143149

144150

iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
198198
webView = new IterableWebView(getContext());
199199
webView.setId(R.id.webView);
200200

201-
// Debug the HTML content
202-
IterableLogger.d(TAG, "HTML content preview: " + (htmlString.length() > 200 ? htmlString.substring(0, 200) + "..." : htmlString));
203-
204201
webView.createWithHtml(this, htmlString);
205202

206203
if (orientationListener == null) {
@@ -241,7 +238,6 @@ public void run() {
241238
RelativeLayout webViewContainer = new RelativeLayout(this.getContext());
242239

243240
int gravity = getVerticalLocation(insetPadding);
244-
IterableLogger.d(TAG, "Initial setup - gravity: " + gravity + " for inset padding: " + insetPadding);
245241

246242
// Set FrameLayout gravity based on positioning
247243
FrameLayout.LayoutParams containerParams = new FrameLayout.LayoutParams(
@@ -251,13 +247,10 @@ public void run() {
251247

252248
if (gravity == Gravity.CENTER_VERTICAL) {
253249
containerParams.gravity = Gravity.CENTER;
254-
IterableLogger.d(TAG, "Applied CENTER gravity to container");
255250
} else if (gravity == Gravity.TOP) {
256251
containerParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
257-
IterableLogger.d(TAG, "Applied TOP gravity to container");
258252
} else if (gravity == Gravity.BOTTOM) {
259253
containerParams.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
260-
IterableLogger.d(TAG, "Applied BOTTOM gravity to container");
261254
}
262255

263256
// Add WebView to the RelativeLayout container with WRAP_CONTENT for proper sizing
@@ -268,13 +261,9 @@ public void run() {
268261
webViewParams.addRule(RelativeLayout.CENTER_IN_PARENT);
269262
webViewContainer.addView(webView, webViewParams);
270263

271-
IterableLogger.d(TAG, "Added WebView with WRAP_CONTENT and CENTER_IN_PARENT rule");
272-
273264
// Add the container to the FrameLayout
274265
frameLayout.addView(webViewContainer, containerParams);
275266

276-
IterableLogger.d(TAG, "Created FrameLayout with positioned RelativeLayout container");
277-
278267
if (savedInstanceState == null || !savedInstanceState.getBoolean(IN_APP_OPEN_TRACKED, false)) {
279268
IterableApi.sharedInstance.trackInAppOpen(messageId, location);
280269
}

0 commit comments

Comments
 (0)