Skip to content

Commit

Permalink
Map Chart Automation
Browse files Browse the repository at this point in the history
  • Loading branch information
Saroj committed Oct 31, 2023
1 parent 7e14f87 commit 0abd501
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 173 deletions.
47 changes: 27 additions & 20 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ jobs:
specs_to_run=${specs_to_run#,}
echo "specs_to_run=$specs_to_run" >> $GITHUB_ENV
# In case of run-id provided download the artifact from the previous run
- name: Download Docker image artifact
if: inputs.previous-workflow-run-id != 0
uses: dawidd6/action-download-artifact@v2
with:
name: cicontainer
run_id: ${{ inputs.previous-workflow-run-id }}

# In case of run-id is 0 download the artifact from the current run
- name: Download Docker image artifact
if: inputs.previous-workflow-run-id == 0
uses: actions/download-artifact@v3
with:
name: cicontainer

- name: Load Docker image from tar file
run: |
gunzip cicontainer.tar.gz
docker load -i cicontainer.tar
# # In case of run-id provided download the artifact from the previous run
# - name: Download Docker image artifact
# if: inputs.previous-workflow-run-id != 0
# uses: dawidd6/action-download-artifact@v2
# with:
# name: cicontainer
# run_id: ${{ inputs.previous-workflow-run-id }}

# # In case of run-id is 0 download the artifact from the current run
# - name: Download Docker image artifact
# if: inputs.previous-workflow-run-id == 0
# uses: actions/download-artifact@v3
# with:
# name: cicontainer

# - name: Load Docker image from tar file
# run: |
# gunzip cicontainer.tar.gz
# docker load -i cicontainer.tar

- name: Create folder
if: steps.run_result.outputs.run_result != 'success'
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
-e APPSMITH_INTERCOM_APP_ID=DUMMY_VALUE \
-e APPSMITH_CLOUD_SERVICES_BASE_URL=http://host.docker.internal:5001 \
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
cicontainer
appsmith/appsmith-ce:release
- name: Use Node.js
uses: actions/setup-node@v3
Expand Down Expand Up @@ -373,6 +373,13 @@ jobs:
with:
name: cypress-console-logs
path: ${{ github.workspace }}/app/client/cypress/cypress-logs

- name: Upload cypress snapshots
if: always()
uses: actions/upload-artifact@v3
with:
name: snapshots
path: ${{ github.workspace }}/app/client/cypress/snapshots

- name: Collect CI container logs
if: failure()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
/// <reference types="Cypress" />
const viewWidgetsPage = require("../../../../../locators/ViewWidgets.json");
import * as _ from "../../../../../support/Objects/ObjectsCore";
import {
agHelper,
entityExplorer,
propPane,
draggableWidgets,
deployMode,
locators,
} from "../../../../../support/Objects/ObjectsCore";

const _mapChartCaption = "g[class*='-caption'] text";
const _mapChartPlot = (text: string) => "//text()[contains(., '"+ text +"')]/.."

describe("Map Chart Widget Functionality", function () {

it("1. Drag and drop a Map Chart widget and verify", function () {
entityExplorer.DragDropWidgetNVerify(draggableWidgets.MAPCHART, 200, 200);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapchartsimple");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});

it("2.1 Update the Map type to different types and verify - part1", function () {

// Change the map type to World with Antarctica and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "World with Antarctica");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 7);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithantarctica");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to World and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "World");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 6);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithworld");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to Europe and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "Europe");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 47);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwitheurope");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to North America and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "North America");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 26);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithnorthamerica");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to South America and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "South America");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 16);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithsouthamerica");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});

it("2.2 Update the Map type to different types and verify - part2", function () {

// Change the map type to Oceania and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "Oceania");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 15);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithoceania");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to Africa and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "Africa");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 56);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithafrica");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to USA and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "USA");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 51);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithusa");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change the map type to Asia and verify the number of entities
propPane.SelectPropertiesDropDown("Map type", "Asia");
agHelper.AssertElementLength(viewWidgetsPage.mapChartEntityLabels, 49);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithasia");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});

it("3. Update the Chart data and verify", function () {
const data =[
{
"id": "014",
"value": "2"
}
];

propPane.TypeTextIntoField("Chart data", JSON.stringify(data));
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithcustomdata");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});

it("4. Verify General settings", function () {
// update the title and verify
propPane.TypeTextIntoField("Title", "App Sign Up");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.AssertText(_mapChartCaption, "text", "App Sign Up");
agHelper.VerifySnapshot(locators._root, "mapwithcustomtitle");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// update the visibility using toggle and verify
propPane.TogglePropertyState("Visible", "Off");
deployMode.DeployApp();
agHelper.AssertElementAbsence(
locators._widgetInDeployed(draggableWidgets.MAPCHART),
);
agHelper.VerifySnapshot(locators._root, "mapwithvisibilityoff");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// update the visibility using JS and verify
propPane.EnterJSContext("Visible", "true");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.AssertElementVisibility(
locators._widgetInDeployed(draggableWidgets.MAPCHART),
);
agHelper.VerifySnapshot(locators._root, "mapwithvisibilityon");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// update the show labels using toggle and verify
propPane.TogglePropertyState("Show Labels", "Off");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithshowlabelsoff");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// update the visibility using JS and verify
propPane.EnterJSContext("Show Labels", "true");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapwithshowlableson");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});


it("5. Update onDataPointClick and Verify", function () {
// Create the Alert Modal and verify Modal name
propPane.SelectPropertiesDropDown("Map type", "Asia");
propPane.SelectPlatformFunction("onDataPointClick", "Show alert");
agHelper.TypeText(
propPane._actionSelectorFieldByLabel("Message"),
"Data Point {{MapChart1.selectedDataPoint.label}} Clicked",
);
agHelper.GetNClick(propPane._actionSelectorPopupClose);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.GetNClick(_mapChartPlot('RU'), 0, true);
agHelper.ValidateToastMessage("Data Point Russian Federation Clicked");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Convert the onDataPointClick to JS, update and verify
propPane.EnterJSContext("onDataPointClick", "{{showAlert('Converted to Js and clicked '+ MapChart1.selectedDataPoint.label)}}");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.GetNClick(_mapChartPlot('CN'), 0, true);
agHelper.ValidateToastMessage("Converted to Js and clicked China");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");
});

it("6. Verify the style changes", function () {
// Change Color Range and verify
const colorRange = [
{
"minValue": 2,
"maxValue": 3,
"code": "#FFFFF"
}
];
propPane.MoveToTab("Style");
propPane.TypeTextIntoField("Color Range", JSON.stringify(colorRange));
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapChartWithColorRange");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change border radius and verify
propPane.MoveToTab("Style");
propPane.EnterJSContext("Border radius", "1.5rem");
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapChartWithBorderRadius");
deployMode.NavigateBacktoEditor();
entityExplorer.SelectEntityByName("MapChart1", "Widgets");

// Change box shadow and verify
const boxShadow =
"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)";
propPane.MoveToTab("Style");
propPane.EnterJSContext("Box shadow", boxShadow);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.MAPCHART));
agHelper.VerifySnapshot(locators._root, "mapChartWithBoxShadow");
deployMode.NavigateBacktoEditor();
});
});
Loading

0 comments on commit 0abd501

Please sign in to comment.