PromucFlow_constructor/app/client/src/usagePulse/usagePulse.test.ts

33 lines
898 B
TypeScript
Raw Normal View History

chore: Use rolling window in the usage pulse call and send segment anonymous id for anonymous users (#19552) ## Description We have updated the user tracking to use a rolling window. Now the session starts when the user goes to the builder or viewer for the first time and the subsequent activity tracking will be checked only after an hour. For anonymous users, we send the Segment anonymous id in the usage calls. When the telemetry is off, we still initiate the segment, get the id and then purge the analytics global object. Fixed window (in release, as of now)- if the user starts a session at 01:15 pm, we take 01:00 pm as the session start time and we will check for the next user activity at 2:00 pm. rolling window (in this PR) - if the user starts a session at 01:15 pm, we take 01:15 pm as the session start time and we will check for the next user activity at 2:15 pm. Fixes https://github.com/appsmithorg/cloud-services/issues/183 ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-10 12:09:33 +00:00
import UsagePulse from "usagePulse";
describe("Usage pulse", () => {
describe("isTrackableUrl", () => {
it("should return true when called with trackable URL", () => {
// All application URLS are trackable.
[
fix: fix usage pulse fallback (#21735) ## Description Added a fallback value (crypto.randomUUID) when there is an issue with generating the key from segment Fixes #https://github.com/appsmithorg/cloud-services/issues/582 Fixes #https://github.com/appsmithorg/cloud-services/issues/583 ## Type of change - Bug fix (non-breaking change which fixes an issue) - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? - Manual - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: balajisoundar <balaji@appsmith.com>
2023-04-06 12:21:58 +00:00
"/app/test/mypage-123123/edit",
"/app/test/mypage-123123",
"/app/test-123123/edit",
"/app/test-123123",
"/applications/123123test/pages/123123test/edit",
"/applications/123123test/pages/123123test",
chore: Use rolling window in the usage pulse call and send segment anonymous id for anonymous users (#19552) ## Description We have updated the user tracking to use a rolling window. Now the session starts when the user goes to the builder or viewer for the first time and the subsequent activity tracking will be checked only after an hour. For anonymous users, we send the Segment anonymous id in the usage calls. When the telemetry is off, we still initiate the segment, get the id and then purge the analytics global object. Fixed window (in release, as of now)- if the user starts a session at 01:15 pm, we take 01:00 pm as the session start time and we will check for the next user activity at 2:00 pm. rolling window (in this PR) - if the user starts a session at 01:15 pm, we take 01:15 pm as the session start time and we will check for the next user activity at 2:15 pm. Fixes https://github.com/appsmithorg/cloud-services/issues/183 ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-10 12:09:33 +00:00
].forEach((url) => {
expect(UsagePulse.isTrackableUrl(url)).toBeTruthy();
});
});
it("should return false when called with untrackable URL", () => {
[
fix: fix usage pulse fallback (#21735) ## Description Added a fallback value (crypto.randomUUID) when there is an issue with generating the key from segment Fixes #https://github.com/appsmithorg/cloud-services/issues/582 Fixes #https://github.com/appsmithorg/cloud-services/issues/583 ## Type of change - Bug fix (non-breaking change which fixes an issue) - Chore (housekeeping or task changes that don't impact user perception) ## How Has This Been Tested? - Manual - Cypress ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: balajisoundar <balaji@appsmith.com>
2023-04-06 12:21:58 +00:00
"/applications",
"/login",
"/signup",
"/settings",
"/generate-page",
fix: sending usage pulse when the app is private and user is logged in. (#22933) Today, when we open a private app, and the user is not logged in. We send the usage pulse and then redirect the user to the login page. After this fix, if we hit a private app URL and the user is logged in, we will send the pulse or else redirect to the login page without sending a pulse. Fixes # https://github.com/appsmithorg/cloud-services/issues/763 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-05-08 09:03:21 +00:00
].forEach(async (url) => {
expect(await UsagePulse.isTrackableUrl(url)).toBeFalsy();
chore: Use rolling window in the usage pulse call and send segment anonymous id for anonymous users (#19552) ## Description We have updated the user tracking to use a rolling window. Now the session starts when the user goes to the builder or viewer for the first time and the subsequent activity tracking will be checked only after an hour. For anonymous users, we send the Segment anonymous id in the usage calls. When the telemetry is off, we still initiate the segment, get the id and then purge the analytics global object. Fixed window (in release, as of now)- if the user starts a session at 01:15 pm, we take 01:00 pm as the session start time and we will check for the next user activity at 2:00 pm. rolling window (in this PR) - if the user starts a session at 01:15 pm, we take 01:15 pm as the session start time and we will check for the next user activity at 2:15 pm. Fixes https://github.com/appsmithorg/cloud-services/issues/183 ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ### Test Plan ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-10 12:09:33 +00:00
});
});
});
});