test: PartialExport_Widgets_spec - updated exported json file to compare and added confirmation of successful import (#33090)

RCA:
Test was failing at comparison step where we export and compare
 
Solution:
Updated the WidgetsExportedOnly.json, now the comparison step is working
as expected
Improved the assertions within importApp() reduced wait time and also
removed the Toast message verification


/ok-to-test tags="@tag.Workspace,@tag.ImportExport"

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8941790028>
> Commit: 23535e879fde6b8d3018e6bcd762a85df18fea9c
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8941790028&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
NandanAnantharamu 2024-05-07 11:23:16 +05:30 committed by GitHub
parent d00f9fa7f1
commit 87d535ac23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 47 additions and 28 deletions

View File

@ -6,6 +6,10 @@ import {
dataSources,
assertHelper,
} from "../../../support/Objects/ObjectsCore";
import {
createMessage,
IMPORT_APP_SUCCESSFUL,
} from "../../../../src/ce/constants/messages";
describe(
"Import, Export and Fork application and validate data binding",
@ -36,7 +40,7 @@ describe(
} else {
cy.get(homePageLocatores.toastMessage).should(
"contain",
"Application imported successfully",
createMessage(IMPORT_APP_SUCCESSFUL),
);
}
agHelper.GenerateUUID();
@ -132,7 +136,7 @@ describe(
} else {
cy.get(homePageLocatores.toastMessage).should(
"contain",
"Application imported successfully",
createMessage(IMPORT_APP_SUCCESSFUL),
);
}
const importedApp = interception.response.body.data.application;

View File

@ -56,10 +56,6 @@ describe("Git import flow ", { tags: ["@tag.Git"] }, function () {
cy.testDatasource(true);
agHelper.GetNClick(dataSources._saveDs);
cy.wait(2000);
/*cy.get(homePageLocators.toastMessage).should(
"contain",
"Application imported successfully",
); */
cy.wait("@getWorkspace");
cy.get(reconnectDatasourceModal.ImportSuccessModal).should("be.visible");
cy.get(reconnectDatasourceModal.ImportSuccessModalCloseBtn).click({
@ -113,10 +109,6 @@ describe("Git import flow ", { tags: ["@tag.Git"] }, function () {
cy.get(reconnectDatasourceModal.ImportSuccessModalCloseBtn).click({
force: true,
});
/* cy.get(homePageLocators.toastMessage).should(
"contain",
"Application imported successfully",
); */
cy.wait("@gitStatus").then((interception) => {
cy.log(interception.response.body.data);
cy.wait(1000);

View File

@ -10,6 +10,10 @@ import {
agHelper,
homePage as homePageHelpers,
} from "../../../../support/Objects/ObjectsCore";
import {
createMessage,
IMPORT_APP_SUCCESSFUL,
} from "../../../../../src/ce/constants/messages";
describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
it("1. Import application and Validate Migration on pageload", function () {
@ -28,7 +32,7 @@ describe("Migration Validate", { tags: ["@tag.ImportExport"] }, function () {
cy.wait("@importNewApplication").then(() => {
cy.get(homePage.toastMessage).should(
"contain",
"Application imported successfully",
createMessage(IMPORT_APP_SUCCESSFUL),
);
//Renaming imported app!

View File

@ -4,6 +4,10 @@ import {
dataSources,
agHelper,
} from "../../../support/Objects/ObjectsCore";
import {
createMessage,
IMPORT_APP_SUCCESSFUL,
} from "../../../../src/ce/constants/messages";
describe(
"Reconnect Datasource Modal validation while importing application",
@ -48,7 +52,7 @@ describe(
} else {
cy.get(homePageLocators.toastMessage).should(
"contain",
"Application imported successfully",
createMessage(IMPORT_APP_SUCCESSFUL),
);
}
// check datasource configured success modal

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,10 @@
import { ObjectsRegistry } from "../Objects/Registry";
const GITHUB_API_BASE = "https://api.github.com";
//const GITEA_API_BASE = "http://35.154.225.218";
import {
createMessage,
UNABLE_TO_IMPORT_APP,
} from "../../../src/ce/constants/messages";
export class GitSync {
public agHelper = ObjectsRegistry.AggregateHelper;
public locator = ObjectsRegistry.CommonLocators;
@ -321,9 +324,7 @@ export class GitSync {
assertCreateBranch &&
this.assertHelper.AssertNetworkStatus("createBranch", 201);
this.agHelper.AssertElementAbsence(
this.locator._specificToast(
"Unable to import application in workspace",
),
this.locator._specificToast(createMessage(UNABLE_TO_IMPORT_APP)),
);
this.agHelper.WaitUntilEleAppear(this._branchName(branch + uid));
this.agHelper.AssertElementVisibility(this._branchName(branch + uid));

View File

@ -3,6 +3,11 @@ import HomePageLocators from "../../locators/HomePage";
import SignupPageLocators from "../../locators/SignupPage.json";
import { ObjectsRegistry } from "../Objects/Registry";
import { AppSidebar, PageLeftPane } from "./EditorNavigation";
import {
createMessage,
IMPORT_APP_SUCCESSFUL,
UNABLE_TO_IMPORT_APP,
} from "../../../src/ce/constants/messages";
export class HomePage {
private agHelper = ObjectsRegistry.AggregateHelper;
private locator = ObjectsRegistry.CommonLocators;
@ -637,9 +642,11 @@ export class HomePage {
cy.xpath(this._uploadFile).selectFile("cypress/fixtures/" + fixtureJson, {
force: true,
});
this.agHelper.Sleep(3500);
cy.wait("@importNewApplication")
.its("response.statusCode")
.should("eq", 200);
this.agHelper.AssertElementAbsence(
this.locator._specificToast("Unable to import application in workspace"),
this.locator._specificToast(createMessage(UNABLE_TO_IMPORT_APP)),
);
}
@ -731,7 +738,7 @@ export class HomePage {
}
public AssertImportToast(timeout = 5000) {
this.agHelper.AssertContains("Application imported successfully");
this.agHelper.AssertContains(createMessage(IMPORT_APP_SUCCESSFUL));
this.agHelper.Sleep(timeout); //for imported app to settle!
cy.get(this.locator._loading).should("not.exist");
}

View File

@ -8,7 +8,10 @@ require("cypress-file-upload");
import gitSyncLocators from "../locators/gitSyncLocators";
import homePage from "../locators/HomePage";
import { ObjectsRegistry } from "./Objects/Registry";
import {
createMessage,
UNABLE_TO_IMPORT_APP,
} from "../../src/ce/constants/messages";
const gitSync = ObjectsRegistry.GitSync;
const agHelper = ObjectsRegistry.AggregateHelper;
const dataManager = ObjectsRegistry.DataManager;
@ -231,10 +234,7 @@ Cypress.Commands.add("gitDiscardChanges", () => {
cy.contains(Cypress.env("MESSAGES").DISCARDING_AND_PULLING_CHANGES());
cy.validateToastMessage("Discarded changes successfully.");
cy.wait(2000);
assertHelper.AssertContains(
"Unable to import application in workspace",
"not.exist",
);
assertHelper.AssertContains(createMessage(UNABLE_TO_IMPORT_APP), "not.exist");
});
Cypress.Commands.add(

View File

@ -690,6 +690,12 @@ export const JS_ACTION_EXECUTION_ERROR = (jsFunctionName: string) =>
//Editor Page
export const EDITOR_HEADER_SAVE_INDICATOR = () => "Saved";
//Import Application Succesful
export const IMPORT_APP_SUCCESSFUL = () => "Application imported successfully";
//Unable to import application in workspace
export const UNABLE_TO_IMPORT_APP = () =>
"Unable to import application in workspace";
//undo redo
export const WIDGET_REMOVED = (widgetName: string) =>
`${widgetName} is removed`;

View File

@ -61,6 +61,7 @@ import AnalyticsUtil from "@appsmith/utils/AnalyticsUtil";
import {
createMessage,
ERROR_IMPORTING_APPLICATION_TO_WORKSPACE,
IMPORT_APP_SUCCESSFUL,
} from "@appsmith/constants/messages";
import { APP_MODE } from "entities/App";
import type { Workspace } from "@appsmith/constants/workspaceConstants";
@ -122,7 +123,6 @@ import {
import equal from "fast-deep-equal";
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";
import { getIsAnvilLayoutEnabled } from "layoutSystems/anvil/integrations/selectors";
export const getDefaultPageId = (
pages?: ApplicationPagePayload[],
): string | undefined => {
@ -791,7 +791,7 @@ export function* importApplicationSaga(
}
history.push(pageURL);
toast.show("Application imported successfully", {
toast.show(createMessage(IMPORT_APP_SUCCESSFUL), {
kind: "success",
});
}

View File

@ -94,6 +94,7 @@ import {
ERROR_GIT_INVALID_REMOTE,
GIT_USER_UPDATED_SUCCESSFULLY,
PROTECT_BRANCH_SUCCESS,
IMPORT_APP_SUCCESSFUL,
} from "@appsmith/constants/messages";
import type { GitApplicationMetadata } from "@appsmith/api/ApplicationApi";
@ -849,7 +850,7 @@ function* importAppFromGitSaga(action: ConnectToGitReduxAction) {
pageId,
});
history.push(pageURL);
toast.show("Application imported successfully", {
toast.show(createMessage(IMPORT_APP_SUCCESSFUL), {
kind: "success",
});
}