test: mysql datatypes cypress test cases (#16696)
* test: mysql datatypes cypress test cases * test: cypress added comments with cleaner code * updates w.r.t review comments * fix 10th cases failure * fix for test failing on CI * fix for test failing on CI another way * fix: address review comments
This commit is contained in:
parent
88637de7aa
commit
2b70914f31
4916
app/client/cypress/fixtures/Datatypes/mySQLdsl.json
Normal file
4916
app/client/cypress/fixtures/Datatypes/mySQLdsl.json
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,148 @@
|
|||
import { ObjectsRegistry } from "../../../../support/Objects/Registry";
|
||||
import inputData from "../../../../support/Objects/mySqlData";
|
||||
|
||||
let dsName: any, query: string;
|
||||
const agHelper = ObjectsRegistry.AggregateHelper,
|
||||
ee = ObjectsRegistry.EntityExplorer,
|
||||
dataSources = ObjectsRegistry.DataSources,
|
||||
propPane = ObjectsRegistry.PropertyPane,
|
||||
table = ObjectsRegistry.Table,
|
||||
locator = ObjectsRegistry.CommonLocators,
|
||||
deployMode = ObjectsRegistry.DeployMode;
|
||||
|
||||
describe("MySQL Datatype tests", function() {
|
||||
before(() => {
|
||||
cy.fixture("Datatypes/mySQLdsl").then((val: any) => {
|
||||
agHelper.AddDsl(val);
|
||||
});
|
||||
propPane.ChangeTheme("Moon");
|
||||
});
|
||||
|
||||
it("1. Create Mysql DS", function() {
|
||||
dataSources.CreateDataSource("MySql");
|
||||
cy.get("@dsName").then(($dsName) => {
|
||||
dsName = $dsName;
|
||||
});
|
||||
});
|
||||
|
||||
it("2. Creating mysqlDTs table", () => {
|
||||
//IF NOT EXISTS can be used - which creates tabel if it does not exist and donot throw any error if table exists.
|
||||
//But if we add this option then next case could fail inn that case.
|
||||
query = inputData.query.createTable;
|
||||
ee.CreateNewDsQuery(dsName);
|
||||
agHelper.RenameWithInPane("createTable");
|
||||
agHelper.GetNClick(dataSources._templateMenu);
|
||||
dataSources.EnterQuery(query);
|
||||
dataSources.RunQuery();
|
||||
|
||||
ee.ActionContextMenuByEntityName(dsName, "Refresh");
|
||||
agHelper.AssertElementVisible(ee._entityNameInExplorer(inputData.tableName));
|
||||
});
|
||||
|
||||
it("3. Creating SELECT query", () => {
|
||||
ee.ActionTemplateMenuByEntityName(inputData.tableName, "SELECT");
|
||||
agHelper.RenameWithInPane("selectRecords");
|
||||
dataSources.RunQuery();
|
||||
agHelper
|
||||
.GetText(dataSources._noRecordFound)
|
||||
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
|
||||
});
|
||||
|
||||
it("4. Creating all queries", () => {
|
||||
query = inputData.query.insertRecord;
|
||||
ee.ActionTemplateMenuByEntityName(inputData.tableName, "INSERT");
|
||||
agHelper.RenameWithInPane("insertRecord");
|
||||
dataSources.EnterQuery(query);
|
||||
|
||||
query = inputData.query.deleteAllRecords;
|
||||
ee.ActionTemplateMenuByEntityName(inputData.tableName, "DELETE");
|
||||
agHelper.RenameWithInPane("deleteAllRecords");
|
||||
dataSources.EnterQuery(query);
|
||||
|
||||
query = inputData.query.dropTable;
|
||||
ee.ActionTemplateMenuByEntityName(inputData.tableName, "DELETE");
|
||||
agHelper.RenameWithInPane("dropTable");
|
||||
dataSources.EnterQuery(query);
|
||||
});
|
||||
|
||||
//Insert false values to each column and check for the error status of the request.
|
||||
it("5. False Cases", () => {
|
||||
ee.ActionTemplateMenuByEntityName(inputData.tableName, "INSERT");
|
||||
agHelper.RenameWithInPane("falseCases");
|
||||
inputData.falseResult.forEach((res_array, i) => {
|
||||
res_array.forEach((value) => {
|
||||
query = `INSERT INTO ${inputData.tableName} (${inputData.inputFieldName[i]}) VALUES (${value})`;
|
||||
dataSources.EnterQuery(query);
|
||||
dataSources.RunQuery(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//Insert valid/true values into datasource
|
||||
it("6. Inserting record", () => {
|
||||
ee.SelectEntityByName("Page1");
|
||||
deployMode.DeployApp();
|
||||
table.WaitForTableEmpty(); //asserting table is empty before inserting!
|
||||
agHelper.ClickButton("Run InsertQuery");
|
||||
inputData.input.forEach((valueArr, i) => {
|
||||
agHelper.ClickButton("Run InsertQuery");
|
||||
valueArr.forEach((value, index) => {
|
||||
agHelper.EnterInputText(inputData.inputFieldName[index], value);
|
||||
});
|
||||
i % 2 && agHelper.ToggleSwitch("Bool_column");
|
||||
agHelper.ClickButton("insertRecord");
|
||||
agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery"));
|
||||
agHelper.Sleep(2000);
|
||||
});
|
||||
});
|
||||
|
||||
//Verify weather expected value is present in each cell
|
||||
//i.e. weather right data is pushed and fetched from datasource.
|
||||
it("7. Validating values in each cell", () => {
|
||||
cy.wait(2000);
|
||||
inputData.result.forEach((res_array, i) => {
|
||||
res_array.forEach((value, j) => {
|
||||
table.ReadTableRowColumnData(j, i, 0).then(($cellData) => {
|
||||
expect($cellData).to.eq(value);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("8. Deleting all records from table ", () => {
|
||||
agHelper.GetNClick(locator._deleteIcon);
|
||||
agHelper.Sleep(2000);
|
||||
table.WaitForTableEmpty();
|
||||
});
|
||||
|
||||
it("9. Validate Drop of the Newly Created - mysqlDTs - Table from MySQL datasource", () => {
|
||||
deployMode.NavigateBacktoEditor();
|
||||
ee.ExpandCollapseEntity("Queries/JS");
|
||||
ee.SelectEntityByName("dropTable");
|
||||
dataSources.RunQuery();
|
||||
dataSources.ReadQueryTableResponse(0).then(($cellData) => {
|
||||
expect($cellData).to.eq("0"); //Success response for dropped table!
|
||||
});
|
||||
ee.ExpandCollapseEntity("Queries/JS", false);
|
||||
ee.ExpandCollapseEntity("Datasources");
|
||||
ee.ExpandCollapseEntity(dsName);
|
||||
ee.ActionContextMenuByEntityName(dsName, "Refresh");
|
||||
agHelper.AssertElementAbsence(
|
||||
ee._entityNameInExplorer(inputData.tableName),
|
||||
);
|
||||
ee.ExpandCollapseEntity(dsName, false);
|
||||
ee.ExpandCollapseEntity("Datasources", false);
|
||||
});
|
||||
|
||||
it("10. Verify Deletion of the datasource after all created queries are Deleted", () => {
|
||||
dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists
|
||||
ee.ExpandCollapseEntity("Queries/JS");
|
||||
["falseCases", "createTable", "deleteAllRecords", "dropTable", "insertRecord", "selectRecords"].forEach(type => {
|
||||
ee.ActionContextMenuByEntityName(type, "Delete", "Are you sure?");
|
||||
})
|
||||
deployMode.DeployApp();
|
||||
deployMode.NavigateBacktoEditor();
|
||||
ee.ExpandCollapseEntity("Queries/JS");
|
||||
dataSources.DeleteDatasouceFromWinthinDS(dsName, 200);
|
||||
});
|
||||
});
|
||||
245
app/client/cypress/support/Objects/mySqlData.ts
Normal file
245
app/client/cypress/support/Objects/mySqlData.ts
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
const mySqlData = {
|
||||
tableName: "mysqlDTs",
|
||||
inputFieldName : [
|
||||
"Stinyint_column",
|
||||
"Utinyint_column",
|
||||
"Ssmallint_column",
|
||||
"Usmallint_column",
|
||||
"Smediumint_column",
|
||||
"Umediumint_column",
|
||||
"Sint_column",
|
||||
"Uint_column",
|
||||
"Bigint_column",
|
||||
"Float_column",
|
||||
"Double_column",
|
||||
"Decimal_column",
|
||||
"Datetime_column",
|
||||
"Timestamp_column",
|
||||
"Date_column",
|
||||
"Time_column",
|
||||
"Year_column",
|
||||
"Varchar_column",
|
||||
"Char_column",
|
||||
"Enum_column",
|
||||
"Json_column",
|
||||
],
|
||||
input : [
|
||||
[
|
||||
"-128",
|
||||
"0",
|
||||
"-32768",
|
||||
"0",
|
||||
"-8388608",
|
||||
"0",
|
||||
"-2147483648",
|
||||
"0",
|
||||
"123456",
|
||||
"123.45",
|
||||
"123.45",
|
||||
"123.45",
|
||||
"2012-12-31 11:30:45",
|
||||
"2012/12/31 11:30:45",
|
||||
"20121231",
|
||||
"838:59:59",
|
||||
"1901",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
'{"abc": "123"}',
|
||||
],
|
||||
[
|
||||
"0",
|
||||
"255",
|
||||
"0",
|
||||
"65535",
|
||||
"0",
|
||||
"16777215",
|
||||
"0",
|
||||
"4294967295",
|
||||
"456789",
|
||||
"123.456",
|
||||
"123.456",
|
||||
"123.456",
|
||||
"2012-12-31 11:30:45",
|
||||
"2012/12/31 11:30:45",
|
||||
"2012-12-31",
|
||||
"0:00:00",
|
||||
"2155",
|
||||
"abcdefghijklmnopqrst",
|
||||
"abcdefghij",
|
||||
"b",
|
||||
"{}",
|
||||
],
|
||||
[
|
||||
"127",
|
||||
"0",
|
||||
"32767",
|
||||
"0",
|
||||
"8388607",
|
||||
"0",
|
||||
"2147483647",
|
||||
"0",
|
||||
"123456789",
|
||||
"123.451",
|
||||
"123.451",
|
||||
"123.451",
|
||||
"2012/12/31 11:30:45",
|
||||
"20121231113045",
|
||||
"2012/12/31",
|
||||
"-838:59:59",
|
||||
"1901'",
|
||||
"null",
|
||||
"null",
|
||||
"c",
|
||||
"[1, 2, 3, 4]",
|
||||
],
|
||||
[
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"20121231113045",
|
||||
"121231113045",
|
||||
"121231",
|
||||
"11:12",
|
||||
"2155",
|
||||
"null",
|
||||
"null",
|
||||
"c",
|
||||
"[]",
|
||||
],
|
||||
[
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"null",
|
||||
"121231113045",
|
||||
"null",
|
||||
"null",
|
||||
"1112",
|
||||
"null",
|
||||
"null",
|
||||
"null",
|
||||
"c",
|
||||
'["a",true,0,12.34]',
|
||||
],
|
||||
[
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"null",
|
||||
"null",
|
||||
"null",
|
||||
"null",
|
||||
"12",
|
||||
"null",
|
||||
"null",
|
||||
"null",
|
||||
"c",
|
||||
"null",
|
||||
],
|
||||
],
|
||||
falseResult : [
|
||||
[-129, 128],
|
||||
[-1, 256],
|
||||
[-32769, 32768],
|
||||
[-1, 65536],
|
||||
[-8388609, 8388608],
|
||||
[-1, 16777216],
|
||||
[-2147483649, 2147483648],
|
||||
[-1, 4294967296],
|
||||
[-9223372036854775808, 9223372036854775807],
|
||||
[123456789.45],
|
||||
['a'],
|
||||
[123456789.45],
|
||||
["2012/12/31 11:30:451"],
|
||||
["2012/12/311 11:30:45"],
|
||||
["2012-123-31"],
|
||||
["22:591:59"],
|
||||
["190123"],
|
||||
["abcdefghijklmnopqrstu"],
|
||||
["abcdefghijk"],
|
||||
["d"],
|
||||
["abc", "{", "["],
|
||||
],
|
||||
result : [
|
||||
["1", "2", "3", "4", "5"],
|
||||
["-128", "0", "127"],
|
||||
["0", "255"],
|
||||
["-32768", "0", "32767"],
|
||||
["0", "65535"],
|
||||
["-8388608", "0", "8388607"],
|
||||
["0", "16777215"],
|
||||
["-2147483648", "0", "2147483647"],
|
||||
["0", "4294967295"],
|
||||
["123456", "456789", "123456789"],
|
||||
["123.45", "123.46", "123.45"],
|
||||
["123.45", "123.456", "123.451"],
|
||||
["123.45", "123.46", "123.45"],
|
||||
[
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
],
|
||||
[
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
"2012-12-31T11:30:45Z",
|
||||
],
|
||||
["2012-12-31", "2012-12-31", "2012-12-31", "2012-12-31"],
|
||||
["22:59:59", "00:00:00", "01:00:01", "11:12:00", "00:11:12", "00:00:12"],
|
||||
["1901", "2155", "1901", "2155"],
|
||||
["a", "abcdefghijklmnopqrst"],
|
||||
["a", "abcdefghij"],
|
||||
["a", "b", "c"],
|
||||
["0", "1"],
|
||||
['{"abc": "123"}', "{}", "[1, 2, 3, 4]", "", '["a",true,0,12.34]'],
|
||||
],
|
||||
query :{
|
||||
createTable : `CREATE TABLE mysqlDTs (serialId SERIAL not null primary key, stinyint_column TINYINT, utinyint_column TINYINT UNSIGNED,
|
||||
ssmallint_column SMALLINT, usmallint_column SMALLINT UNSIGNED, smediumint_column MEDIUMINT, umediumint_column MEDIUMINT UNSIGNED,
|
||||
sint_column INT, uint_column INT UNSIGNED, bigint_column BIGINT, float_column FLOAT( 10, 2 ), double_column DOUBLE, decimal_column DECIMAL( 10, 2 ),
|
||||
datetime_column DATETIME, timestamp_column TIMESTAMP, date_column DATE, time_column TIME, year_column YEAR, varchar_column VARCHAR( 20 ),
|
||||
char_column CHAR( 10 ), enum_column ENUM( 'a', 'b', 'c' ), bool_column BOOL, json_column JSON);`,
|
||||
insertRecord : `INSERT INTO mysqlDTs (stinyint_column, utinyint_column, ssmallint_column, usmallint_column, smediumint_column, umediumint_column,
|
||||
sint_column, uint_column, bigint_column, float_column, double_column, decimal_column, datetime_column, timestamp_column,
|
||||
date_column, time_column, year_column, varchar_column, char_column, enum_column, bool_column, json_column )
|
||||
VALUES
|
||||
({{InsertStinyint.text}}, {{InsertUtinyint.text}}, {{InsertSsmallint.text}}, {{InsertUsmallint.text}}, {{InsertSmediumint.text}},
|
||||
{{InsertUmediumint.text}}, {{InsertSint.text}}, {{InsertUint.text}}, {{InsertBigint.text}}, {{InsertFloat.text}}, {{InsertDouble.text}},
|
||||
{{InsertDecimal.text}}, {{InsertDatetime.text}}, {{InsertTimestamp.text}}, {{InsertDate.text}}, {{InsertTime.text}},
|
||||
{{InsertYear.text}}, {{InsertVarchar.text}}, {{InsertChar.text}}, {{InsertEnum.text}}, {{InsertBoolean.isSwitchedOn}}, {{InputJson.text}});`,
|
||||
deleteRecord : `DELETE FROM mysqlDTs WHERE serialId ={{Table1.selectedRow.serialid}}`,
|
||||
deleteAllRecords : `DELETE FROM mysqlDTs`,
|
||||
dropTable: `drop table mysqlDTs`,
|
||||
}
|
||||
};
|
||||
|
||||
export default mySqlData;
|
||||
|
|
@ -697,7 +697,7 @@ export class AggregateHelper {
|
|||
toClear && this.ClearInputText(name);
|
||||
cy.xpath(this.locator._inputWidgetValueField(name, isInput))
|
||||
.trigger("click")
|
||||
.type(input);
|
||||
.type(input, { parseSpecialCharSequences: false });
|
||||
}
|
||||
|
||||
public ClearInputText(name: string, isInput = true) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user