Skip to content

Commit 0fbb172

Browse files
authored
release (#433)
1 parent c626f92 commit 0fbb172

File tree

7 files changed

+174
-162
lines changed

7 files changed

+174
-162
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## X.X.X
1+
## 23.6.0
22
- Added a new flag, 'loadAPMScriptsAsync', which can load the APM related scripts automatically for Async implementations
33
- Adding SDK health check requests after init
44
- Adding remaining request queue size information to every request

cypress/integration/remaining_requests.js

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,32 @@ describe("Remaining requests tests ", () => {
1616
hp.haltAndClearStorage(() => {
1717
initMain(false);
1818

19-
// Create a session and end it
20-
Countly.begin_session();
21-
Countly.end_session(undefined, true);
22-
23-
// We expect 3 requests: begin_session, end_session, orientation
24-
hp.interceptAndCheckRequests(undefined, undefined, undefined, undefined, "begin_session", (requestParams) => {
25-
expect(requestParams.get("begin_session")).to.equal("1");
26-
expect(requestParams.get("rr")).to.equal("3");
27-
});
28-
hp.interceptAndCheckRequests(undefined, undefined, undefined, undefined, "end_session", (requestParams) => {
29-
expect(requestParams.get("end_session")).to.equal("1");
30-
expect(requestParams.get("rr")).to.equal("2");
19+
// We will expect 4 requests: health check, begin_session, end_session, orientation
20+
hp.interceptAndCheckRequests(undefined, undefined, undefined, "?hc=*", "hc", (requestParams) => {
21+
expect(requestParams.get("hc")).to.equal(JSON.stringify({ el: 0, wl: 0, sc: -1, em: "\"\"" }));
22+
expect(requestParams.get("rr")).to.equal(null);
3123
});
32-
hp.interceptAndCheckRequests(undefined, undefined, undefined, undefined, "orientation", (requestParams) => {
33-
expect(JSON.parse(requestParams.get("events"))[0].key).to.equal("[CLY]_orientation");
34-
expect(requestParams.get("rr")).to.equal("1");
35-
});
36-
cy.wait(100).then(() => {
37-
cy.fetch_local_request_queue().then((rq) => {
38-
expect(rq.length).to.equal(0);
24+
cy.wait(1000).then(() => {
25+
// Create a session
26+
Countly.begin_session();
27+
hp.interceptAndCheckRequests(undefined, undefined, undefined, "?begin_session=*", "begin_session", (requestParams) => {
28+
expect(requestParams.get("begin_session")).to.equal("1");
29+
expect(requestParams.get("rr")).to.equal("3");
30+
});
31+
// End the session
32+
Countly.end_session(undefined, true);
33+
hp.interceptAndCheckRequests(undefined, undefined, undefined, undefined, "end_session", (requestParams) => {
34+
expect(requestParams.get("end_session")).to.equal("1");
35+
expect(requestParams.get("rr")).to.equal("2");
36+
});
37+
hp.interceptAndCheckRequests(undefined, undefined, undefined, undefined, "orientation", (requestParams) => {
38+
expect(JSON.parse(requestParams.get("events"))[0].key).to.equal("[CLY]_orientation");
39+
expect(requestParams.get("rr")).to.equal("1");
40+
});
41+
cy.wait(100).then(() => {
42+
cy.fetch_local_request_queue().then((rq) => {
43+
expect(rq.length).to.equal(0);
44+
});
3945
});
4046
});
4147
});
@@ -48,7 +54,7 @@ describe("Remaining requests tests ", () => {
4854
Countly.begin_session();
4955
Countly.end_session(undefined, true);
5056
cy.fetch_local_request_queue().then((rq) => {
51-
// We expect 3 requests in queue: begin_session, end_session, orientation
57+
// We expect 3 requests in queue: begin_session, end_session, orientation. health check was not in the queue
5258
expect(rq.length).to.equal(3);
5359
expect(rq[0].rr).to.equal(3);
5460
expect(rq[1].rr).to.equal(undefined);

cypress/support/helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ var waitFunction = function(startTime, waitTime, waitIncrement, continueCallback
5959
*/
6060
function interceptAndCheckRequests(requestType, requestUrl, endPoint, requestParams, alias, callback) {
6161
requestType = requestType || "GET";
62-
requestUrl = requestUrl || "https://try.count.ly";
62+
requestUrl = requestUrl || "https://try.count.ly"; // TODO: might be needed in the future but not yet
6363
endPoint = endPoint || "/i";
6464
requestParams = requestParams || "?**";
6565
alias = alias || "getXhr";
6666

67-
cy.intercept(requestType, requestUrl + endPoint + requestParams).as(alias);
67+
cy.intercept(requestType, endPoint + requestParams).as(alias);
6868
cy.wait("@" + alias).then((xhr) => {
6969
const url = new URL(xhr.request.url);
7070
const searchParams = url.searchParams;

examples/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"countly-sdk-web": "^23.2.2"
6+
"countly-sdk-web": "^23.6.0"
77
},
88
"devDependencies": {
99
"react": "^18.2.0",

lib/countly.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
*/
195195
Countly.onload = Countly.onload || [];
196196

197-
var SDK_VERSION = "23.2.2";
197+
var SDK_VERSION = "23.6.0";
198198
var SDK_NAME = "javascript_native_web";
199199

200200
var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
@@ -666,6 +666,8 @@
666666
}
667667
}, 1);
668668
document.documentElement.setAttribute("data-countly-useragent", currentUserAgentString());
669+
// send instant health check request
670+
HealthCheck.sendInstantHCRequest();
669671
};
670672

671673
/**
@@ -4610,8 +4612,6 @@
46104612

46114613
// initialize Countly Class
46124614
this.initialize();
4613-
// send instant health check request
4614-
HealthCheck.sendInstantHCRequest();
46154615
};
46164616

46174617
/**

0 commit comments

Comments
 (0)