diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index eb567a7c49..743b5d129f 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -162,7 +162,7 @@ jobs: with: issue-number: ${{ github.event.client_payload.pull_request.number }} body: | -
The following are new failures, please fix them before merging the PR ${{ env.new_failed_spec_env }}
+ The following are new failures, please fix them before merging the PR: \n ${{ env.new_failed_spec_env }} # Update check run called "ci-test-result" - name: Mark ci-test-result job as complete diff --git a/app/client/cypress/fixtures/datasources.json b/app/client/cypress/fixtures/datasources.json index ed34cff022..31a84c2c61 100644 --- a/app/client/cypress/fixtures/datasources.json +++ b/app/client/cypress/fixtures/datasources.json @@ -17,11 +17,11 @@ "mysql-username": "root", "mysql-password": "root", - "mssql-host": "localhost", + "mssql-host": "host.docker.internal", "mssql-port": 1433, "mssql-databaseName": "fakeapi", "mssql-username": "SA", - "mssql-password": "Root$123", + "mssql-password": "Root@123", "arango-host": "localhost", "arango-port": 8529, diff --git a/app/client/cypress/init-mssql-dump-for-test.sql b/app/client/cypress/init-mssql-dump-for-test.sql index 86c9441e8b..1d6cf18ac9 100644 --- a/app/client/cypress/init-mssql-dump-for-test.sql +++ b/app/client/cypress/init-mssql-dump-for-test.sql @@ -1,4 +1,5 @@ Create database fakeapi; +USE fakeapi; CREATE TABLE amazon_sales( uniq_id VARCHAR(32) NOT NULL PRIMARY KEY diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug19893_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug19893_spec.ts index 4cb4be84ed..6b413ec801 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug19893_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/BugTests/Bug19893_spec.ts @@ -1,21 +1,18 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; let dsName: any; -const agHelper = ObjectsRegistry.AggregateHelper, - dataSources = ObjectsRegistry.DataSources; - describe("Bug 19933: Authenticated API DS in case of OAuth2, should have save and authorise button enabled all the times", function () { it("1. Create Auth API DS, save i, now edit again and check the save and authorise button state", function () { - dataSources.NavigateToDSCreateNew(); - agHelper.GenerateUUID(); + _.dataSources.NavigateToDSCreateNew(); + _.agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { dsName = "AuthAPI " + uid; - dataSources.CreatePlugIn("Authenticated API"); - agHelper.RenameWithInPane(dsName, false); - dataSources.FillAuthAPIUrl(); - dataSources.AssertCursorPositionForTextInput( - dataSources._urlInputControl, + _.dataSources.CreatePlugIn("Authenticated API"); + _.agHelper.RenameWithInPane(dsName, false); + _.dataSources.FillAuthAPIUrl(); + _.dataSources.AssertCursorPositionForTextInput( + _.dataSources._urlInputControl, "{moveToStart}", "he", 2, diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/MaintainContext&Focus_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/MaintainContext&Focus_spec.js index be83bda197..17b4138267 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/MaintainContext&Focus_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/IDE/MaintainContext&Focus_spec.js @@ -170,9 +170,9 @@ describe("MaintainContext&Focus", function () { dataSources.ExpandSection(0); agHelper.GoBack(); ee.SelectEntityByName("Github", "Datasources"); - dataSources.AssertViewMode(); + dataSources.AssertDSEditViewMode("View"); ee.SelectEntityByName("Appsmith", "Datasources"); - dataSources.AssertEditMode(); + dataSources.AssertDSEditViewMode("Edit"); dataSources.AssertSectionCollapseState(0, false); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts index 65f660fe45..7fa9f46c09 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Refactoring/Refactoring_spec.ts @@ -41,10 +41,11 @@ describe("Validate JS Object Refactoring does not affect the comments & variable //Initialize new JSObject with custom code _.jsEditor.CreateJSObject(jsCode); //Initialize new Query entity with custom query - _.entityExplorer.CreateNewDsQuery(dsName); - _.agHelper.RenameWithInPane(refactorInput.query.oldName); - _.agHelper.GetNClick(_.dataSources._templateMenu); - _.dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay( + dsName, + query, + refactorInput.query.oldName, + ); //Creating query from EE overlay //Initialize new API entity with custom header _.apiPage.CreateAndFillApi( datasourceFormData["mockApiUrl"], diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Checkbox/CheckboxGroup_withQuery_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Checkbox/CheckboxGroup_withQuery_spec.js index e40c305e39..9b8d48542f 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Checkbox/CheckboxGroup_withQuery_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/Checkbox/CheckboxGroup_withQuery_spec.js @@ -16,16 +16,11 @@ describe("Checkbox Group Widget Functionality", function () { let query2 = `SELECT * FROM public."country" LIMIT 2;`; // add Query 1 with limit 10 - - _.entityExplorer.CreateNewDsQuery(dsName); - _.agHelper.GetNClick(_.dataSources._templateMenu); - _.dataSources.EnterQuery(query1); //Query1 + _.dataSources.CreateQueryFromOverlay(dsName, query1); //Query1 _.dataSources.RunQuery(); // add Query 2 with limit 2 - _.entityExplorer.CreateNewDsQuery(dsName); - _.agHelper.GetNClick(_.dataSources._templateMenu); - _.dataSources.EnterQuery(query2); + _.dataSources.CreateQueryFromOverlay(dsName, query2); //Query2 _.dataSources.RunQuery(); // add checkbox group widget diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/MsSQL_Basic_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/MsSQL_Basic_Spec.ts new file mode 100644 index 0000000000..026b7c1bb3 --- /dev/null +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datasources/MsSQL_Basic_Spec.ts @@ -0,0 +1,130 @@ +import * as _ from "../../../../support/Objects/ObjectsCore"; +import { Widgets } from "../../../../support/Pages/DataSources"; + +let dsName: any, query: string; + +describe("Validate MsSQL connection & basic querying with UI flows", () => { + before("Create a new MySQL DS", () => { + _.dataSources.CreateDataSource("MsSql"); + cy.get("@dsName").then(($dsName) => { + dsName = $dsName; + _.dataSources.CreateQueryAfterDSSaved( + "Create database fakeapi;", + "MsSQL_queries", + ); + _.dataSources.RunQuery(); + + query = "USE fakeapi;"; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + + query = `CREATE TABLE amazon_sales( + uniq_id VARCHAR(32) NOT NULL PRIMARY KEY + ,product_name VARCHAR(536) NOT NULL + ,manufacturer VARCHAR(48) + ,price VARCHAR(19) + ,number_available_in_stock VARCHAR(13) + ,number_of_reviews VARCHAR(5) + ,number_of_answered_questions INTEGER + ,average_review_rating VARCHAR(18) + ,amazon_category_and_sub_category VARCHAR(120) + ,customers_who_bought_this_item_also_bought VARCHAR(932) + ); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('eac7efa5dbd3d667f26eb3d3ab504464','Hornby 2014 Catalogue','Hornby','£3.42','5 new','15',1,'4.9 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Hornby-R8150-Catalogue-2015/dp/B00S9SUUBE | http://www.amazon.co.uk/Hornby-Book-Model-Railways-Edition/dp/1844860957 | http://www.amazon.co.uk/Hornby-Book-Scenic-Railway-Modelling/dp/1844861120 | http://www.amazon.co.uk/Peco-60-Plans-Book/dp/B002QVL16I | http://www.amazon.co.uk/Hornby-Gloucester | http://www.amazon.co.uk/Airfix-5014429781902'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('b17540ef7e86e461d37f3ae58b7b72ac','FunkyBuys® Large Christmas Holiday Express Festive Train Set (SI-TY1017) Toy Light / Sounds / Battery Operated & Smoke','FunkyBuys','£16.99',NULL,'2',1,'4.5 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Christmas-Holiday-Express-Festive-Train-Set-Toy/dp/B009R8S8AA | http://www.amazon.co.uk/Goldlok-Holiday-Express-Operated-Multi-Colour/dp/B009R8PAO2 | http://www.amazon.co.uk/FunkyBuys%C2%AE-Christmas-SI-TY1017-Ornaments-Operated/dp/B01437QMHA | http://www.amazon.co.uk/Holiday-Express-Christmas-Ornament-Decoration | http://www.amazon.co.uk/Seasonal-Vision-Christmas-Tree-Train/dp/B0044ZC1W2 | http://www.amazon.co.uk/Coca-Cola-Santa-Express-Train-Set/dp/B004BYSNU0'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('348f344247b0c1a935b1223072ef9d8a','CLASSIC TOY TRAIN SET TRACK CARRIAGES LIGHT ENGINE BOXED BOYS KIDS BATTERY','ccf','£9.99','2 new','17',2,'3.9 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Classic-Train-Lights-Battery-Operated/dp/B0041L9OHE | http://www.amazon.co.uk/Train-With-Tracks-Battery-Operated-x/dp/B009P540O8 | http://www.amazon.co.uk/13-Piece-Train-Set-Ideal/dp/B0173N6E4W | http://www.amazon.co.uk/Train-Flash-Electric-Sound-Europe/dp/B008D7CEH4 | http://www.amazon.co.uk/Train-Ultimate-Sticker-Book-Stickers/dp/1405314516 | http://www.amazon.co.uk/Train-Stickers-Dover-Little-Activity/dp/0486403106'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('e12b92dbb8eaee78b22965d2a9bbbd9f','HORNBY Coach R4410A BR Hawksworth Corridor 3rd','Hornby','£39.99',NULL,'1',2,'5.0 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains',NULL); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('e33a9adeed5f36840ccc227db4682a36','Hornby 00 Gauge 0-4-0 Gildenlow Salt Co. Steam Locomotive Model','Hornby','£32.19',NULL,'3',2,'4.7 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Hornby-R6367-RailRoad-Gauge-Rolling/dp/B000WDWSD2 | http://www.amazon.co.uk/Hornby-R3064-RailRoad-Smokey-Locomotive | http://www.amazon.co.uk/Hornby-R8222-Gauge-Track-Extension/dp/B000RK3FZK | http://www.amazon.co.uk/Hornby-R6371-RailRoad-Petrol-Tanker/dp/B000WDS002 | http://www.amazon.co.uk/Hornby-R076-00-Gauge-Footbridge | http://www.amazon.co.uk/Hornby-R6368-RailRoad-Gauge-Brake/dp/B000WDWT22'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('cb34f0a84102c1ebc3ef6892d7444d36','20pcs Model Garden Light Double Heads Lamppost Scale 1:100','Generic','£6.99',NULL,'2',1,'5.0 out of 5 stars','Hobbies > Model Trains & Railway Sets > Lighting & Signal Engineering > Lamps & Lighting','http://www.amazon.co.uk/Single-Head-Garden-Lights-Lamppost-Layout/dp/B008XCSHCA | http://www.amazon.co.uk/douself-100Pcs-OO-Scale-Passenger/dp/B00GRUD8W4 | http://www.amazon.co.uk/Hornby-Digital-Electric-Point-Track/dp/B00105UJ14 | http://www.amazon.co.uk/20Pcs-Scenery-Landscape-Train-Flowers/dp/B00C1843MA | http://www.amazon.co.uk/Scenery-Landscape-100-Made-Plastic-Cement/dp/B007UYIJ48'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('f74b562470571dfb689324adf236f82c','Hornby 00 Gauge 230mm BR Bogie Passenger Brake Coach Model (Red)','Hornby','£24.99',NULL,'2',1,'4.5 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Hornby-R4388-RailRoad-Composite-Gauge/dp/B00260GEXO | http://www.amazon.co.uk/Hornby-R1138-Passenger-Freight-Electric/dp/B006ZL6976'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('87bbb472ef9d90dcef140a551665c929','Hornby Santa''s Express Train Set','Hornby','£69.93','3 new','36',7,'4.3 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Hornby-R8221-Gauge-Track-Extension/dp/B000PVFYZ0 | http://www.amazon.co.uk/Hornby-R8222-Gauge-Track-Extension/dp/B000RK3FZK | http://www.amazon.co.uk/Hornby-R6368-RailRoad-Gauge-Brake/dp/B000WDWT22 | http://www.amazon.co.uk/Hornby-R6370-RailRoad-Tredegar-Gauge/dp/B000WDZH58 | http://www.amazon.co.uk/Hornby-R044-Passing-Contact-Switch/dp/B000H5V0RK | http://www.amazon.co.uk/Hornby-Gauge-Logan-Plank-Wagon/dp/B00SWV6RAG'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('7e2aa2b4596a39ba852449718413d7cc','Hornby Gauge Western Express Digital Train Set with eLink and TTS Loco Train Set','Hornby','£235.58','4 new','1',1,'5.0 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Hornby-Western-Master-E-Link-Electric/dp/B00BUKPXS8 | http://www.amazon.co.uk/Hornby-Gloucester | http://www.amazon.co.uk/Hornby-Majestic-E-Link-Gauge-Electric/dp/B00BUKPXU6 | http://www.amazon.co.uk/Hornby-Gauge-Master-Glens/dp/B00TQNJIIW | http://www.amazon.co.uk/Hornby-Gauge-Eurostar-2014-Train/dp/B00TQNJIIC | http://www.amazon.co.uk/HORNBY-Digital-Train-Layout-Track/dp/B006BRH55Y'); + INSERT INTO amazon_sales(uniq_id,product_name,manufacturer,price,number_available_in_stock,number_of_reviews,number_of_answered_questions,average_review_rating,amazon_category_and_sub_category,customers_who_bought_this_item_also_bought) VALUES ('5afbaf65680c9f378af5b3a3ae22427e','Learning Curve Chuggington Interactive Chatsworth','Chuggington',NULL,'1 new','8',1,'4.8 out of 5 stars','Hobbies > Model Trains & Railway Sets > Rail Vehicles > Trains','http://www.amazon.co.uk/Learning-Curve-Chuggington | http://www.amazon.co.uk/Chuggington | http://www.amazon.co.uk/Learning-Curve-Chuggington | http://www.amazon.co.uk/Learning-Chuggington');`; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + + query = `CREATE TABLE Simpsons( + episode_id VARCHAR(7) NOT NULL PRIMARY KEY + ,season INTEGER NOT NULL + ,episode INTEGER NOT NULL + ,number_in_series INTEGER NOT NULL + ,title VARCHAR(83) NOT NULL + ,summary VARCHAR(577) NOT NULL + ,air_date DATE NOT NULL + ,episode_image VARCHAR(164) NOT NULL + ,rating NUMERIC(3,1) + ,votes INTEGER + ); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E1',1,1,1,'Simpsons Roasting on an Open Fire','The family is forced to spend all of their savings to get Bart''s new tattoo removed, and with no money for Christmas, Homer is forced to become a store Santa.','1989-12-17','https://m.media-amazon.com/images/M/MV5BZjJjMzMwOTctODk5ZC00NWM4LTgyNjAtNjNmN2I1OTc5OTAyXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',8.1,5499); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E2',1,2,2,'Bart the Genius','Bart ends up at a school for gifted children after cheating on an IQ test.','1990-01-14','https://m.media-amazon.com/images/M/MV5BOTA0MTk3ZjktZGFhMi00ODcxLTlkYzgtZTJiMTQ5Y2I4MzhiXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.8,3456); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E3',1,3,3,'Homer''s Odyssey','After losing his job, Homer contemplates ending it all, until he discovers a new life path as a safety advocate.','1990-01-21','https://m.media-amazon.com/images/M/MV5BMzQ3M2M1YjQtNTkzNS00MDlhLWFiY2QtOWJiODZhNGJlZWMxXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.4,3034); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E4',1,4,4,'There''s No Disgrace Like Home','After being embarrassed by the rest of the family at a company picnic, Homer becomes obsessed with improving their behavior towards each other.','1990-01-28','https://m.media-amazon.com/images/M/MV5BOTZmNmE1NDUtMmRhOC00ZTYyLTkzMTEtOTM5YTgwMTc5YmMxXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.7,2978); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E5',1,5,5,'Bart the General','After being beaten up by Nelson Muntz one too many times, Bart turns to Grampa for help, and soon leads a rebellion against the school bully.','1990-02-04','https://m.media-amazon.com/images/M/MV5BMzk4ZDU2OTMtZjM0NC00ZWIyLWFmNmQtMjcyZGQ1OWE0ZWMyXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',8.0,3023); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E6',1,6,6,'Moaning Lisa','A depressed Lisa''s spirit is lifted when she meets a jazz-man, Bleeding Gums Murphy.','1990-02-11','https://m.media-amazon.com/images/M/MV5BODI3ZmEzMmEtNjE2MS00MjMyLWI0MmEtMTdhMWE4YzUwMzkwXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.6,2903); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E7',1,7,7,'The Call of the Simpsons','Homer takes the family camping, but it soon becomes a misadventure when they lose their equipment and Homer is mistaken for Bigfoot.','1990-02-18','https://m.media-amazon.com/images/M/MV5BOTkxMzY3Y2QtMWMyMC00NDllLTkyMTctZTY4MDFjZGExYTc1XkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.8,2807); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E8',1,8,8,'The Telltale Head','Bart gets more than he bargained for when he saws the head off a statue of the town''s founder.','1990-02-25','https://m.media-amazon.com/images/M/MV5BMzhhNTM3ZDYtYWQ3OS00NDU2LTk4MGEtOGZmMWUwODlmMjQyXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.7,2733); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E9',1,9,9,'Life on the Fast Lane','Marge contemplates an affair with a handsome bowling instructor.','1990-03-18','https://m.media-amazon.com/images/M/MV5BNzcxYWExZWYtMzY1MC00YjhlLWFmZmUtOTQ3ODZhZTUwN2EzXkEyXkFqcGdeQXVyNTAyODkwOQ@@._V1_UY126_UX224_AL_.jpg',7.5,2716); + INSERT INTO Simpsons(episode_id,season,episode,number_in_series,title,summary,air_date,episode_image,rating,votes) VALUES ('S1-E10',1,10,10,'Homer''s Night Out','After a photograph of Homer canoodling with an exotic dancer is distributed throughout Springfield, he finds himself kicked out of the house by Marge.','1990-03-25','https://m.media-amazon.com/images/M/MV5BMTQ4NzU0MjY1OF5BMl5BanBnXkFtZTgwNTE4NTQ2MjE@._V1_UX224_CR0,0,224,126_AL_.jpg',7.3,2624);`; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + }); + //_.agHelper.ActionContextMenuWithInPane("Delete"); Since next case can continue in same template + }); + + it("1. Validate Show all existing tables, Describe table & verify query responses", () => { + runQueryNValidate( + "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE';", + ["TABLE_CATALOG", "TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE"], + ); + runQueryNValidate("exec sp_columns Amazon_Sales;", [ + "TABLE_QUALIFIER", + "TABLE_OWNER", + "TABLE_NAME", + "COLUMN_NAME", + "DATA_TYPE", + "TYPE_NAME", + "PRECISION", + "LENGTH", + "SCALE", + "RADIX", + "NULLABLE", + "REMARKS", + "COLUMN_DEF", + "SQL_DATA_TYPE", + "SQL_DATETIME_SUB", + "CHAR_OCTET_LENGTH", + "ORDINAL_POSITION", + "IS_NULLABLE", + "SS_DATA_TYPE", + ]); + _.agHelper.ActionContextMenuWithInPane("Delete"); + }); + + it("2. Run a Select query & Add Suggested widget - Table", () => { + query = `Select * from Simpsons;`; + _.dataSources.CreateQueryFromOverlay(dsName, query, "selectSimpsons"); //Creating query from EE overlay + _.dataSources.RunQueryNVerifyResponseViews(10); //Could be 99 in CI, to check aft init load script is working + + _.dataSources.AddSuggesstedWidget(Widgets.Table); + _.agHelper.GetNClick(_.propPane._deleteWidget); + + _.entityExplorer.SelectEntityByName("selectSimpsons", "Queries/JS"); + _.agHelper.ActionContextMenuWithInPane("Delete"); + }); + + after("Verify Deletion of the datasource", () => { + _.entityExplorer.SelectEntityByName(dsName, "Datasources"); + _.entityExplorer.ActionContextMenuByEntityName( + dsName, + "Delete", + "Are you sure?", + ); + _.agHelper.ValidateNetworkStatus("@deleteDatasource", 200); + }); + + function runQueryNValidate(query: string, columnHeaders: string[]) { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(columnHeaders); + } +}); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_Spec.ts deleted file mode 100644 index 7a2e61133e..0000000000 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_Spec.ts +++ /dev/null @@ -1,151 +0,0 @@ -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, - table = ObjectsRegistry.Table, - locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode, - appSettings = ObjectsRegistry.AppSettings; - -describe("MySQL Datatype tests", function () { - before(() => { - cy.fixture("Datatypes/mySQLdsl").then((val: any) => { - agHelper.AddDsl(val); - }); - appSettings.OpenPaneAndChangeTheme("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.ExpandCollapseEntity("Datasources"); - 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.dropTable; - ee.ActionTemplateMenuByEntityName(inputData.tableName, "DELETE"); - agHelper.RenameWithInPane("dropTable"); - dataSources.EnterQuery(query); - }); - - //Insert valid/true values into datasource - it("5. 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) => { - if (value !== "") - 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("6. Validating values in each cell", () => { - cy.wait(2000); - inputData.result.forEach((res_array, i) => { - res_array.forEach((value, j) => { - table.ReadTableRowColumnData(j, i, "v1", 0).then(($cellData) => { - if (i === inputData.result.length - 1) { - const obj = JSON.parse($cellData); - expect(JSON.stringify(obj)).to.eq(JSON.stringify(value)); - } else { - expect($cellData).to.eq(value); - } - }); - }); - }); - }); - - //null will be displayed as empty string in tables - //So test null we have to intercept execute request. - //And check response payload. - it("7. Testing null value", () => { - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - ee.SelectEntityByName("selectRecords"); - dataSources.RunQuery(false); - cy.wait("@postExecute").then((intercept) => { - expect( - typeof intercept.response?.body.data.body[5].varchar_column, - ).to.be.equal("object"); - expect(intercept.response?.body.data.body[5].varchar_column).to.be.equal( - null, - ); - }); - }); - - it("8. Validate drop of mysqlDTs - Table from MySQL datasource", () => { - 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("9. Verify Deletion of the datasource after all created queries are Deleted", () => { - dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists - ee.ExpandCollapseEntity("Queries/JS"); - ["createTable", "dropTable", "insertRecord", "selectRecords"].forEach( - (type) => { - ee.ActionContextMenuByEntityName(type, "Delete", "Are you sure?"); - }, - ); - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); - }); -}); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_false_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_false_Spec.ts deleted file mode 100644 index e88ebd4aad..0000000000 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Datatypes/MySQL_false_Spec.ts +++ /dev/null @@ -1,80 +0,0 @@ -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 () { - 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.ExpandCollapseEntity("Datasources"); - ee.ActionContextMenuByEntityName(dsName, "Refresh"); - agHelper.AssertElementVisible( - ee._entityNameInExplorer(inputData.tableName), - ); - }); - - //Insert false values to each column and check for the error status of the request. - it("3. False Cases", () => { - ee.ActionTemplateMenuByEntityName(inputData.tableName, "INSERT"); - agHelper.RenameWithInPane("falseCases"); - inputData.falseResult.forEach((res_array, i) => { - res_array.forEach((value) => { - query = - typeof value === "string" - ? `INSERT INTO ${inputData.tableName} (${inputData.inputFieldName[i]}) VALUES ({{"${value}"}})` - : `INSERT INTO ${inputData.tableName} (${inputData.inputFieldName[i]}) VALUES ({{${value}}})`; - dataSources.EnterQuery(query); - dataSources.RunQuery(true, false); - }); - }); - agHelper.Sleep(2000); - agHelper.WaitUntilAllToastsDisappear(); - }); - - //This is a special case. - //Added due to server side checks, which was handled in Datatype handling. - it("4. Long Integer as query param", () => { - query = `SELECT * FROM ${inputData.tableName} LIMIT {{2147483648}}`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - }); - - it("5. Drop Table", () => { - query = inputData.query.dropTable; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - }); - - it("6. Verify Deletion of the datasource after all created queries are Deleted", () => { - ee.ExpandCollapseEntity("Queries/JS"); - ["falseCases", "createTable"].forEach((type) => { - ee.ActionContextMenuByEntityName(type, "Delete", "Are you sure?"); - }); - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); - }); -}); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/Basic_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/Basic_Spec.ts new file mode 100644 index 0000000000..7e9cbed57e --- /dev/null +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/Basic_Spec.ts @@ -0,0 +1,154 @@ +import * as _ from "../../../../support/Objects/ObjectsCore"; +import inputData from "../../../../support/Objects/mySqlData"; + +let dsName: any, query: string; + +describe("MySQL Datatype tests", function () { + before("Load dsl, Change theme, Create Mysql DS", () => { + cy.fixture("Datatypes/mySQLdsl").then((val: any) => { + _.agHelper.AddDsl(val); + }); + _.appSettings.OpenPaneAndChangeTheme("Moon"); + _.dataSources.CreateDataSource("MySql"); + cy.get("@dsName").then(($dsName) => { + dsName = $dsName; + }); + }); + + it("1. Creating mysqlDTs _.table & queries", () => { + //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; + + _.dataSources.CreateQueryFromOverlay(dsName, query, "createTable"); //Creating query from EE overlay + _.dataSources.RunQuery(); + + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementVisible( + _.entityExplorer._entityNameInExplorer(inputData.tableName), + ); + + //Creating SELECT query + _.entityExplorer.ActionTemplateMenuByEntityName( + inputData.tableName, + "SELECT", + ); + _.agHelper.RenameWithInPane("selectRecords"); + _.dataSources.RunQuery(); + _.agHelper + .GetText(_.dataSources._noRecordFound) + .then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show")); + + //Other queries + query = inputData.query.insertRecord; + _.entityExplorer.ActionTemplateMenuByEntityName( + inputData.tableName, + "INSERT", + ); + _.agHelper.RenameWithInPane("insertRecord"); + _.dataSources.EnterQuery(query); + + query = inputData.query.dropTable; + _.entityExplorer.ActionTemplateMenuByEntityName( + inputData.tableName, + "DELETE", + ); + _.agHelper.RenameWithInPane("dropTable"); + _.dataSources.EnterQuery(query); + }); + + //Insert valid/true values into datasource + it("2. Inserting record", () => { + _.entityExplorer.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) => { + if (value !== "") + _.agHelper.EnterInputText(inputData.inputFieldName[index], value); + }); + i % 2 && _.agHelper.ToggleSwitch("Bool_column"); + _.agHelper.ClickButton("insertRecord"); + _.agHelper.AssertElementVisible( + _.locators._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("3. Validating values in each cell", () => { + cy.wait(2000); + inputData.result.forEach((res_array, i) => { + res_array.forEach((value, j) => { + _.table.ReadTableRowColumnData(j, i, "v1", 0).then(($cellData) => { + if (i === inputData.result.length - 1) { + const obj = JSON.parse($cellData); + expect(JSON.stringify(obj)).to.eq(JSON.stringify(value)); + } else { + expect($cellData).to.eq(value); + } + }); + }); + }); + }); + + //null will be displayed as empty string in _.tables + //So test null we have to intercept execute request. + //And check response payload. + it("4. Testing null value", () => { + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.SelectEntityByName("selectRecords"); + _.dataSources.RunQuery(false); + cy.wait("@postExecute").then((intercept) => { + expect( + typeof intercept.response?.body.data.body[5].varchar_column, + ).to.be.equal("object"); + expect(intercept.response?.body.data.body[5].varchar_column).to.be.equal( + null, + ); + }); + }); + + after( + "Verify Drop of tables & Deletion of the datasource after all created queries are Deleted", + () => { + _.entityExplorer.SelectEntityByName("dropTable"); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { + expect($cellData).to.eq("0"); //Success response for dropped _.table! + }); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ExpandCollapseEntity(dsName); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementAbsence( + _.entityExplorer._entityNameInExplorer(inputData.tableName), + ); + _.entityExplorer.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Datasources", false); + + //DS deletion + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + ["createTable", "dropTable", "insertRecord", "selectRecords"].forEach( + (type) => { + _.entityExplorer.ActionContextMenuByEntityName( + type, + "Delete", + "Are you sure?", + ); + }, + ); + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); + }, + ); +}); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/False_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/False_Spec.ts new file mode 100644 index 0000000000..9fca7f83c0 --- /dev/null +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/MySQL_Datatypes/False_Spec.ts @@ -0,0 +1,74 @@ +import * as _ from "../../../../support/Objects/ObjectsCore"; +import inputData from "../../../../support/Objects/mySqlData"; + +let dsName: any, query: string; + +describe("MySQL Datatype tests", function () { + before("Create Mysql DS & Create mysqlDTs table", function () { + _.dataSources.CreateDataSource("MySql"); + cy.get("@dsName").then(($dsName) => { + dsName = $dsName; + //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; + _.dataSources.CreateQueryAfterDSSaved(query, "createTable"); //Creating query from EE overlay + _.dataSources.RunQuery(); + + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementVisible( + _.entityExplorer._entityNameInExplorer(inputData.tableName), + ); + }); + }); + + //Insert false values to each column and check for the error status of the request. + it("1. False Cases & Long Integer as query param", () => { + _.entityExplorer.ActionTemplateMenuByEntityName( + inputData.tableName, + "INSERT", + ); + _.agHelper.RenameWithInPane("falseCases"); + inputData.falseResult.forEach((res_array, i) => { + res_array.forEach((value) => { + query = + typeof value === "string" + ? `INSERT INTO ${inputData.tableName} (${inputData.inputFieldName[i]}) VALUES ({{"${value}"}})` + : `INSERT INTO ${inputData.tableName} (${inputData.inputFieldName[i]}) VALUES ({{${value}}})`; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(true, false); + }); + }); + _.agHelper.Sleep(2000); + _.agHelper.WaitUntilAllToastsDisappear(); + + //This is a special case. + //Added due to server side checks, which was handled in Datatype handling. + //Long Integer as query param + query = `SELECT * FROM ${inputData.tableName} LIMIT {{2147483648}}`; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + }); + + after( + "Verify Drop table & Deletion of the datasource after all created queries are Deleted", + () => { + query = inputData.query.dropTable; + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + ["falseCases", "createTable"].forEach((type) => { + _.entityExplorer.ActionContextMenuByEntityName( + type, + "Delete", + "Are you sure?", + ); + }); + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); + }, + ); +}); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/PostgresConnections_spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/PostgresConnections_spec.ts index 54328348c9..971eeb581a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/PostgresConnections_spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/OnLoadTests/PostgresConnections_spec.ts @@ -1,23 +1,17 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; let guid: any, dsName_1: any, dsName_2: any; -const agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - dataSources = ObjectsRegistry.DataSources, - propPane = ObjectsRegistry.PropertyPane, - deployMode = ObjectsRegistry.DeployMode; - describe("Test Postgres number of connections on page load + Bug 11572, Bug 11202", function () { before(() => { - agHelper.GenerateUUID(); + _.agHelper.GenerateUUID(); cy.get("@guid").then((uid) => { - dataSources.NavigateToDSCreateNew(); - dataSources.CreatePlugIn("PostgreSQL"); + _.dataSources.NavigateToDSCreateNew(); + _.dataSources.CreatePlugIn("PostgreSQL"); guid = uid; - agHelper.RenameWithInPane("Postgres_1_ " + guid, false); - dataSources.FillPostgresDSForm(); - dataSources.TestSaveDatasource(); + _.agHelper.RenameWithInPane("Postgres_1_ " + guid, false); + _.dataSources.FillPostgresDSForm(); + _.dataSources.TestSaveDatasource(); cy.wrap("Postgres_1_ " + guid).as("dsName_1"); cy.get("@dsName_1").then(($dsName) => { @@ -27,9 +21,6 @@ describe("Test Postgres number of connections on page load + Bug 11572, Bug 1120 }); it("1. Run create new user query", () => { - ee.CreateNewDsQuery(dsName_1); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("create_user"); const userName = "test_conn_user_" + guid; const userCreateQuery = `create user ` + @@ -37,96 +28,100 @@ describe("Test Postgres number of connections on page load + Bug 11572, Bug 1120 ` with password 'password'; grant select, insert, update, delete on all tables in schema public to ` + userName + `;`; - dataSources.EnterQuery(userCreateQuery); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.CreateQueryFromOverlay( + dsName_1, + userCreateQuery, + "create_user", + ); //Creating query from EE overlay + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("0"); }); }); it("2. Create new datasource for user test_conn_user", () => { - dataSources.NavigateToDSCreateNew(); - dataSources.CreatePlugIn("PostgreSQL"); - agHelper.RenameWithInPane("Postgres_2_ " + guid, false); + _.dataSources.NavigateToDSCreateNew(); + _.dataSources.CreatePlugIn("PostgreSQL"); + _.agHelper.RenameWithInPane("Postgres_2_ " + guid, false); const userName = "test_conn_user_" + guid; - dataSources.FillPostgresDSForm(false, userName, "password"); - dataSources.TestSaveDatasource(); + _.dataSources.FillPostgresDSForm(false, userName, "password"); + _.dataSources.TestSaveDatasource(); cy.wrap("Postgres_2_ " + guid).as("dsName_2"); cy.get("@dsName_2").then(($dsName) => { dsName_2 = $dsName; }); - }); - it("3. Create 10 queries", () => { + //Create 10 queries for (let i = 1; i <= 10; i++) { - dataSources.NavigateFromActiveDS(dsName_2, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("Query_" + i); + _.dataSources.NavigateFromActiveDS(dsName_2, true); + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.agHelper.RenameWithInPane("Query_" + i); const userCreateQuery = `select table_name from information_schema.tables where table_schema='public' and table_type='BASE TABLE';`; - dataSources.EnterQuery(userCreateQuery); + _.dataSources.EnterQuery(userCreateQuery); } }); - it.skip("4. Bind queries to select widget", () => { + it.skip("3. Bind queries to select widget", () => { for (let i = 1; i <= 10; i++) { - ee.DragDropWidgetNVerify("selectwidget", i * 50 + 50, i * 50 + 200); - propPane.UpdatePropertyFieldValue( + _.entityExplorer.DragDropWidgetNVerify( + "selectwidget", + i * 50 + 50, + i * 50 + 200, + ); + _.propPane.UpdatePropertyFieldValue( "Options", "{{Query_" + i + ".data.map( (obj) =>{ return {'label': obj.table_name, 'value': obj.table_name }})}}", ); - propPane.UpdatePropertyFieldValue( + _.propPane.UpdatePropertyFieldValue( "Default Selected Value", "{{Query_" + i + ".data[" + (i - 1) + "].table_name}}", ); - agHelper.ValidateNetworkStatus("@updateLayout", 200); + _.agHelper.ValidateNetworkStatus("@updateLayout", 200); } }); - it("5. Run query to drop any open connections before deploy and then deploy app", () => { - dataSources.NavigateFromActiveDS(dsName_1, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("check_number_of_connections_1"); + it("4. Run query to drop any open connections before deploy and then deploy app", () => { + _.dataSources.NavigateFromActiveDS(dsName_1, true); + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.agHelper.RenameWithInPane("check_number_of_connections_1"); const userName = "test_conn_user_" + guid; const dropConnections = `select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where pg_stat_activity.usename = '` + userName + `'`; - dataSources.EnterQuery(dropConnections); - dataSources.RunQuery(); + _.dataSources.EnterQuery(dropConnections); + _.dataSources.RunQuery(); const checkNoOfConnQuery = `select count(*) from pg_stat_activity where usename='` + userName + `'`; - dataSources.EnterQuery(checkNoOfConnQuery); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(checkNoOfConnQuery); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect(Number($cellData)).to.eq(0); }); - deployMode.DeployApp(); - agHelper.Sleep(10000); - deployMode.NavigateBacktoEditor(); + _.deployMode.DeployApp(); + _.agHelper.Sleep(10000); + _.deployMode.NavigateBacktoEditor(); }); - it("6. Run query to check number of open connections after deploy", () => { - dataSources.NavigateFromActiveDS(dsName_2, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("check_number_of_connections_2"); + it("5. Run query to check number of open connections after deploy", () => { + _.dataSources.NavigateFromActiveDS(dsName_2, true); + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.agHelper.RenameWithInPane("check_number_of_connections_2"); const checkNoOfConnQuery = `select count(*) from pg_stat_activity where usename='test_conn_user_` + guid + `'`; - dataSources.EnterQuery(checkNoOfConnQuery); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(checkNoOfConnQuery); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect(Number($cellData)).to.lte(5); }); }); - it("7. Drop the newly created user", () => { - ee.CreateNewDsQuery(dsName_1); - agHelper.RenameWithInPane("drop_user"); - agHelper.GetNClick(dataSources._templateMenu); + it("6. Drop the newly created user", () => { const userName = "test_conn_user_" + guid; const dropUser = `DROP OWNED BY ` + @@ -135,39 +130,50 @@ describe("Test Postgres number of connections on page load + Bug 11572, Bug 1120 DROP USER ` + userName + `;`; - dataSources.EnterQuery(dropUser); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.CreateQueryFromOverlay(dsName_1, dropUser, "drop_user"); //Creating query from EE overlay + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("0"); }); - agHelper.ActionContextMenuWithInPane("Delete"); + _.agHelper.ActionContextMenuWithInPane("Delete"); }); - it("8. Verify Deletion of all created queries", () => { - ee.ExpandCollapseEntity("Queries/JS"); - ee.ActionContextMenuByEntityName("create_user", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( - "check_number_of_connections_1", - "Delete", - "Are you sure?", - ); - ee.ActionContextMenuByEntityName( - "check_number_of_connections_2", - "Delete", - "Are you sure?", - ); + after( + "Verify Verify Deletion of all created queries & Deletion of datasource", + () => { + //Verify Deletion of all created queries + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.ActionContextMenuByEntityName( + "create_user", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "check_number_of_connections_1", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "check_number_of_connections_2", + "Delete", + "Are you sure?", + ); - for (let i = 1; i <= 10; i++) { - ee.ActionContextMenuByEntityName("Query_" + i, "Delete", "Are you sure?"); - } - }); + for (let i = 1; i <= 10; i++) { + _.entityExplorer.ActionContextMenuByEntityName( + "Query_" + i, + "Delete", + "Are you sure?", + ); + } - it("9. Verify Deletion of datasource", () => { - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName_1, 200); - dataSources.DeleteDatasouceFromWinthinDS(dsName_2, 200); - }); + //Verify deletion of datasource + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName_1, 200); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName_2, 200); + }, + ); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Array_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Array_Spec.ts index 22827b5949..54f6cf6161 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Array_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Array_Spec.ts @@ -1,256 +1,234 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; let dsName: any, query: string; -const agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - dataSources = ObjectsRegistry.DataSources, - table = ObjectsRegistry.Table, - locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode, - appSettings = ObjectsRegistry.AppSettings; describe("Array Datatype tests", function () { - before(() => { - dataSources.CreateDataSource("Postgres"); + before("Create DS, Add DS & setting theme", () => { + _.dataSources.CreateDataSource("Postgres"); cy.get("@dsName").then(($dsName) => { dsName = $dsName; }); - }); - - it("0. Importing App & setting theme", () => { cy.fixture("Datatypes/ArrayDTdsl").then((val: any) => { - agHelper.AddDsl(val); + _.agHelper.AddDsl(val); }); - ee.NavigateToSwitcher("widgets"); - appSettings.OpenPaneAndChangeThemeColors(-31, -27); + _.entityExplorer.NavigateToSwitcher("widgets"); + _.appSettings.OpenPaneAndChangeThemeColors(-31, -27); }); - it("1. Creating table query - arraytypes", () => { + it("1. Creating table query - arraytypes + Bug 14493", () => { query = `CREATE TABLE arraytypes (serialId SERIAL not null primary key, name text, pay_by_quarter integer[], schedule text[][]);`; - dataSources.NavigateFromActiveDS(dsName, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("createTable"); - dataSources.EnterQuery(query); - dataSources.RunQuery(); + _.dataSources.NavigateFromActiveDS(dsName, true); + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.agHelper.RenameWithInPane("createTable"); + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); - ee.ExpandCollapseEntity("Datasources"); - ee.ActionContextMenuByEntityName(dsName, "Refresh"); - agHelper.AssertElementVisible( - ee._entityNameInExplorer("public.arraytypes"), + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementVisible( + _.entityExplorer._entityNameInExplorer("public.arraytypes"), ); - }); - it("2. Creating SELECT query - arraytypes + Bug 14493", () => { - ee.ActionTemplateMenuByEntityName("public.arraytypes", "SELECT"); - agHelper.RenameWithInPane("selectRecords"); - dataSources.RunQuery(); - agHelper - .GetText(dataSources._noRecordFound) + //Creating SELECT query - arraytypes + Bug 14493 + _.entityExplorer.ActionTemplateMenuByEntityName( + "public.arraytypes", + "SELECT", + ); + _.agHelper.RenameWithInPane("selectRecords"); + _.dataSources.RunQuery(); + _.agHelper + .GetText(_.dataSources._noRecordFound) .then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show")); - }); - it("3. Creating all queries - arraytypes", () => { + //Creating other queries query = `INSERT INTO arraytypes ("name", "pay_by_quarter", "schedule") VALUES ('{{Insertname.text}}', ARRAY{{Insertpaybyquarter.text.split(',').map(Number)}}, ARRAY[['{{Insertschedule.text.split(',').slice(0,2).toString()}}'],['{{Insertschedule.text.split(',').slice(2,4).toString()}}']]);`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("insertRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.ToggleUsePreparedStatement(false); + + _.dataSources.CreateQueryFromOverlay(dsName, query, "insertRecord"); //Creating query from EE overlay + _.dataSources.ToggleUsePreparedStatement(false); query = `UPDATE public."arraytypes" SET "name" = '{{Updatename.text}}', "pay_by_quarter" = ARRAY{{Updatepaybyquarter.text.split(',').map(Number)}}, - "schedule" = ARRAY[['{{Updateschedule.text.split(',').slice(0,2).toString()}}'],['{{Updateschedule.text.split(',').slice(2,4).toString()}}']] WHERE serialid = {{Table1.selectedRow.serialid}};`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("updateRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.ToggleUsePreparedStatement(false); + "schedule" = ARRAY[['{{Updateschedule.text.split(',').slice(0,2).toString()}}'],['{{Updateschedule.text.split(',').slice(2,4).toString()}}']] WHERE serialid = {{Table1.selectedRow.serialid}};`; + + _.dataSources.CreateQueryFromOverlay(dsName, query, "updateRecord"); //Creating query from EE overlay + _.dataSources.ToggleUsePreparedStatement(false); query = `DELETE FROM public."arraytypes" WHERE serialId = {{Table1.selectedRow.serialid}}`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteRecord"); //Creating query from EE overlay query = `DELETE FROM public."arraytypes"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteAllRecords"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteAllRecords"); //Creating query from EE overlay - query = `drop table public."arraytypes"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("dropTable"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + query = `DROP table public."arraytypes"`; + _.dataSources.CreateQueryFromOverlay(dsName, query, "dropTable"); //Creating query from EE overlay - ee.ExpandCollapseEntity("Queries/JS", false); - ee.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity(dsName, false); }); - it("4. Inserting record - arraytypes", () => { - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitForTableEmpty(); //asserting table is empty before inserting! - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + it("2. Inserting record - arraytypes", () => { + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitForTableEmpty(); //asserting _.table is empty before inserting! + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.EnterInputText("Name", "Lily Bush"); - agHelper.EnterInputText("Pay_by_quarter", "100,200,300,400"); - agHelper.EnterInputText("Schedule", "Arrival,Breakfast,Meeting,Lunch"); + _.agHelper.EnterInputText("Name", "Lily Bush"); + _.agHelper.EnterInputText("Pay_by_quarter", "100,200,300,400"); + _.agHelper.EnterInputText("Schedule", "Arrival,Breakfast,Meeting,Lunch"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).not.to.eq(""); }); }); - it("5. Inserting another record - arraytypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + it("3. Inserting another record - arraytypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.EnterInputText("Name", "Josh William"); - agHelper.EnterInputText("Pay_by_quarter", "8700,5454,9898,23257"); - agHelper.EnterInputText("Schedule", "Stand up,Update,Report,Executive"); + _.agHelper.EnterInputText("Name", "Josh William"); + _.agHelper.EnterInputText("Pay_by_quarter", "8700,5454,9898,23257"); + _.agHelper.EnterInputText("Schedule", "Stand up,Update,Report,Executive"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { expect($cellData).not.to.eq(""); }); }); - it("6. Inserting another record - arraytypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + it("4. Inserting another record - arraytypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.EnterInputText("Name", "Mary Clark"); - agHelper.EnterInputText("Pay_by_quarter", "9898,21726,87387,8372837"); - agHelper.EnterInputText( + _.agHelper.EnterInputText("Name", "Mary Clark"); + _.agHelper.EnterInputText("Pay_by_quarter", "9898,21726,87387,8372837"); + _.agHelper.EnterInputText( "Schedule", "Travel,Meet Sales,Take Action,Sky Rocket", ); - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).not.to.eq(""); }); }); - it("7. Updating record - arraytypes", () => { - table.SelectTableRow(1); - agHelper.ClickButton("Run UpdateQuery"); - agHelper.AssertElementVisible(locator._modal); + it("5. Updating record - arraytypes", () => { + _.table.SelectTableRow(1); + _.agHelper.ClickButton("Run UpdateQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.EnterInputText("Name", "Josh Clarion", true); - agHelper.EnterInputText("Pay_by_quarter", "3232,3232,4567,12234", true); - agHelper.EnterInputText( + _.agHelper.EnterInputText("Name", "Josh Clarion", true); + _.agHelper.EnterInputText("Pay_by_quarter", "3232,3232,4567,12234", true); + _.agHelper.EnterInputText( "Schedule", "Breakfat,Presentation,Consulting,Training", true, ); - agHelper.ClickButton("Update"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Update did not fail - agHelper.AssertElementVisible(locator._spanButton("Run UpdateQuery")); - table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Update"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Update did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run UpdateQuery")); + _.table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("3"); }); - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("2"); //Since recently updated column to pushed to last! }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).not.to.eq(""); }); }); - it("8. Validating JSON functions", () => { - deployMode.NavigateBacktoEditor(); - table.WaitUntilTableLoad(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.NavigateFromActiveDS(dsName, true); - agHelper.RenameWithInPane("verifyArrayFunctions"); + it("6. Validating JSON functions", () => { + _.deployMode.NavigateBacktoEditor(); + _.table.WaitUntilTableLoad(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.NavigateFromActiveDS(dsName, true); + _.agHelper.RenameWithInPane("verifyArrayFunctions"); query = `SELECT name FROM arraytypes WHERE pay_by_quarter[1] <> pay_by_quarter[2];`; - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["name"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["name"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("Lily Bush"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Mary Clark"); }); query = `SELECT pay_by_quarter[3] FROM arraytypes;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["pay_by_quarter"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["pay_by_quarter"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("300"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("87387"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("4567"); }); //Verifying OR query = `SELECT * FROM arraytypes WHERE pay_by_quarter[1] = 300 OR pay_by_quarter[2] = 200 OR pay_by_quarter[3] = 4567 OR pay_by_quarter[4] = 10000;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "serialid", "name", "pay_by_quarter", "schedule", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("1"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Lily Bush"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq("2"); }); - dataSources.ReadQueryTableResponse(5).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(5).then(($cellData) => { expect($cellData).to.eq("Josh Clarion"); }); //Verifying && query = `SELECT * FROM arraytypes WHERE pay_by_quarter && ARRAY[87387];`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "serialid", "name", "pay_by_quarter", "schedule", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("3"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Mary Clark"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("[9898,21726,87387,8372837]"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq( `[["Travel,Meet Sales"],["Take Action,Sky Rocket"]]`, ); @@ -258,18 +236,18 @@ describe("Array Datatype tests", function () { //Verifying ANY query = `SELECT * FROM arraytypes WHERE 9898 = ANY (pay_by_quarter);`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "serialid", "name", "pay_by_quarter", "schedule", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("3"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Mary Clark"); }); @@ -279,13 +257,13 @@ describe("Array Datatype tests", function () { generate_subscripts(pay_by_quarter, 1) AS position FROM arraytypes) AS foo WHERE pay_by_quarter[position] = 100;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["pay_by_quarter", "position"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["pay_by_quarter", "position"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[100,200,300,400]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("1"); }); @@ -294,261 +272,261 @@ describe("Array Datatype tests", function () { generate_subscripts(pay_by_quarter, 1) AS position FROM arraytypes) AS foo WHERE pay_by_quarter[position] = 3232;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["pay_by_quarter", "position"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["pay_by_quarter", "position"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[3232,3232,4567,12234]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("1"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("[3232,3232,4567,12234]"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq("2"); }); //Verifying ALL query = `SELECT * FROM arraytypes WHERE 100 = ALL (pay_by_quarter);`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - agHelper - .GetText(dataSources._noRecordFound) + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.agHelper + .GetText(_.dataSources._noRecordFound) .then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show")); //Verifying unnest query = `SELECT name, unnest(schedule) FROM arraytypes;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["name", "unnest"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["name", "unnest"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("Lily Bush"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Arrival,Breakfast"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq("Mary Clark"); }); - dataSources.ReadQueryTableResponse(5).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(5).then(($cellData) => { expect($cellData).to.eq("Travel,Meet Sales"); }); - dataSources.ReadQueryTableResponse(10).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(10).then(($cellData) => { expect($cellData).to.eq("Josh Clarion"); }); - dataSources.ReadQueryTableResponse(11).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(11).then(($cellData) => { expect($cellData).to.eq("Consulting,Training"); }); //Verifying index access query = `SELECT schedule[1:2][1:1] FROM arraytypes WHERE name = 'Lily Bush';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["schedule"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["schedule"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`[["Arrival,Breakfast"],["Meeting,Lunch"]]`); }); //Verifying index access query = `SELECT schedule[1:2][2] FROM arraytypes WHERE name = 'Josh Clarion';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["schedule"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["schedule"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq( `[["Breakfat,Presentation"],["Consulting,Training"]]`, ); }); query = `SELECT schedule[:1][1:] FROM arraytypes WHERE name = 'Mary Clark';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["schedule"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["schedule"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`[["Travel,Meet Sales"]]`); }); query = `SELECT schedule[2:2][:] FROM arraytypes WHERE name = 'Mary Clark';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["schedule"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["schedule"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`[["Take Action,Sky Rocket"]]`); }); //Verifying array_dims query = `SELECT array_dims(schedule) FROM arraytypes WHERE name = 'Lily Bush';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["array_dims"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["array_dims"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[1:2][1:1]"); }); //Verifying array_length query = `SELECT array_length(schedule, 1) FROM arraytypes WHERE name = 'Mary Clark';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["array_length"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["array_length"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`2`); }); //Verifying array_upper, cardinality query = `SELECT array_upper(pay_by_quarter, 1), cardinality(schedule) FROM arraytypes WHERE name = 'Josh Clarion';`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["array_upper", "cardinality"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["array_upper", "cardinality"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("4"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("2"); }); //Verifying || query = `SELECT ARRAY[1,2] || ARRAY[3,4] as "Test ||", ARRAY[5,6] || ARRAY[[1,2],[3,4]] as "Test || of 2D Array", ARRAY[1, 2] || '{3, 4}' as "Test || with {}"`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "Test ||", "Test || of 2D Array", "Test || with {}", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[1,2,3,4]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[[5,6],[1,2],[3,4]]"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("[1,2,3,4]"); }); //Verifying array_dims query = `SELECT array_dims(1 || '[0:1]={2,3}'::int[]) as "array_dims1", array_dims(ARRAY[1,2] || 3) as "array_dims2", array_dims(ARRAY[1,2] || ARRAY[3,4,5]) as "array_dims3", array_dims(ARRAY[[1,2],[3,4]] || ARRAY[[5,6],[7,8],[9,0]]) as "array_dims4";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "array_dims1", "array_dims2", "array_dims3", "array_dims4", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[0:2]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[1:3]"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("[1:5]"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq("[1:5][1:2]"); }); //Verifying array_prepend, array_append query = `SELECT array_prepend(1, ARRAY[2,3]) as "array_prepend", array_append(ARRAY[1,2], 3) as "array_append";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["array_prepend", "array_append"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["array_prepend", "array_append"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[1,2,3]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[1,2,3]"); }); //Verifying array_cat query = `SELECT array_cat(ARRAY[1,2], ARRAY[3,4]) as "array_cat1", array_cat(ARRAY[[1,2],[3,4]], ARRAY[5,6]) as "array_cat2", array_cat(ARRAY[5,6], ARRAY[[1,2],[3,4]]) as "array_cat3"`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "array_cat1", "array_cat2", "array_cat3", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[1,2,3,4]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[[1,2],[3,4],[5,6]]"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("[[5,6],[1,2],[3,4]]"); }); //Verifying || with NULL query = `SELECT ARRAY[1, 2] || NULL as "|| with NULL", array_append(ARRAY[1, 2], NULL) as "array_append";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["|| with NULL", "array_append"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["|| with NULL", "array_append"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("[1,2]"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[1,2,null]"); }); //Verifying array_position, array_positions query = `SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'sat'), array_positions(ARRAY[1, 4, 3, 1, 3, 4, 2, 1], 1);`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "array_position", "array_positions", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("7"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("[1,4,8]"); }); //Verifying input & output syntaxes query = `SELECT f1[1][-2][3] AS e1, f1[1][-1][5] AS e2 FROM (SELECT '[1:1][-2:-1] [3:5]={ {{1,2,3},{4,5,6} } }'::int[] AS f1) AS ss;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["e1", "e2"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["e1", "e2"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("1"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("6"); }); //Verifying array_remove query = `SELECT array_remove(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'wed') as "array_remove"`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders(["array_remove"]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders(["array_remove"]); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`["sun","mon","tue","thu","fri","sat"]`); }); //Verifying array_replace query = `select ARRAY[1,2,3,2,5] as "before_replace", array_replace(ARRAY[1,2,3,2,5], 2, 10) as two_becomes_ten;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "before_replace", "two_becomes_ten", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`[1,2,3,2,5]`); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq(`[1,10,3,10,5]`); }); //Verifying operators query = `select ARRAY[1.1,2.1,3.1]::int[] = ARRAY[1,2,3] as "=", ARRAY[1,2,3] <> ARRAY[1,2,4] as "<>", ARRAY[1,2,3] < ARRAY[1,2,4] as "<", ARRAY[1,4,3] > ARRAY[1,2,4] as ">", ARRAY[1,2,3] <= ARRAY[1,2,3] as "<=", ARRAY[1,4,3] >= ARRAY[1,4,3] as ">=", ARRAY[1,4,3] @> ARRAY[3,1,3] as "@>", ARRAY[2,2,7] <@ ARRAY[1,7,4,2,6] as "<@", ARRAY[1,4,3] && ARRAY[2,1] as "&&"`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "=", "<>", "<", @@ -559,130 +537,152 @@ describe("Array Datatype tests", function () { "<@", "&&", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("true"); }); - dataSources.ReadQueryTableResponse(8).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(8).then(($cellData) => { expect($cellData).to.eq("true"); }); //Verifying array_to_string query = `SELECT array_to_string(ARRAY[1, 2, 3, NULL, 5], ',', '*') as array_to_string, string_to_array('xx~^~yy~^~zz', '~^~', 'yy') as string_to_array;`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "array_to_string", "string_to_array", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("1,2,3,*,5"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq(`["xx",null,"zz"]`); }); //Verifying error query = `SELECT ARRAY[1, 2] || '7';`; - dataSources.EnterQuery(query); - agHelper.FocusElement(locator._codeMirrorTextArea); - dataSources.RunQuery(); - agHelper - .GetText(dataSources._queryError) + _.dataSources.EnterQuery(query); + _.agHelper.FocusElement(_.locators._codeMirrorTextArea); + _.dataSources.RunQuery(); + _.agHelper + .GetText(_.dataSources._queryError) .then(($errorText) => expect($errorText).to.contain( `ERROR: malformed array literal: "7"\n Detail: Array value must start with "{" or dimension information`, ), ); - agHelper.ActionContextMenuWithInPane("Delete"); - ee.ExpandCollapseEntity("Queries/JS", false); + _.agHelper.ActionContextMenuWithInPane("Delete"); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); }); - it("9. Deleting records - arraytypes", () => { - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitUntilTableLoad(); - table.SelectTableRow(1); - agHelper.ClickButton("DeleteQuery", 1); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.Sleep(2500); //Allwowing time for delete to be success - table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { + it("7. Deleting records - arraytypes", () => { + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitUntilTableLoad(); + _.table.SelectTableRow(1); + _.agHelper.ClickButton("DeleteQuery", 1); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.Sleep(2500); //Allwowing time for delete to be success + _.table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { expect($cellData).not.to.eq("3"); //asserting 2nd record is deleted }); - table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { expect($cellData).to.eq("2"); }); + + //Deleting all records from _.table - arraytypes + _.agHelper.GetNClick(_.locators._deleteIcon); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.Sleep(2000); + _.table.WaitForTableEmpty(); }); - it("10. Deleting all records from table - arraytypes", () => { - agHelper.GetNClick(locator._deleteIcon); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.Sleep(2000); - table.WaitForTableEmpty(); - }); + it("8. Inserting another record (to check serial column) - arraytypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - it("11. Inserting another record (to check serial column) - arraytypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + _.agHelper.EnterInputText("Name", "Bob Sim"); + _.agHelper.EnterInputText("Pay_by_quarter", "121,3234,4454,21213"); + _.agHelper.EnterInputText("Schedule", "Travel,Chillax,Hire,Give rewards"); - agHelper.EnterInputText("Name", "Bob Sim"); - agHelper.EnterInputText("Pay_by_quarter", "121,3234,4454,21213"); - agHelper.EnterInputText("Schedule", "Travel,Chillax,Hire,Give rewards"); - - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).not.to.eq(""); }); }); - it("12. Validate Drop of the Newly Created - arraytypes - Table from Postgres 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! + it("9. Validate Drop of the Newly Created - arraytypes - Table from Postgres datasource", () => { + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.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("public.arraytypes"), + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ExpandCollapseEntity(dsName); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementAbsence( + _.entityExplorer._entityNameInExplorer("public.arraytypes"), ); - ee.ExpandCollapseEntity(dsName, false); - ee.ExpandCollapseEntity("Datasources", false); + _.entityExplorer.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Datasources", false); }); - it("13. Verify Deletion of all created queries", () => { - dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists - ee.ExpandCollapseEntity("Queries/JS"); - ee.ActionContextMenuByEntityName("createTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( - "deleteAllRecords", - "Delete", - "Are you sure?", - ); - ee.ActionContextMenuByEntityName("deleteRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("dropTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("insertRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( - "selectRecords", - "Delete", - "Are you sure?", - ); - ee.ActionContextMenuByEntityName("updateRecord", "Delete", "Are you sure?"); - }); + after( + "Verify Deletion of all created queries & Deletion of datasource", + () => { + //Verify Deletion of all created queries + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.ActionContextMenuByEntityName( + "createTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "deleteAllRecords", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "deleteRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "dropTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "insertRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "selectRecords", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "updateRecord", + "Delete", + "Are you sure?", + ); - it("14. Verify Deletion of datasource", () => { - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); - }); + //Ds Deletion + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); + }, + ); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts index 681c20babc..ac3b880e22 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/Binary_Spec.ts @@ -1,307 +1,279 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; let dsName: any, query: string, imageNameToUpload: string; -const agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - dataSources = ObjectsRegistry.DataSources, - table = ObjectsRegistry.Table, - locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode, - appSettings = ObjectsRegistry.AppSettings; describe("Binary Datatype tests", function () { - before(() => { - dataSources.CreateDataSource("Postgres"); + before("Create DS, Importing App & setting theme", () => { + cy.fixture("Datatypes/BinaryDTdsl").then((val: any) => { + _.agHelper.AddDsl(val); + }); + _.appSettings.OpenPaneAndChangeThemeColors(24, -37); + _.dataSources.CreateDataSource("Postgres"); cy.get("@dsName").then(($dsName) => { dsName = $dsName; }); }); - it("0. Importing App & setting theme", () => { - cy.fixture("Datatypes/BinaryDTdsl").then((val: any) => { - agHelper.AddDsl(val); - }); - ee.NavigateToSwitcher("widgets"); - appSettings.OpenPaneAndChangeThemeColors(24, -37); - }); - - it("1. Creating table query - binarytype", () => { + it("1. Creating table queries - binarytype + Bug 14493", () => { query = `CREATE table binarytype (serialid SERIAL primary key, imagename TEXT, existingImage bytea, newImage bytea);`; - dataSources.NavigateFromActiveDS(dsName, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("createTable"); - dataSources.EnterQuery(query); - dataSources.RunQuery(); + _.dataSources.CreateQueryAfterDSSaved(query, "createTable"); + _.dataSources.RunQuery(); - ee.ExpandCollapseEntity("Datasources"); - ee.ActionContextMenuByEntityName(dsName, "Refresh"); - agHelper.AssertElementVisible( - ee._entityNameInExplorer("public.binarytype"), + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementVisible( + _.entityExplorer._entityNameInExplorer("public.binarytype"), ); - }); - it("2. Creating SELECT query - binarytype + Bug 14493", () => { + //Creating SELECT query - binarytype + Bug 14493 query = `SELECT binarytype.serialid, binarytype.imagename, encode(binarytype.existingimage, 'escape') as "OldImage", encode(binarytype.newimage, 'escape') as "NewImage" from public."binarytype";`; - ee.ActionTemplateMenuByEntityName("public.binarytype", "SELECT"); - agHelper.RenameWithInPane("selectRecords"); - dataSources.RunQuery(); - agHelper - .GetText(dataSources._noRecordFound) + _.entityExplorer.ActionTemplateMenuByEntityName( + "public.binarytype", + "SELECT", + ); + _.agHelper.RenameWithInPane("selectRecords"); + _.dataSources.RunQuery(); + _.agHelper + .GetText(_.dataSources._noRecordFound) .then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show")); - dataSources.EnterQuery(query); - }); + _.dataSources.EnterQuery(query); - it("3. Creating all queries - binarytype", () => { + //Other queries query = `INSERT INTO public."binarytype" ("imagename", "existingimage", "newimage") VALUES ('{{Insertimagename.text}}', '{{Insertimage.files[0].data}}', '{{Insertimage.files[0].data}}');`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("insertRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "insertRecord"); query = `UPDATE public."binarytype" SET "imagename" ='{{Updatename.text}}', "existingimage" = '{{Table1.selectedRow.OldImage}}', "newimage" = '{{Updateimage.files[0].data}}' WHERE serialid = {{Table1.selectedRow.serialid}};`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("updateRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "updateRecord"); query = `DELETE FROM public."binarytype" WHERE serialId = {{Table1.selectedRow.serialid}}`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteRecord"); query = `DELETE FROM public."binarytype"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteAllRecords"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteAllRecords"); - query = `drop table public."binarytype"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("dropTable"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + query = `DROP table public."binarytype"`; + _.dataSources.CreateQueryFromOverlay(dsName, query, "dropTable"); - ee.ExpandCollapseEntity("Queries/JS", false); - ee.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity(dsName, false); }); - it("4. Inserting record - binarytype", () => { + it("2. Inserting record - binarytype", () => { imageNameToUpload = "Datatypes/Bridge.jpg"; - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitForTableEmpty(); //asserting table is empty before inserting! - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitForTableEmpty(); //asserting _.table is empty before inserting! + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.ClickButton("Select New Image"); - agHelper.UploadFile(imageNameToUpload); + _.agHelper.ClickButton("Select New Image"); + _.agHelper.UploadFile(imageNameToUpload); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.AssertElementAbsence(locator._spinner, 20000); //for the update row to appear at last - table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //some more time for all rows with images to be populated - table.ReadTableRowColumnData(0, 0).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.AssertElementAbsence(_.locators._spinner, 20000); //for the update row to appear at last + _.table.WaitUntilTableLoad(); + _.agHelper.Sleep(2000); //some more time for all rows with images to be populated + _.table.ReadTableRowColumnData(0, 0).then(($cellData) => { expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Bridge.jpg"); }); - table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => { + _.table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => { + _.table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("5. Inserting another record - binarytype", () => { + it("3. Inserting another record - binarytype", () => { imageNameToUpload = "Datatypes/Georgia.jpeg"; - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.ClickButton("Select New Image"); - agHelper.UploadFile(imageNameToUpload); + _.agHelper.ClickButton("Select New Image"); + _.agHelper.UploadFile(imageNameToUpload); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.AssertElementAbsence(locator._spinner, 20000); //for the update row to appear at last - table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //some more time for all rows with images to be populated - table.ReadTableRowColumnData(1, 0).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.AssertElementAbsence(_.locators._spinner, 20000); //for the update row to appear at last + _.table.WaitUntilTableLoad(); + _.agHelper.Sleep(2000); //some more time for all rows with images to be populated + _.table.ReadTableRowColumnData(1, 0).then(($cellData) => { expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Georgia.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(1, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(1, 3).then(($newimage) => { + _.table.AssertTableRowImageColumnIsLoaded(1, 2).then(($oldimage) => { + _.table.AssertTableRowImageColumnIsLoaded(1, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("6. Inserting another record - binarytype", () => { + it("4. Inserting another record - binarytype", () => { imageNameToUpload = "Datatypes/Maine.jpeg"; - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.ClickButton("Select New Image"); - agHelper.UploadFile(imageNameToUpload); + _.agHelper.ClickButton("Select New Image"); + _.agHelper.UploadFile(imageNameToUpload); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.AssertElementAbsence(locator._spinner, 20000); //for the update row to appear at last - table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //some more time for all rows with images to be populated - table.ReadTableRowColumnData(2, 0).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.AssertElementAbsence(_.locators._spinner, 20000); //for the update row to appear at last + _.table.WaitUntilTableLoad(); + _.agHelper.Sleep(2000); //some more time for all rows with images to be populated + _.table.ReadTableRowColumnData(2, 0).then(($cellData) => { expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Maine.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { + _.table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { + _.table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("7. Updating record - binarytype", () => { + it("5. Updating record - binarytype", () => { imageNameToUpload = "Datatypes/NewJersey.jpeg"; - table.SelectTableRow(1); - agHelper.ClickButton("Run UpdateQuery"); - agHelper.AssertElementVisible(locator._modal); + _.table.SelectTableRow(1); + _.agHelper.ClickButton("Run UpdateQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - agHelper.ClickButton("Select update image"); - agHelper.UploadFile(imageNameToUpload); + _.agHelper.ClickButton("Select update image"); + _.agHelper.UploadFile(imageNameToUpload); - agHelper.ClickButton("Update"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Update did not fail - agHelper.AssertElementVisible(locator._spanButton("Run UpdateQuery")); - agHelper.AssertElementAbsence(locator._spinner, 20000); //for the update row to appear at last - table.WaitUntilTableLoad(); - agHelper.Sleep(10000); //some more time for rows to rearrange! - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Update"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Update did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run UpdateQuery")); + _.agHelper.AssertElementAbsence(_.locators._spinner, 20000); //for the update row to appear at last + _.table.WaitUntilTableLoad(); + _.agHelper.Sleep(10000); //some more time for rows to rearrange! + _.table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("NewJersey.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { + _.table.AssertTableRowImageColumnIsLoaded(2, 2).then(($oldimage) => { + _.table.AssertTableRowImageColumnIsLoaded(2, 3).then(($newimage) => { expect($oldimage).to.not.eq($newimage); }); }); }); - it("8. Validating Binary (bytea) - escape, hex, base64 functions", () => { - deployMode.NavigateBacktoEditor(); - table.WaitUntilTableLoad(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.NavigateFromActiveDS(dsName, true); - agHelper.RenameWithInPane("verifyBinaryFunctions"); + it("6. Validating Binary (bytea) - escape, hex, base64 functions", () => { + _.deployMode.NavigateBacktoEditor(); + _.table.WaitUntilTableLoad(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.NavigateFromActiveDS(dsName, true); + _.agHelper.RenameWithInPane("verifyBinaryFunctions"); //Validating zero octet query = `select encode('\\000'::bytea, 'hex') as "zero octet Hex", encode('\\000'::bytea, 'escape') as "zero octet Escape";`; - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "zero octet Hex", "zero octet Escape", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("00"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq(`\\000`); }); //Validating single quote query = `select encode(''''::bytea, 'escape') as "single quote Escape1", encode('\\047'::bytea, 'escape') as "single quote Escape2", encode(''''::bytea, 'hex') as "single quote Hex1", encode('\\047'::bytea, 'hex') as "single quote Hex2", encode(''''::bytea, 'base64') as "single quote Base64";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "single quote Escape1", "single quote Escape2", "single quote Hex1", "single quote Hex2", "single quote Base64", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("'"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("'"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("27"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq("27"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq("Jw=="); }); //Validating backslash query = `select encode('\\\\'::bytea, 'escape') as "backslash Escape1", encode('\\134'::bytea, 'escape') as "backslash Escape2", encode('\\\\'::bytea, 'hex') as "backslash Hex1", encode('\\134'::bytea, 'hex') as "backslash Hex2", encode('\\\\'::bytea, 'base64') as "backslash Base64";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "backslash Escape1", "backslash Escape2", "backslash Hex1", "backslash Hex2", "backslash Base64", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("\\\\"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("\\\\"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("5c"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq("5c"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq("XA=="); }); //Validating random string query = `select encode('abc \\153\\154\\155 \\052\\251\\124'::bytea::bytea, 'escape') as "string bytea_output Escape", encode('abc \\153\\154\\155 \\052\\251\\124'::bytea::bytea, 'hex') as "string bytea_output Hex", encode('abc \\153\\154\\155 \\052\\251\\124'::bytea::bytea, 'base64') as "string bytea_output Base64";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "string bytea_output Escape", "string bytea_output Hex", "string bytea_output Base64", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq(`abc klm *\\251T`); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("616263206b6c6d202aa954"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("YWJjIGtsbSAqqVQ="); }); //Validating text value1 query = `select encode(E'123abc456', 'escape') as "Escape1", encode(E'123abc456', 'hex') as "Hex1", encode('abc456', 'escape') as "Escape2", encode('abc456', 'hex') as "Hex2", encode(E'123\\\\000456'::bytea, 'escape') as "Escape3", encode(E'123\\\\000456'::bytea, 'hex') as "Hex3";`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.AssertQueryResponseHeaders([ + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.AssertQueryResponseHeaders([ "Escape1", "Hex1", "Escape2", @@ -309,125 +281,148 @@ describe("Binary Datatype tests", function () { "Escape3", "Hex3", ]); - dataSources.ReadQueryTableResponse(0).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { expect($cellData).to.eq("123abc456"); }); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("313233616263343536"); }); - dataSources.ReadQueryTableResponse(2).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(2).then(($cellData) => { expect($cellData).to.eq("abc456"); }); - dataSources.ReadQueryTableResponse(3).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(3).then(($cellData) => { expect($cellData).to.eq("616263343536"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq(`123\\000456`); }); - dataSources.ReadQueryTableResponse(5).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(5).then(($cellData) => { expect($cellData).to.eq("31323300343536"); }); - agHelper.ActionContextMenuWithInPane("Delete"); - ee.ExpandCollapseEntity("Queries/JS", false); + _.agHelper.ActionContextMenuWithInPane("Delete"); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); }); - it("9. Deleting records - binarytype", () => { - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitUntilTableLoad(); - table.SelectTableRow(1); - agHelper.ClickButton("DeleteQuery", 1); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.AssertElementAbsence(locator._spinner, 20000); //Allowing time for delete to be success - agHelper.Sleep(6000); //Allwowing time for delete to be success - table.ReadTableRowColumnData(1, 0).then(($cellData) => { + it("7. Deleting records - binarytype", () => { + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitUntilTableLoad(); + _.table.SelectTableRow(1); + _.agHelper.ClickButton("DeleteQuery", 1); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.AssertElementAbsence(_.locators._spinner, 20000); //Allowing time for delete to be success + _.agHelper.Sleep(6000); //Allwowing time for delete to be success + _.table.ReadTableRowColumnData(1, 0).then(($cellData) => { expect($cellData).not.to.eq("3"); //asserting 2nd record is deleted }); - table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { expect($cellData).to.eq("2"); }); + + //Deleting all records from .table + _.agHelper.GetNClick(_.locators._deleteIcon); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.Sleep(2000); + _.table.WaitForTableEmpty(); }); - it("10. Deleting all records from table - binarytype", () => { - agHelper.GetNClick(locator._deleteIcon); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.Sleep(2000); - table.WaitForTableEmpty(); - }); - - it("11. Inserting another record (to check serial column) - binarytype", () => { + it("8. Inserting another record (to check serial column) - binarytype", () => { imageNameToUpload = "Datatypes/Massachusetts.jpeg"; - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); - //agHelper.EnterInputText("Imagename", "Massachusetts"); - agHelper.ClickButton("Select New Image"); - agHelper.UploadFile(imageNameToUpload); + //_.agHelper.EnterInputText("Imagename", "Massachusetts"); + _.agHelper.ClickButton("Select New Image"); + _.agHelper.UploadFile(imageNameToUpload); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.WaitUntilTableLoad(); - agHelper.Sleep(2000); //for all rows with images to be populated - table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.WaitUntilTableLoad(); + _.agHelper.Sleep(2000); //for all rows with images to be populated + _.table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Massachusetts.jpeg"); }); - table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => { - table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => { + _.table.AssertTableRowImageColumnIsLoaded(0, 2).then(($oldimage) => { + _.table.AssertTableRowImageColumnIsLoaded(0, 3).then(($newimage) => { expect($oldimage).to.eq($newimage); }); }); }); - it("12. Validate Drop of the Newly Created - binarytype - Table from Postgres 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("public.binarytype"), - ); - ee.ExpandCollapseEntity(dsName, false); - ee.ExpandCollapseEntity("Datasources", false); - }); + it("9. Validate Drop of the Newly Created - binarytype - Table from Postgres datasource", () => {}); - it("13. Verify Deletion of all created queries", () => { - dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists - ee.ExpandCollapseEntity("Queries/JS"); - ee.ActionContextMenuByEntityName("createTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( - "deleteAllRecords", - "Delete", - "Are you sure?", - ); - ee.ActionContextMenuByEntityName("deleteRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("dropTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("insertRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( - "selectRecords", - "Delete", - "Are you sure?", - ); - ee.ActionContextMenuByEntityName("updateRecord", "Delete", "Are you sure?"); - }); + after( + "Validate Drop of the Newly Created - binarytype - Table & Verify Deletion of all created queries", + () => { + //Drop table + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.SelectEntityByName("dropTable"); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { + expect($cellData).to.eq("0"); //Success response for dropped _.table! + }); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ExpandCollapseEntity(dsName); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementAbsence( + _.entityExplorer._entityNameInExplorer("public.binarytype"), + ); + _.entityExplorer.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Datasources", false); - it("14. Verify Deletion of datasource", () => { - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); - }); + //Delete all queries + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.ActionContextMenuByEntityName( + "createTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "deleteAllRecords", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "deleteRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "dropTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "insertRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "selectRecords", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "updateRecord", + "Delete", + "Are you sure?", + ); + + //Delete DS + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); + }, + ); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/BooleanEnum_Spec.ts b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/BooleanEnum_Spec.ts index 9b85edd1a6..8c3a671a5a 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/BooleanEnum_Spec.ts +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/Postgres_DataTypes/BooleanEnum_Spec.ts @@ -1,297 +1,295 @@ -import { ObjectsRegistry } from "../../../../support/Objects/Registry"; +import * as _ from "../../../../support/Objects/ObjectsCore"; let dsName: any, query: string; -const agHelper = ObjectsRegistry.AggregateHelper, - ee = ObjectsRegistry.EntityExplorer, - dataSources = ObjectsRegistry.DataSources, - table = ObjectsRegistry.Table, - locator = ObjectsRegistry.CommonLocators, - deployMode = ObjectsRegistry.DeployMode, - appSettings = ObjectsRegistry.AppSettings; describe("Boolean & Enum Datatype tests", function () { - before(() => { + before("Create Postgress DS, Add dsl, Appply theme", () => { cy.fixture("Datatypes/BooleanEnumDTdsl").then((val: any) => { - agHelper.AddDsl(val); + _.agHelper.AddDsl(val); }); - appSettings.OpenPaneAndChangeThemeColors(-18, -20); - }); - - it("1. Create Postgress DS", function () { - dataSources.CreateDataSource("Postgres"); + _.appSettings.OpenPaneAndChangeThemeColors(-18, -20); + _.dataSources.CreateDataSource("Postgres"); cy.get("@dsName").then(($dsName) => { dsName = $dsName; }); }); - it("2. Creating enum & table queries - boolenumtypes", () => { + it("1. Creating enum & table queries - boolenumtypes + Bug 14493", () => { query = `CREATE TYPE weekdays AS ENUM ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');`; - dataSources.NavigateFromActiveDS(dsName, true); - agHelper.GetNClick(dataSources._templateMenu); - agHelper.RenameWithInPane("createEnum"); - dataSources.EnterQuery(query); - dataSources.RunQuery(); + _.dataSources.CreateQueryAfterDSSaved(query, "createEnum"); + _.dataSources.RunQuery(); query = `create table boolenumtypes (serialId SERIAL not null primary key, workingDay weekdays, AreWeWorking boolean)`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("createTable"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.RunQuery(); + _.dataSources.CreateQueryFromOverlay(dsName, query, "createTable"); + _.dataSources.RunQuery(); - ee.ExpandCollapseEntity("Datasources"); - ee.ExpandCollapseEntity(dsName); //Clicking Create Query from Active DS is already expanding ds - ee.ActionContextMenuByEntityName(dsName, "Refresh"); - agHelper.AssertElementVisible( - ee._entityNameInExplorer("public.boolenumtypes"), + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ExpandCollapseEntity(dsName); //Clicking Create Query from Active DS is already expanding ds + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementVisible( + _.entityExplorer._entityNameInExplorer("public.boolenumtypes"), ); - }); - it("3. Creating SELECT query - boolenumtypes + Bug 14493", () => { - ee.ActionTemplateMenuByEntityName("public.boolenumtypes", "SELECT"); - agHelper.RenameWithInPane("selectRecords"); - dataSources.RunQuery(); - agHelper - .GetText(dataSources._noRecordFound) + //Select query: + _.entityExplorer.ActionTemplateMenuByEntityName( + "public.boolenumtypes", + "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 - boolenumtypes", () => { + //Other queries query = `INSERT INTO public."boolenumtypes" ("workingday", "areweworking") VALUES ({{Insertworkingday.selectedOptionValue}}, {{Insertareweworking.isSwitchedOn}})`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("insertRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "insertRecord"); query = `UPDATE public."boolenumtypes" SET "workingday" = {{Updateworkingday.selectedOptionValue}}, "areweworking" = {{Updateareweworking.isSwitchedOn}} WHERE serialid = {{Table1.selectedRow.serialid}};`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("updateRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "updateRecord"); query = `SELECT * from enum_range(NULL::weekdays)`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("getEnum"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "getEnum"); query = `DELETE FROM public."boolenumtypes" WHERE serialId ={{Table1.selectedRow.serialid}}`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteRecord"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteRecord"); query = `DELETE FROM public."boolenumtypes"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("deleteAllRecords"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "deleteAllRecords"); - query = `drop table public."boolenumtypes"`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("dropTable"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + query = `DROP table public."boolenumtypes"`; + _.dataSources.CreateQueryFromOverlay(dsName, query, "dropTable"); query = `drop type weekdays`; - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("dropEnum"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); + _.dataSources.CreateQueryFromOverlay(dsName, query, "dropEnum"); - ee.ExpandCollapseEntity("Queries/JS", false); - ee.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity(dsName, false); }); - it("5. Inserting record - boolenumtypes", () => { - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitForTableEmpty(); //asserting table is empty before inserting! - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); - agHelper.SelectDropDown("Monday"); - agHelper.ToggleSwitch("Areweworking"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Insert did not fail - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { + it("2. Inserting record - boolenumtypes", () => { + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitForTableEmpty(); //asserting _.table is empty before inserting! + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); + _.agHelper.SelectDropDown("Monday"); + _.agHelper.ToggleSwitch("Areweworking"); + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Insert did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("1"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Monday"); }); - table.ReadTableRowColumnData(0, 2, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 2, "v1", 200).then(($cellData) => { expect($cellData).to.eq("true"); }); }); - it("6. Inserting another record - boolenumtypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); - agHelper.SelectDropDown("Saturday"); - agHelper.ToggleSwitch("Areweworking", "uncheck"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { + it("3. Inserting another record - boolenumtypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); + _.agHelper.SelectDropDown("Saturday"); + _.agHelper.ToggleSwitch("Areweworking", "uncheck"); + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("2"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Saturday"); }); - table.ReadTableRowColumnData(1, 2, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 2, "v1", 200).then(($cellData) => { expect($cellData).to.eq("false"); }); }); - it("7. Inserting another record - boolenumtypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); - agHelper.SelectDropDown("Friday"); - agHelper.ToggleSwitch("Areweworking", "uncheck"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + it("4. Inserting another record - boolenumtypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); + _.agHelper.SelectDropDown("Friday"); + _.agHelper.ToggleSwitch("Areweworking", "uncheck"); + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Friday"); }); - table.ReadTableRowColumnData(2, 2, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 2, "v1", 200).then(($cellData) => { expect($cellData).to.eq("false"); }); }); - it("8. Updating record - boolenumtypes", () => { - table.SelectTableRow(2); - agHelper.ClickButton("Run UpdateQuery"); - agHelper.AssertElementVisible(locator._modal); - agHelper.ToggleSwitch("Areweworking", "check"); - agHelper.ClickButton("Update"); - agHelper.AssertElementAbsence(locator._toastMsg); //Assert that Update did not fail - agHelper.AssertElementVisible(locator._spanButton("Run UpdateQuery")); - table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { + it("5. Updating record - boolenumtypes", () => { + _.table.SelectTableRow(2); + _.agHelper.ClickButton("Run UpdateQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); + _.agHelper.ToggleSwitch("Areweworking", "check"); + _.agHelper.ClickButton("Update"); + _.agHelper.AssertElementAbsence(_.locators._toastMsg); //Assert that Update did not fail + _.agHelper.AssertElementVisible(_.locators._spanButton("Run UpdateQuery")); + _.table.ReadTableRowColumnData(2, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("3"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Friday"); }); - table.ReadTableRowColumnData(2, 2, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(2, 2, "v1", 200).then(($cellData) => { expect($cellData).to.eq("true"); }); }); - it("9. Validating Enum Ordering", () => { - deployMode.NavigateBacktoEditor(); - table.WaitUntilTableLoad(); + it("6. Validating Enum Ordering", () => { + _.deployMode.NavigateBacktoEditor(); + _.table.WaitUntilTableLoad(); query = `SELECT * FROM boolenumtypes WHERE workingday > 'Tuesday';`; - ee.ExpandCollapseEntity("Queries/JS"); - ee.CreateNewDsQuery(dsName); - agHelper.RenameWithInPane("verifyEnumOrdering"); - agHelper.GetNClick(dataSources._templateMenu); - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.CreateNewDsQuery(dsName); + _.agHelper.RenameWithInPane("verifyEnumOrdering"); + _.agHelper.GetNClick(_.dataSources._templateMenu); + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Saturday"); }); - dataSources.ReadQueryTableResponse(4).then(($cellData) => { + _.dataSources.ReadQueryTableResponse(4).then(($cellData) => { expect($cellData).to.eq("Friday"); }); query = `SELECT * FROM boolenumtypes WHERE workingday = (SELECT MIN(workingday) FROM boolenumtypes);`; - dataSources.EnterQuery(query); - dataSources.RunQuery(); - dataSources.ReadQueryTableResponse(1).then(($cellData) => { + _.dataSources.EnterQuery(query); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(1).then(($cellData) => { expect($cellData).to.eq("Monday"); }); - agHelper.ActionContextMenuWithInPane("Delete"); - ee.ExpandCollapseEntity("Queries/JS", false); + _.agHelper.ActionContextMenuWithInPane("Delete"); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); }); - it("10. Deleting records - boolenumtypes", () => { - ee.SelectEntityByName("Page1"); - deployMode.DeployApp(); - table.WaitUntilTableLoad(); - table.SelectTableRow(1); - agHelper.ClickButton("DeleteQuery", 1); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.ValidateNetworkStatus("@postExecute", 200); - agHelper.Sleep(2500); //Allwowing time for delete to be success - table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { + it("7. Deleting records - boolenumtypes", () => { + _.entityExplorer.SelectEntityByName("Page1"); + _.deployMode.DeployApp(); + _.table.WaitUntilTableLoad(); + _.table.SelectTableRow(1); + _.agHelper.ClickButton("DeleteQuery", 1); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.ValidateNetworkStatus("@postExecute", 200); + _.agHelper.Sleep(2500); //Allwowing time for delete to be success + _.table.ReadTableRowColumnData(1, 0, "v1", 2000).then(($cellData) => { expect($cellData).not.to.eq("2"); //asserting 2nd record is deleted }); - table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(1, 0, "v1", 200).then(($cellData) => { expect($cellData).to.eq("3"); }); + + //Deleting all records from table + _.agHelper.GetNClick(_.locators._deleteIcon); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.agHelper.Sleep(2000); + _.table.WaitForTableEmpty(); }); - it("11. Deleting all records from table - boolenumtypes", () => { - agHelper.GetNClick(locator._deleteIcon); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - agHelper.Sleep(2000); - table.WaitForTableEmpty(); - }); - - it("12. Inserting another record (to check serial column) - boolenumtypes", () => { - agHelper.ClickButton("Run InsertQuery"); - agHelper.AssertElementVisible(locator._modal); - agHelper.SelectDropDown("Wednesday"); - agHelper.ToggleSwitch("Areweworking", "check"); - agHelper.ClickButton("Insert"); - agHelper.AssertElementVisible(locator._spanButton("Run InsertQuery")); - table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { + it("8. Inserting another record (to check serial column) - boolenumtypes", () => { + _.agHelper.ClickButton("Run InsertQuery"); + _.agHelper.AssertElementVisible(_.locators._modal); + _.agHelper.SelectDropDown("Wednesday"); + _.agHelper.ToggleSwitch("Areweworking", "check"); + _.agHelper.ClickButton("Insert"); + _.agHelper.AssertElementVisible(_.locators._spanButton("Run InsertQuery")); + _.table.ReadTableRowColumnData(0, 0, "v1", 2000).then(($cellData) => { expect($cellData).to.eq("4"); //asserting serial column is inserting fine in sequence }); - table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 1, "v1", 200).then(($cellData) => { expect($cellData).to.eq("Wednesday"); }); - table.ReadTableRowColumnData(0, 2, "v1", 200).then(($cellData) => { + _.table.ReadTableRowColumnData(0, 2, "v1", 200).then(($cellData) => { expect($cellData).to.eq("true"); }); }); - it("13. Validate Drop of the Newly Created - boolenumtypes - Table from Postgres 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("public.boolenumtypes"), - ); - ee.ExpandCollapseEntity(dsName, false); - ee.ExpandCollapseEntity("Datasources", false); - }); + after("Verify Deletion of the datasource after all created queries are Deleted", () => { + //Drop table: - it("14. Verify Deletion of the datasource after all created queries are Deleted", () => { - dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists - ee.ExpandCollapseEntity("Queries/JS"); - ee.ActionContextMenuByEntityName("createEnum", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("createTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.SelectEntityByName("dropTable"); + _.dataSources.RunQuery(); + _.dataSources.ReadQueryTableResponse(0).then(($cellData) => { + expect($cellData).to.eq("0"); //Success response for dropped _.table! + }); + _.entityExplorer.ExpandCollapseEntity("Queries/JS", false); + _.entityExplorer.ExpandCollapseEntity("Datasources"); + _.entityExplorer.ExpandCollapseEntity(dsName); + _.entityExplorer.ActionContextMenuByEntityName(dsName, "Refresh"); + _.agHelper.AssertElementAbsence( + _.entityExplorer._entityNameInExplorer("public.boolenumtypes"), + ); + _.entityExplorer.ExpandCollapseEntity(dsName, false); + _.entityExplorer.ExpandCollapseEntity("Datasources", false); + + //Delete queries + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 409); //Since all queries exists + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.entityExplorer.ActionContextMenuByEntityName( + "createEnum", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "createTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( "deleteAllRecords", "Delete", "Are you sure?", ); - ee.ActionContextMenuByEntityName("deleteRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("dropTable", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("dropEnum", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("getEnum", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName("insertRecord", "Delete", "Are you sure?"); - ee.ActionContextMenuByEntityName( + _.entityExplorer.ActionContextMenuByEntityName( + "deleteRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "dropTable", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "dropEnum", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "getEnum", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( + "insertRecord", + "Delete", + "Are you sure?", + ); + _.entityExplorer.ActionContextMenuByEntityName( "selectRecords", "Delete", "Are you sure?", ); - ee.ActionContextMenuByEntityName("updateRecord", "Delete", "Are you sure?"); - deployMode.DeployApp(); - deployMode.NavigateBacktoEditor(); - ee.ExpandCollapseEntity("Queries/JS"); - dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); + _.entityExplorer.ActionContextMenuByEntityName( + "updateRecord", + "Delete", + "Are you sure?", + ); + + //Delete ds + _.deployMode.DeployApp(); + _.deployMode.NavigateBacktoEditor(); + _.entityExplorer.ExpandCollapseEntity("Queries/JS"); + _.dataSources.DeleteDatasouceFromWinthinDS(dsName, 200); }); }); diff --git a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.js b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.js index 15aed5793d..6ed61ee8a1 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ServerSideTests/QueryPane/Mongo_Spec.js @@ -416,9 +416,9 @@ describe("Create a query with a mongo datasource, run, save and then delete the "Insert Document(s)", ); - let nonAsciiDoc = `[{"_id":1, "Från" :"Raksha" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Basilika - Thai 'Siam Qu_.entityExplorern'"}, - {"_id":2, "Från" :"Vivek" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Sallad - Oakleaf 'Salad Bowl'"}, - {"_id":3, "Från" :"Prapulla" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Sallad - Oakleaf 'Red Salad Bowl'"}]`; + let nonAsciiDoc = `[{"_id":1, "Från" :"Alen" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Basilika - Thai 'Siam Qu_.entityExplorern'"}, + {"_id":2, "Från" :"Joann" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Sallad - Oakleaf 'Salad Bowl'"}, + {"_id":3, "Från" :"Olivia" , "Frõ" :"Active", "Leverantör":"De Bolster", "Frö":"Sallad - Oakleaf 'Red Salad Bowl'"}]`; _.agHelper.EnterValue("NonAsciiTest", { propFieldName: "", @@ -580,7 +580,8 @@ describe("Create a query with a mongo datasource, run, save and then delete the "Raw", ); cy.typeValueNValidate('{"drop": "NonAsciiTest"}', formControls.rawBody); - _.dataSources.RunQuery(); + cy.wait(1000); //Waiting a bit before runing the command + _.dataSources.RunQuery(true, true, 2000); cy.CheckAndUnfoldEntityItem("Datasources"); cy.get("@dSName").then((dbName) => { cy.actionContextMenuByEntityName(dbName, "Refresh"); diff --git a/app/client/cypress/locators/WidgetLocators.ts b/app/client/cypress/locators/WidgetLocators.ts index f1ff29c49d..8bd6d8ee88 100644 --- a/app/client/cypress/locators/WidgetLocators.ts +++ b/app/client/cypress/locators/WidgetLocators.ts @@ -20,6 +20,7 @@ export const WIDGET = { RATING: "ratewidget", CHECKBOXGROUP: "checkboxgroupwidget", CHECKBOX: "checkboxwidget", + CHART: "chartwidget", AUDIO: "audiowidget", AUDIORECORDER: "audiorecorderwidget", PHONEINPUT: "phoneinputwidget", diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 45e7f3dfc4..7c88947c01 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -1,13 +1,22 @@ import datasourceFormData from "../../fixtures/datasources.json"; import { ObjectsRegistry } from "../Objects/Registry"; +import { WIDGET } from "../../locators/WidgetLocators"; const DataSourceKVP = { Postgres: "PostgreSQL", Mongo: "MongoDB", MySql: "MySQL", UnAuthenticatedGraphQL: "GraphQL API", + MsSql: "Microsoft SQL Server", }; //DataSources KeyValuePair +export enum Widgets { + Dropdown, + Table, + Chart, + Text, +} + export class DataSources { private agHelper = ObjectsRegistry.AggregateHelper; private table = ObjectsRegistry.Table; @@ -125,7 +134,8 @@ export class DataSources { _getStructureReq = "/api/v1/datasources/*/structure?ignoreCache=true"; _editDatasourceFromActiveTab = (dsName: string) => ".t--datasource-name:contains('" + dsName + "')"; - public _urlInputControl = "input[name='url']"; + private _suggestedWidget = (widgetType: string) => + ".t--suggested-widget-" + widgetType + ""; // Authenticated API locators private _authApiDatasource = ".t--createAuthApiDatasource"; @@ -147,13 +157,11 @@ export class DataSources { public _datasourceModalSave = ".t--datasource-modal-save"; public _datasourceModalDoNotSave = ".t--datasource-modal-do-not-save"; public _deleteDatasourceButton = ".t--delete-datasource"; + public _urlInputControl = "input[name='url']"; - public AssertViewMode() { - this.agHelper.AssertElementExist(this._editButton); - } - - public AssertEditMode() { - this.agHelper.AssertElementAbsence(this._editButton); + public AssertDSEditViewMode(mode: "Edit" | "View") { + if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton); + else if (mode == "View") this.agHelper.AssertElementExist(this._editButton); } public GeneratePageWithMockDB() { @@ -375,6 +383,31 @@ export class DataSources { cy.get(this._password).type(datasourceFormData["mysql-password"]); } + public FillMsSqlDSForm() { + this.agHelper.UpdateInputValue( + this._host, + datasourceFormData["mssql-host"], + ); + this.agHelper.UpdateInputValue( + this._port, + datasourceFormData["mssql-port"].toString(), + ); + this.agHelper.ClearTextField(this._databaseName); + // this.agHelper.UpdateInputValue( + // this._databaseName, + // datasourceFormData["mssql-databaseName"], + // ); //Commenting until MsSQL is init loaded into container + this.ExpandSectionByName(this._sectionAuthentication); + this.agHelper.UpdateInputValue( + this._username, + datasourceFormData["mssql-username"], + ); + this.agHelper.UpdateInputValue( + this._password, + datasourceFormData["mssql-password"], + ); + } + public FillFirestoreDSForm() { cy.xpath(this.locator._inputFieldByName("Database URL") + "//input").type( datasourceFormData["database-url"], @@ -684,7 +717,7 @@ export class DataSources { } public CreateDataSource( - dsType: "Postgres" | "Mongo" | "MySql" | "UnAuthenticatedGraphQL", + dsType: "Postgres" | "Mongo" | "MySql" | "UnAuthenticatedGraphQL" | "MsSql", navigateToCreateNewDs = true, testNSave = true, ) { @@ -702,6 +735,8 @@ export class DataSources { if (DataSourceKVP[dsType] == "PostgreSQL") this.FillPostgresDSForm(); else if (DataSourceKVP[dsType] == "MySQL") this.FillMySqlDSForm(); else if (DataSourceKVP[dsType] == "MongoDB") this.FillMongoDSForm(); + else if (DataSourceKVP[dsType] == "Microsoft SQL Server") + this.FillMsSqlDSForm(); if (testNSave) { this.TestSaveDatasource(); @@ -854,8 +889,10 @@ export class DataSources { } public FillAuthAPIUrl() { - const URL = datasourceFormData["authenticatedApiUrl"]; - this.agHelper.TypeText(this._urlInputControl, URL); + this.agHelper.UpdateInput( + this.locator._inputFieldByName("URL"), + datasourceFormData.authenticatedApiUrl, + ); } public AssertCursorPositionForTextInput( @@ -864,10 +901,8 @@ export class DataSources { typeText = "as", cursorPosition = 0, ) { - const locator = selector.startsWith("//") - ? cy.xpath(selector) - : cy.get(selector); - locator + this.agHelper + .GetElement(selector) .type(moveCursor) .type(typeText) .should("have.prop", "selectionStart", cursorPosition); @@ -1007,4 +1042,33 @@ export class DataSources { datasourceFormData["OAuth_AuthUrl"], ); } + + public AddSuggesstedWidget(widget: Widgets) { + switch (widget) { + case Widgets.Dropdown: + this.agHelper.GetNClick(this._suggestedWidget("SELECT_WIDGET")); + this.agHelper.AssertElementVisible( + this.locator._widgetInCanvas(WIDGET.SELECT), + ); + break; + case Widgets.Table: + this.agHelper.GetNClick(this._suggestedWidget("TABLE_WIDGET_V2")); + this.agHelper.AssertElementVisible( + this.locator._widgetInCanvas(WIDGET.TABLE), + ); + break; + case Widgets.Chart: + this.agHelper.GetNClick(this._suggestedWidget("CHART_WIDGET")); + this.agHelper.AssertElementVisible( + this.locator._widgetInCanvas(WIDGET.CHART), + ); + break; + case Widgets.Text: + this.agHelper.GetNClick(this._suggestedWidget("TEXT_WIDGET")); + this.agHelper.AssertElementVisible( + this.locator._widgetInCanvas(WIDGET.TEXT), + ); + break; + } + } } diff --git a/app/client/public/tinymce/tinymce.min.js b/app/client/public/tinymce/tinymce.min.js index 750e5cacd8..559b5304d1 100644 --- a/app/client/public/tinymce/tinymce.min.js +++ b/app/client/public/tinymce/tinymce.min.js @@ -10869,12 +10869,10 @@ function u(e, t) { h.removeByUri(e.src), n(e.src, t), - o - .$(e) - .attr({ - src: kf(o) ? t + "?" + new Date().getTime() : t, - "data-mce-src": o.convertURL(t, "src"), - }); + o.$(e).attr({ + src: kf(o) ? t + "?" + new Date().getTime() : t, + "data-mce-src": o.convertURL(t, "src"), + }); } function s(n) { return (