Skip to content

Commit

Permalink
test:PartialExport_Widgets spec file updated and import app method up…
Browse files Browse the repository at this point in the history
…dated with validations (#33343)

RCA:
PartialExport_Widgets_spec.ts was failing where we export and compare
files.

Solution:

- Updated the WidgetsExportedOnly.json, now the comparison step is
working as expected
- Improved the assertions within importApp() reduced wait time and
waiting for import modal to close as a check.
- Also updated tags which used importApp() below are the list of files
[AppNavigation_spec.ts,Sidebar_spec.ts,TopStacked_spec.ts,TopInline_spec.ts,Editor_Segment_Context_Switching_spec.ts,JSOnLoad2_Spec.ts]
- Reverted the intercept success check within ImportApp()
- Updated PartialExport_Widgets_spec.ts with network call assertion post
import

/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/9028944129>
> Commit: b9ad3c9
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9028944129&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->
  • Loading branch information
NandanAnantharamu committed May 10, 2024
1 parent 9ade3d6 commit 7135aca
Show file tree
Hide file tree
Showing 18 changed files with 234 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -36,7 +40,7 @@ describe(
} else {
cy.get(homePageLocatores.toastMessage).should(
"contain",
"Application imported successfully",
createMessage(IMPORT_APP_SUCCESSFUL),
);
}
agHelper.GenerateUUID();
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PageList from "../../../../support/Pages/PageList";

describe(
"General checks for app navigation",
{ tags: ["@tag.IDE"] },
{ tags: ["@tag.IDE", "@tag.ImportExport"] },
function () {
it("1. App header should appear when there is a single page in the application, and navigation should appear alongside app header when there are two pages", () => {
// App header should appear when there is a single page in the application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,88 +11,98 @@ import {
AppSidebarButton,
} from "../../../../support/Pages/EditorNavigation";

describe("Test Sidebar navigation style", { tags: ["@tag.IDE"] }, function () {
before(() => {
// Import an application
homePage.NavigateToHome();
agHelper.RefreshPage();
homePage.ImportApp("appNavigationTestingAppWithLongPageNamesAndTitle.json");
assertHelper
.WaitForNetworkCall("@importNewApplication")
.then((response) => {
const { isPartialImport } = response.body.data;
if (isPartialImport) {
homePage.AssertNCloseImport();
} else {
homePage.AssertImportToast();
}
});
});
describe(
"Test Sidebar navigation style",
{ tags: ["@tag.IDE", "@tag.ImportExport"] },
function () {
before(() => {
// Import an application
homePage.NavigateToHome();
agHelper.RefreshPage();
homePage.ImportApp(
"appNavigationTestingAppWithLongPageNamesAndTitle.json",
);
assertHelper
.WaitForNetworkCall("@importNewApplication")
.then((response) => {
const { isPartialImport } = response.body.data;
if (isPartialImport) {
homePage.AssertNCloseImport();
} else {
homePage.AssertImportToast();
}
});
});

it("1. Change 'Orientation' to 'Side', sidebar should appear", () => {
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._navigationSettingsTab);
agHelper.GetNClick(
appSettings.locators._navigationSettings._orientationOptions._side,
0,
true,
);
deployMode.DeployApp();
agHelper.AssertElementVisibility(appSettings.locators._sideNavbar);
agHelper.AssertElementAbsence(appSettings.locators._topStacked);
agHelper.AssertElementAbsence(appSettings.locators._topInline);
//Page change should work
const pageName = "Page5 - with long long name";
agHelper.GetNClickByContains(
appSettings.locators._navigationMenuItem,
pageName,
0,
true,
);
agHelper.AssertElementVisibility(
appSettings.locators._getActivePage(pageName),
);
});
it("1. Change 'Orientation' to 'Side', sidebar should appear", () => {
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._navigationSettingsTab);
agHelper.GetNClick(
appSettings.locators._navigationSettings._orientationOptions._side,
0,
true,
);
deployMode.DeployApp();
agHelper.AssertElementVisibility(appSettings.locators._sideNavbar);
agHelper.AssertElementAbsence(appSettings.locators._topStacked);
agHelper.AssertElementAbsence(appSettings.locators._topInline);
//Page change should work
const pageName = "Page5 - with long long name";
agHelper.GetNClickByContains(
appSettings.locators._navigationMenuItem,
pageName,
0,
true,
);
agHelper.AssertElementVisibility(
appSettings.locators._getActivePage(pageName),
);
});

it("2. Sidebar background should be default to white, and should change when background color is set to theme", () => {
// The background of sidebar should be white since light color style is default
agHelper.AssertCSS(
appSettings.locators._sideNavbar,
"background-color",
"rgb(255, 255, 255)",
0,
);
// Changing color style to theme should change navigation's background color
deployMode.NavigateBacktoEditor();
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._navigationSettingsTab);
agHelper.GetNClick(appSettings.locators._colorStyleOptions._theme, 0, true);
deployMode.DeployApp();
agHelper.AssertCSS(
appSettings.locators._sideNavbar,
"background-color",
"rgb(85, 61, 233)",
0,
);
//Application name, share button, edit button, and user dropdown should be available in the app sidebar
agHelper.AssertElementVisibility(appSettings.locators._applicationName);
agHelper.AssertElementVisibility(appSettings.locators._shareButton);
agHelper.AssertElementVisibility(locators._backToEditor);
agHelper.AssertElementVisibility(homePage._profileMenu);
});
it("2. Sidebar background should be default to white, and should change when background color is set to theme", () => {
// The background of sidebar should be white since light color style is default
agHelper.AssertCSS(
appSettings.locators._sideNavbar,
"background-color",
"rgb(255, 255, 255)",
0,
);
// Changing color style to theme should change navigation's background color
deployMode.NavigateBacktoEditor();
AppSidebar.navigate(AppSidebarButton.Settings);
agHelper.GetNClick(appSettings.locators._navigationSettingsTab);
agHelper.GetNClick(
appSettings.locators._colorStyleOptions._theme,
0,
true,
);
deployMode.DeployApp();
agHelper.AssertCSS(
appSettings.locators._sideNavbar,
"background-color",
"rgb(85, 61, 233)",
0,
);
//Application name, share button, edit button, and user dropdown should be available in the app sidebar
agHelper.AssertElementVisibility(appSettings.locators._applicationName);
agHelper.AssertElementVisibility(appSettings.locators._shareButton);
agHelper.AssertElementVisibility(locators._backToEditor);
agHelper.AssertElementVisibility(homePage._profileMenu);
});

it("3. Share button should open the share modal, edit button should take us back to the editor, and clicking on user profile button should open up the dropdown menu", () => {
// Share
agHelper.GetNClick(
`${appSettings.locators._sideNavbar} ${appSettings.locators._shareButton}`,
);
agHelper.WaitUntilEleAppear(appSettings.locators._modal);
agHelper.AssertElementVisibility(appSettings.locators._modal);
agHelper.GetNClick(appSettings.locators._modalClose, 0, true);
// User profile dropdown
agHelper.GetNClick(homePage._profileMenu);
agHelper.AssertElementVisibility(
appSettings.locators._userProfileDropdownMenu,
);
});
});
it("3. Share button should open the share modal, edit button should take us back to the editor, and clicking on user profile button should open up the dropdown menu", () => {
// Share
agHelper.GetNClick(
`${appSettings.locators._sideNavbar} ${appSettings.locators._shareButton}`,
);
agHelper.WaitUntilEleAppear(appSettings.locators._modal);
agHelper.AssertElementVisibility(appSettings.locators._modal);
agHelper.GetNClick(appSettings.locators._modalClose, 0, true);
// User profile dropdown
agHelper.GetNClick(homePage._profileMenu);
agHelper.AssertElementVisibility(
appSettings.locators._userProfileDropdownMenu,
);
});
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

describe(
"Test Top + Inline navigation style",
{ tags: ["@tag.IDE"] },
{ tags: ["@tag.IDE", "@tag.ImportExport"] },
function () {
before(() => {
// Import an application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

describe(
"Test Top + Stacked navigation style",
{ tags: ["@tag.IDE"] },
{ tags: ["@tag.IDE", "@tag.ImportExport"] },
function () {
before(() => {
// Import an application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 7135aca

Please sign in to comment.