PromucFlow_constructor/app/client/cypress/support/Pages/GSheetHelper.ts

139 lines
3.8 KiB
TypeScript
Raw Normal View History

test: Gsheet Automation (#25255) ## Description - Automated below queries for gsheet 1. Fetch Details 2. Insert one 3. Insert many 4. Update one 5. Update many 6. Fetch many 7. Delete One - Added workflow to schedule run for gsheet automated tests on the hosted instance - Added a new cypress config file which will be used to run the gsheet tests - Added tests for folowing permission/scope options `All access`, `selected access`, `Read/write | All google sheets` and `Read | All google sheets` - Added negative scenarios - Added tests to verify widget binding for both suggested widget and drag n drop widget for both selected and all access permission/scope #### Type of change - Cypress ## Testing > #### How Has This Been Tested? - [x] Cypress > > ## Checklist: #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-26 13:26:24 +00:00
import { ObjectsRegistry } from "../Objects/Registry";
type operation =
| "Insert One"
| "Insert Many"
| "Update One"
| "Update Many"
| "Fetch Details"
| "Fetch Many"
| "Delete One";
export class GsheetHelper {
public agHelper = ObjectsRegistry.AggregateHelper;
public locator = ObjectsRegistry.CommonLocators;
private dataSources = ObjectsRegistry.DataSources;
private entityExplorer = ObjectsRegistry.EntityExplorer;
public AddNewSpreadsheetQuery(
dataSourceName: string,
spreadsheet: string,
rowData: string,
) {
this.entityExplorer.CreateNewDsQuery(dataSourceName);
this.dataSources.ValidateNSelectDropdown(
"Operation",
"Fetch Many",
"Insert One",
);
this.dataSources.ValidateNSelectDropdown(
"Entity",
"Sheet Row(s)",
"Spreadsheet",
);
this.agHelper.EnterValue(spreadsheet, {
propFieldName: "",
directInput: false,
inputFieldName: "Spreadsheet Name",
});
feat: Enable new toolbar for cypress (#37148) ## Description This PR enabled IDE toolbar for cypress. Fixes #37217 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12115693818> > Commit: f2af8705e91af400b3a80f6684cce7fb487f1ca3 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12115693818&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 02 Dec 2024 12:19:38 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new feature flag `release_actions_redesign_enabled` to enhance user experience. - **Bug Fixes** - Updated method calls in various test cases to improve consistency and reliability in interactions, specifically renaming methods related to data sources and queries. - Improved error handling and validation in tests for MongoDB query functionalities. - **Documentation** - Enhanced test coverage and assertions for various functionalities, including API actions, Google Sheets queries, and JavaScript function execution. - **Style** - Updated CSS selectors for improved consistency and maintainability across components and test cases. - **Tests** - Refactored multiple test cases to utilize new helper methods, improving code clarity and reducing direct DOM manipulation. - Enhanced visual tests for JSEditor and improved interaction with the run button. - Added new assertions and enhanced the structure of tests for various components, including API response handling and widget interactions. - Streamlined interaction with the settings toolbar in various test cases by encapsulating functionality within the `PluginActionForm` class. - Introduced new `data-testid` attributes across various components to enhance testability. - **Chores** - Removed unused imports and streamlined method calls for better performance and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-03 03:51:43 +00:00
this.agHelper.RenameQuery("insert_spreadsheet");
test: Gsheet Automation (#25255) ## Description - Automated below queries for gsheet 1. Fetch Details 2. Insert one 3. Insert many 4. Update one 5. Update many 6. Fetch many 7. Delete One - Added workflow to schedule run for gsheet automated tests on the hosted instance - Added a new cypress config file which will be used to run the gsheet tests - Added tests for folowing permission/scope options `All access`, `selected access`, `Read/write | All google sheets` and `Read | All google sheets` - Added negative scenarios - Added tests to verify widget binding for both suggested widget and drag n drop widget for both selected and all access permission/scope #### Type of change - Cypress ## Testing > #### How Has This Been Tested? - [x] Cypress > > ## Checklist: #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-26 13:26:24 +00:00
this.agHelper.EnterValue(rowData, {
propFieldName: "",
directInput: false,
inputFieldName: "Row object(s)",
});
this.dataSources.RunQuery();
}
public DeleteSpreadsheetQuery(dataSourceName: string, spreadsheet: string) {
this.entityExplorer.CreateNewDsQuery(dataSourceName);
this.dataSources.ValidateNSelectDropdown(
"Operation",
"Fetch Many",
"Delete One",
);
this.dataSources.ValidateNSelectDropdown(
"Entity",
"Sheet Row(s)",
"Spreadsheet",
);
this.dataSources.ValidateNSelectDropdown("Spreadsheet", "", spreadsheet);
feat: Enable new toolbar for cypress (#37148) ## Description This PR enabled IDE toolbar for cypress. Fixes #37217 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12115693818> > Commit: f2af8705e91af400b3a80f6684cce7fb487f1ca3 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12115693818&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 02 Dec 2024 12:19:38 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new feature flag `release_actions_redesign_enabled` to enhance user experience. - **Bug Fixes** - Updated method calls in various test cases to improve consistency and reliability in interactions, specifically renaming methods related to data sources and queries. - Improved error handling and validation in tests for MongoDB query functionalities. - **Documentation** - Enhanced test coverage and assertions for various functionalities, including API actions, Google Sheets queries, and JavaScript function execution. - **Style** - Updated CSS selectors for improved consistency and maintainability across components and test cases. - **Tests** - Refactored multiple test cases to utilize new helper methods, improving code clarity and reducing direct DOM manipulation. - Enhanced visual tests for JSEditor and improved interaction with the run button. - Added new assertions and enhanced the structure of tests for various components, including API response handling and widget interactions. - Streamlined interaction with the settings toolbar in various test cases by encapsulating functionality within the `PluginActionForm` class. - Introduced new `data-testid` attributes across various components to enhance testability. - **Chores** - Removed unused imports and streamlined method calls for better performance and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-03 03:51:43 +00:00
this.agHelper.RenameQuery("delete_spreadsheet");
test: Gsheet Automation (#25255) ## Description - Automated below queries for gsheet 1. Fetch Details 2. Insert one 3. Insert many 4. Update one 5. Update many 6. Fetch many 7. Delete One - Added workflow to schedule run for gsheet automated tests on the hosted instance - Added a new cypress config file which will be used to run the gsheet tests - Added tests for folowing permission/scope options `All access`, `selected access`, `Read/write | All google sheets` and `Read | All google sheets` - Added negative scenarios - Added tests to verify widget binding for both suggested widget and drag n drop widget for both selected and all access permission/scope #### Type of change - Cypress ## Testing > #### How Has This Been Tested? - [x] Cypress > > ## Checklist: #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-26 13:26:24 +00:00
this.dataSources.RunQuery();
}
public AddInsertOrUpdateQuery(
operation: operation,
dataSourceName: string,
spreadSheet: string,
rowData: string,
executeQuery = true,
sheetName = "Sheet1",
headRowIndex = "1",
) {
this.EnterBasicQueryValues(
operation,
dataSourceName,
spreadSheet,
true,
"Sheet Row(s)",
sheetName,
headRowIndex,
);
let inputField = "";
if (operation.includes("Insert")) {
inputField = operation == "Insert One" ? "Row object" : "Row object(s)";
} else if (operation.includes("Update")) {
inputField =
operation == "Update One"
? "Update row object"
: "Update row object(s)";
}
this.agHelper.EnterValue(rowData, {
propFieldName: "",
directInput: false,
inputFieldName: inputField,
});
if (executeQuery) this.dataSources.RunQuery();
}
public EnterBasicQueryValues(
operation: operation,
dataSourceName: string,
spreadSheet: string,
renameQuery = true,
entity = "Sheet Row(s)",
sheetName = "Sheet1",
headRowIndex = "1",
) {
this.entityExplorer.CreateNewDsQuery(dataSourceName);
this.dataSources.ValidateNSelectDropdown(
"Operation",
"Fetch Many",
operation,
);
this.dataSources.ValidateNSelectDropdown("Entity", "Sheet Row(s)", entity);
this.agHelper.Sleep(500);
this.dataSources.ValidateNSelectDropdown("Spreadsheet", "", spreadSheet);
if (!entity.includes("Spreadsheet")) {
this.dataSources.ValidateNSelectDropdown("Sheet name", "", sheetName);
this.agHelper.EnterValue(headRowIndex, {
propFieldName: "",
directInput: false,
inputFieldName: "Table heading row index",
});
}
if (renameQuery) {
feat: Enable new toolbar for cypress (#37148) ## Description This PR enabled IDE toolbar for cypress. Fixes #37217 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/12115693818> > Commit: f2af8705e91af400b3a80f6684cce7fb487f1ca3 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12115693818&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 02 Dec 2024 12:19:38 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new feature flag `release_actions_redesign_enabled` to enhance user experience. - **Bug Fixes** - Updated method calls in various test cases to improve consistency and reliability in interactions, specifically renaming methods related to data sources and queries. - Improved error handling and validation in tests for MongoDB query functionalities. - **Documentation** - Enhanced test coverage and assertions for various functionalities, including API actions, Google Sheets queries, and JavaScript function execution. - **Style** - Updated CSS selectors for improved consistency and maintainability across components and test cases. - **Tests** - Refactored multiple test cases to utilize new helper methods, improving code clarity and reducing direct DOM manipulation. - Enhanced visual tests for JSEditor and improved interaction with the run button. - Added new assertions and enhanced the structure of tests for various components, including API response handling and widget interactions. - Streamlined interaction with the settings toolbar in various test cases by encapsulating functionality within the `PluginActionForm` class. - Introduced new `data-testid` attributes across various components to enhance testability. - **Chores** - Removed unused imports and streamlined method calls for better performance and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-12-03 03:51:43 +00:00
this.agHelper.RenameQuery(
test: Gsheet Automation (#25255) ## Description - Automated below queries for gsheet 1. Fetch Details 2. Insert one 3. Insert many 4. Update one 5. Update many 6. Fetch many 7. Delete One - Added workflow to schedule run for gsheet automated tests on the hosted instance - Added a new cypress config file which will be used to run the gsheet tests - Added tests for folowing permission/scope options `All access`, `selected access`, `Read/write | All google sheets` and `Read | All google sheets` - Added negative scenarios - Added tests to verify widget binding for both suggested widget and drag n drop widget for both selected and all access permission/scope #### Type of change - Cypress ## Testing > #### How Has This Been Tested? - [x] Cypress > > ## Checklist: #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-26 13:26:24 +00:00
operation.toLowerCase().replace(" ", "_") + "_query",
);
}
}
public SelectMultiDropDownValue(ddName: string, option: string) {
this.agHelper.GetNClick(this.dataSources._multiSelectDropdown(ddName));
this.agHelper.GetNClickByContains(this.dataSources._dropdownOption, option);
}
}