test: Cypress - Segment calls intercepted (#21726)
## Description - This PR adds the host for segment calls as localhost as opposed to sending it to Segment itself - Diverting segment calls to Localhost for Cypress CI runs & intercepting the response - Updated to Analytics spec to validate the enableTelemtry false state - Bug 21191, validation included - Welcome screen - not toggling off the Usage Details anymore ## Type of change - Yml file update - Script updates ## Checklist: ### QA activity: - [X] Added Test Plan Approved label after reviewing all changes
This commit is contained in:
parent
f1779b4f63
commit
413d430025
2
.github/workflows/ci-test.yml
vendored
2
.github/workflows/ci-test.yml
vendored
|
|
@ -161,7 +161,7 @@ jobs:
|
|||
-v "$PWD/stacks:/appsmith-stacks" -e APPSMITH_LICENSE_KEY=$APPSMITH_LICENSE_KEY \
|
||||
-e APPSMITH_DISABLE_TELEMETRY=true \
|
||||
-e APPSMITH_CLOUD_SERVICES_BASE_URL=http://host.docker.internal:5001 \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
|
||||
cicontainer
|
||||
|
||||
- name: Setup MSSQL docker container
|
||||
|
|
|
|||
|
|
@ -1,27 +1,44 @@
|
|||
import User from "../../../../fixtures/user.json";
|
||||
|
||||
let appId;
|
||||
|
||||
describe("Checks for analytics initialization", function () {
|
||||
describe("1. Checks for analytics initialization", function () {
|
||||
before(() => {
|
||||
cy.visit("/applications");
|
||||
cy.get(".admin-settings-menu-option").click();
|
||||
cy.get("[data-cy='APPSMITH_DISABLE_TELEMETRY'] > input").should(
|
||||
"be.checked",
|
||||
); //Bug 21191
|
||||
cy.get("[data-cy='APPSMITH_DISABLE_TELEMETRY']")
|
||||
.find("span")
|
||||
.last()
|
||||
.click(); //disabling sharing of anonymous data
|
||||
cy.get(".t--admin-settings-save-button").click();
|
||||
cy.wait(2000);
|
||||
cy.get(".t--admin-settings-restart-notice", { timeout: 120000 }).should(
|
||||
"not.exist",
|
||||
);
|
||||
cy.wait("@getGeneral").its("response.statusCode").should("eq", 200);
|
||||
});
|
||||
|
||||
it("Should check analytics is not initialised when enableTelemtry is false", function () {
|
||||
cy.visit("/applications");
|
||||
cy.reload();
|
||||
cy.wait(3000);
|
||||
cy.wait("@getMe")
|
||||
.wait("@getMe")
|
||||
.should(
|
||||
"have.nested.property",
|
||||
"response.body.data.enableTelemetry",
|
||||
false,
|
||||
);
|
||||
// cy.reload();
|
||||
// cy.wait(3000);
|
||||
// cy.wait("@getMe")
|
||||
// //.wait("@getMe")
|
||||
// .should(
|
||||
// "have.nested.property",
|
||||
// "response.body.data.enableTelemetry",
|
||||
// false,
|
||||
// );
|
||||
cy.window().then((window) => {
|
||||
expect(window.analytics).to.be.equal(undefined);
|
||||
expect(window.analytics).to.equal(undefined);
|
||||
});
|
||||
let interceptFlag = false;
|
||||
cy.intercept("POST", "https://api.segment.io/**", (req) => {
|
||||
interceptFlag = true;
|
||||
req.continue();
|
||||
});
|
||||
cy.get(".t--new-button").should("be.visible");
|
||||
cy.generateUUID().then((id) => {
|
||||
appId = id;
|
||||
cy.CreateAppInFirstListedWorkspace(id);
|
||||
|
|
@ -33,7 +50,7 @@ describe("Checks for analytics initialization", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("Should check smartlook is not initialised when enableTelemtry is false", function () {
|
||||
it("2. Should check smartlook is not initialised when enableTelemtry is false", function () {
|
||||
cy.visit("/applications");
|
||||
cy.reload();
|
||||
cy.wait(3000);
|
||||
|
|
@ -57,7 +74,7 @@ describe("Checks for analytics initialization", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("Should check Sentry is not initialised when enableTelemtry is false", function () {
|
||||
it("3. Should check Sentry is not initialised when enableTelemtry is false", function () {
|
||||
cy.visit("/applications");
|
||||
cy.reload();
|
||||
cy.wait(3000);
|
||||
|
|
|
|||
|
|
@ -1017,6 +1017,18 @@ Cypress.Commands.add("startServerAndRoutes", () => {
|
|||
cy.intercept({
|
||||
method: "PUT",
|
||||
}).as("sucessSave");
|
||||
|
||||
cy.intercept("POST", "https://api.segment.io/v1/b", (req) => {
|
||||
req.reply((res) => {
|
||||
res.send({
|
||||
//status: 200,
|
||||
body: {
|
||||
success: false, //since anything can be faked!
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
cy.intercept("GET", "/settings/general").as("getGeneral");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("startErrorRoutes", () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user