test: Cypress | Moving Non-TED containers within Tests (#24709)
- This PR improves the container start for
- Arango DB - Container started moved to test case level
- MsSql - Delete container added
- Elastic - Container started moved to test case level
- Starts container, runs tests, stops containers & deletes it too 🤞🏻
- Removed containers start from yml file
- Flaky fixes below:
- Apps/ReconnectDatasource_spec.js
- Improved FillPostgresDSForm()
- Script fix (non-breaking change which fixes an issue)
- [X] Cypress CI runs
- [X] Added `Test Plan Approved` label after all changes are reviewed
(cherry picked from commit 91325d258e)
This commit is contained in:
parent
b8ed81f393
commit
986c134df9
76
.github/workflows/ci-test-limited.yml
vendored
76
.github/workflows/ci-test-limited.yml
vendored
|
|
@ -30,7 +30,69 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
|
job:
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
22,
|
||||||
|
23,
|
||||||
|
24,
|
||||||
|
25,
|
||||||
|
26,
|
||||||
|
27,
|
||||||
|
28,
|
||||||
|
29,
|
||||||
|
30,
|
||||||
|
31,
|
||||||
|
32,
|
||||||
|
33,
|
||||||
|
34,
|
||||||
|
35,
|
||||||
|
36,
|
||||||
|
37,
|
||||||
|
38,
|
||||||
|
39,
|
||||||
|
40,
|
||||||
|
41,
|
||||||
|
42,
|
||||||
|
43,
|
||||||
|
44,
|
||||||
|
45,
|
||||||
|
46,
|
||||||
|
47,
|
||||||
|
48,
|
||||||
|
49,
|
||||||
|
50,
|
||||||
|
51,
|
||||||
|
52,
|
||||||
|
53,
|
||||||
|
54,
|
||||||
|
55,
|
||||||
|
56,
|
||||||
|
57,
|
||||||
|
58,
|
||||||
|
59,
|
||||||
|
]
|
||||||
|
|
||||||
# Service containers to run with this job. Required for running tests
|
# Service containers to run with this job. Required for running tests
|
||||||
services:
|
services:
|
||||||
|
|
@ -157,18 +219,6 @@ jobs:
|
||||||
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
|
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
|
||||||
cicontainer
|
cicontainer
|
||||||
|
|
||||||
- name: Setup MSSQL & Arango docker & ElasticSearch containers
|
|
||||||
working-directory: app/client/cypress
|
|
||||||
run: |
|
|
||||||
docker run --name=mssqldb -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Root@123" -p 1433:1433 -d mcr.microsoft.com/azure-sql-edge
|
|
||||||
docker run --name arangodb -e ARANGO_USERNAME=root -e ARANGO_ROOT_PASSWORD=Arango -p 8529:8529 -d arangodb
|
|
||||||
docker run --name elasticsearch -d -p 9200:9200 -e "discovery.type=single-node" -e "ELASTIC_USERNAME=elastic" -e "ELASTIC_PASSWORD=docker" -e "xpack.security.enabled=true" docker.elastic.co/elasticsearch/elasticsearch:7.16.2
|
|
||||||
# docker exec -i mssqldb /bin/bash -c "echo -e '[mysqld]\ntcpport=1433\ntcpnodelay=1' >> /var/opt/mssql/mssql.conf"
|
|
||||||
# docker restart mssqldb
|
|
||||||
# sudo ufw allow 1433/tcp
|
|
||||||
# docker cp init-mssql-dump-for-test.sql mssqldb:var/init-mssql-dump-for-test.sql
|
|
||||||
# docker exec -i mssqldb /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Root@123 -i /var/init-mssql-dump-for-test.sql
|
|
||||||
|
|
||||||
- name: Use Node.js 16.14.0
|
- name: Use Node.js 16.14.0
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
76
.github/workflows/ci-test.yml
vendored
76
.github/workflows/ci-test.yml
vendored
|
|
@ -24,7 +24,69 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
job: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
|
job:
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
20,
|
||||||
|
21,
|
||||||
|
22,
|
||||||
|
23,
|
||||||
|
24,
|
||||||
|
25,
|
||||||
|
26,
|
||||||
|
27,
|
||||||
|
28,
|
||||||
|
29,
|
||||||
|
30,
|
||||||
|
31,
|
||||||
|
32,
|
||||||
|
33,
|
||||||
|
34,
|
||||||
|
35,
|
||||||
|
36,
|
||||||
|
37,
|
||||||
|
38,
|
||||||
|
39,
|
||||||
|
40,
|
||||||
|
41,
|
||||||
|
42,
|
||||||
|
43,
|
||||||
|
44,
|
||||||
|
45,
|
||||||
|
46,
|
||||||
|
47,
|
||||||
|
48,
|
||||||
|
49,
|
||||||
|
50,
|
||||||
|
51,
|
||||||
|
52,
|
||||||
|
53,
|
||||||
|
54,
|
||||||
|
55,
|
||||||
|
56,
|
||||||
|
57,
|
||||||
|
58,
|
||||||
|
59,
|
||||||
|
]
|
||||||
|
|
||||||
# Service containers to run with this job. Required for running tests
|
# Service containers to run with this job. Required for running tests
|
||||||
services:
|
services:
|
||||||
|
|
@ -153,18 +215,6 @@ jobs:
|
||||||
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
|
--add-host=host.docker.internal:host-gateway --add-host=api.segment.io:host-gateway --add-host=t.appsmith.com:host-gateway \
|
||||||
cicontainer
|
cicontainer
|
||||||
|
|
||||||
- name: Setup MSSQL & Arango docker & ElasticSearch containers
|
|
||||||
working-directory: app/client/cypress
|
|
||||||
run: |
|
|
||||||
docker run --name=mssqldb -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Root@123" -p 1433:1433 -d mcr.microsoft.com/azure-sql-edge
|
|
||||||
docker run --name arangodb -e ARANGO_USERNAME=root -e ARANGO_ROOT_PASSWORD=Arango -p 8529:8529 -d arangodb
|
|
||||||
docker run --name elasticsearch -d -p 9200:9200 -e "discovery.type=single-node" -e "ELASTIC_USERNAME=elastic" -e "ELASTIC_PASSWORD=docker" -e "xpack.security.enabled=true" docker.elastic.co/elasticsearch/elasticsearch:7.16.2
|
|
||||||
# docker exec -i mssqldb /bin/bash -c "echo -e '[mysqld]\ntcpport=1433\ntcpnodelay=1' >> /var/opt/mssql/mssql.conf"
|
|
||||||
# docker restart mssqldb
|
|
||||||
# sudo ufw allow 1433/tcp
|
|
||||||
# docker cp init-mssql-dump-for-test.sql mssqldb:var/init-mssql-dump-for-test.sql
|
|
||||||
# docker exec -i mssqldb /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Root@123 -i /var/init-mssql-dump-for-test.sql
|
|
||||||
|
|
||||||
- name: Use Node.js 16.14.0
|
- name: Use Node.js 16.14.0
|
||||||
if: steps.run_result.outputs.run_result != 'success'
|
if: steps.run_result.outputs.run_result != 'success'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
const commonlocators = require("../../../../../locators/commonlocators.json");
|
|
||||||
const viewWidgetsPage = require("../../../../../locators/ViewWidgets.json");
|
const viewWidgetsPage = require("../../../../../locators/ViewWidgets.json");
|
||||||
const publish = require("../../../../../locators/publishWidgetspage.json");
|
|
||||||
const modalWidgetPage = require("../../../../../locators/ModalWidget.json");
|
|
||||||
const widgetsPage = require("../../../../../locators/Widgets.json");
|
const widgetsPage = require("../../../../../locators/Widgets.json");
|
||||||
import * as _ from "../../../../../support/Objects/ObjectsCore";
|
import * as _ from "../../../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
import {
|
import {
|
||||||
agHelper,
|
agHelper,
|
||||||
entityExplorer,
|
|
||||||
dataSources,
|
dataSources,
|
||||||
entityItems,
|
entityItems,
|
||||||
|
entityExplorer,
|
||||||
} from "../../../../support/Objects/ObjectsCore";
|
} from "../../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
let dsName: any, books: any;
|
|
||||||
describe("Validate Elasticsearch DS", () => {
|
describe("Validate Elasticsearch DS", () => {
|
||||||
|
let dsName: any,
|
||||||
|
books: any,
|
||||||
|
containerName = "elasticsearch1";
|
||||||
|
|
||||||
before("Create a new ElasticSearch DS", () => {
|
before("Create a new ElasticSearch DS", () => {
|
||||||
|
dataSources.StartContainerNVerify("Elasticsearch", containerName);
|
||||||
dataSources.CreateDataSource("Elasticsearch");
|
dataSources.CreateDataSource("Elasticsearch");
|
||||||
cy.get("@dsName").then(($dsName) => {
|
cy.get("@dsName").then(($dsName) => {
|
||||||
dsName = $dsName;
|
dsName = $dsName;
|
||||||
|
|
@ -201,5 +205,6 @@ describe("Validate Elasticsearch DS", () => {
|
||||||
action: "Delete",
|
action: "Delete",
|
||||||
entityType: entityItems.Datasource,
|
entityType: entityItems.Datasource,
|
||||||
});
|
});
|
||||||
|
dataSources.StopNDeleteContainer(containerName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,12 @@ import {
|
||||||
dataSources,
|
dataSources,
|
||||||
} from "../../../support/Objects/ObjectsCore";
|
} from "../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
let dsName: any,
|
|
||||||
collectionName = "countries_places_to_visit";
|
|
||||||
const tedUrl = "http://localhost:5001/v1/parent/cmd";
|
|
||||||
|
|
||||||
describe("Validate Arango & CURL Import Datasources", () => {
|
describe("Validate Arango & CURL Import Datasources", () => {
|
||||||
|
let dsName: any,
|
||||||
|
collectionName = "countries_places_to_visit",
|
||||||
|
containerName = "arangodb";
|
||||||
before("Create a new Arango DS", () => {
|
before("Create a new Arango DS", () => {
|
||||||
// let ArangoDB =
|
dataSources.StartContainerNVerify("Arango", containerName, 20000);
|
||||||
// "mkdir -p `$PWD`/arangodb/bin/bash;
|
|
||||||
// docker run --name arangodb -e ARANGO_USERNAME=root -e ARANGO_ROOT_PASSWORD=Arango -p 8529:8529 -v ~/arango/bin/bash:/arango/bin/bash -d arangodb";
|
|
||||||
// cy.request({
|
|
||||||
// method: "GET",
|
|
||||||
// url: tedUrl,
|
|
||||||
// qs: {
|
|
||||||
// cmd: ArangoDB,
|
|
||||||
// },
|
|
||||||
// }).then((res) => {
|
|
||||||
// cy.log("ContainerID", res.body.stdout);
|
|
||||||
// cy.log(res.body.stderr);
|
|
||||||
// expect(res.status).equal(200);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// //Wait for the container to be up
|
|
||||||
// agHelper.Sleep(10000);
|
|
||||||
|
|
||||||
dataSources.CreateDataSource("Arango");
|
dataSources.CreateDataSource("Arango");
|
||||||
cy.get("@dsName").then(($dsName) => {
|
cy.get("@dsName").then(($dsName) => {
|
||||||
dsName = $dsName;
|
dsName = $dsName;
|
||||||
|
|
@ -356,5 +338,7 @@ describe("Validate Arango & CURL Import Datasources", () => {
|
||||||
//Deleting datasource finally
|
//Deleting datasource finally
|
||||||
dataSources.DeleteDatasouceFromWinthinDS(dsName);
|
dataSources.DeleteDatasouceFromWinthinDS(dsName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dataSources.StopNDeleteContainer(containerName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,14 @@ import {
|
||||||
} from "../../../support/Objects/ObjectsCore";
|
} from "../../../support/Objects/ObjectsCore";
|
||||||
import { Widgets } from "../../../support/Pages/DataSources";
|
import { Widgets } from "../../../support/Pages/DataSources";
|
||||||
|
|
||||||
let dsName: any, query: string;
|
|
||||||
|
|
||||||
describe("Validate MsSQL connection & basic querying with UI flows", () => {
|
describe("Validate MsSQL connection & basic querying with UI flows", () => {
|
||||||
before("Create a new MySQL DS & adding data into it", () => {
|
let dsName: any,
|
||||||
|
query: string,
|
||||||
|
containerName = "mssqldb";
|
||||||
|
|
||||||
|
before("Create MsSql container & adding data into it", () => {
|
||||||
|
dataSources.StartContainerNVerify("MsSql", containerName, 20000);
|
||||||
|
|
||||||
dataSources.CreateDataSource("MsSql");
|
dataSources.CreateDataSource("MsSql");
|
||||||
cy.get("@dsName").then(($dsName) => {
|
cy.get("@dsName").then(($dsName) => {
|
||||||
dsName = $dsName;
|
dsName = $dsName;
|
||||||
|
|
@ -131,6 +135,7 @@ describe("Validate MsSQL connection & basic querying with UI flows", () => {
|
||||||
action: "Delete",
|
action: "Delete",
|
||||||
entityType: entityItems.Datasource,
|
entityType: entityItems.Datasource,
|
||||||
});
|
});
|
||||||
|
dataSources.StopNDeleteContainer(containerName);
|
||||||
});
|
});
|
||||||
|
|
||||||
function runQueryNValidate(query: string, columnHeaders: string[]) {
|
function runQueryNValidate(query: string, columnHeaders: string[]) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import homePage from "../../../locators/HomePage";
|
import homePageLocators from "../../../locators/HomePage";
|
||||||
import reconnectDatasourceModal from "../../../locators/ReconnectLocators";
|
|
||||||
const datasource = require("../../../locators/DatasourcesEditor.json");
|
|
||||||
import * as _ from "../../../support/Objects/ObjectsCore";
|
import * as _ from "../../../support/Objects/ObjectsCore";
|
||||||
|
import { homePage, dataSources } from "../../../support/Objects/ObjectsCore";
|
||||||
|
|
||||||
describe("Reconnect Datasource Modal validation while importing application", function () {
|
describe("Reconnect Datasource Modal validation while importing application", function () {
|
||||||
let workspaceId;
|
let workspaceId;
|
||||||
|
|
@ -9,7 +8,7 @@ describe("Reconnect Datasource Modal validation while importing application", fu
|
||||||
let newWorkspaceName;
|
let newWorkspaceName;
|
||||||
let appName;
|
let appName;
|
||||||
it("1. Import application from json with one postgres and success modal", function () {
|
it("1. Import application from json with one postgres and success modal", function () {
|
||||||
_.homePage.NavigateToHome();
|
homePage.NavigateToHome();
|
||||||
// import application
|
// import application
|
||||||
cy.generateUUID().then((uid) => {
|
cy.generateUUID().then((uid) => {
|
||||||
workspaceId = uid;
|
workspaceId = uid;
|
||||||
|
|
@ -17,10 +16,12 @@ describe("Reconnect Datasource Modal validation while importing application", fu
|
||||||
cy.createWorkspace();
|
cy.createWorkspace();
|
||||||
cy.wait("@createWorkspace").then((createWorkspaceInterception) => {
|
cy.wait("@createWorkspace").then((createWorkspaceInterception) => {
|
||||||
newWorkspaceName = createWorkspaceInterception.response.body.data.name;
|
newWorkspaceName = createWorkspaceInterception.response.body.data.name;
|
||||||
_.homePage.RenameWorkspace(newWorkspaceName, workspaceId);
|
homePage.RenameWorkspace(newWorkspaceName, workspaceId);
|
||||||
cy.get(homePage.workspaceImportAppOption).click({ force: true });
|
cy.get(homePageLocators.workspaceImportAppOption).click({
|
||||||
cy.get(homePage.workspaceImportAppModal).should("be.visible");
|
force: true,
|
||||||
cy.xpath(homePage.uploadLogo)
|
});
|
||||||
|
cy.get(homePageLocators.workspaceImportAppModal).should("be.visible");
|
||||||
|
cy.xpath(homePageLocators.uploadLogo)
|
||||||
.first()
|
.first()
|
||||||
.selectFile("cypress/fixtures/one_postgres.json", {
|
.selectFile("cypress/fixtures/one_postgres.json", {
|
||||||
force: true,
|
force: true,
|
||||||
|
|
@ -30,52 +31,16 @@ describe("Reconnect Datasource Modal validation while importing application", fu
|
||||||
// should check reconnect modal openning
|
// should check reconnect modal openning
|
||||||
const { isPartialImport } = interception.response.body.data;
|
const { isPartialImport } = interception.response.body.data;
|
||||||
if (isPartialImport) {
|
if (isPartialImport) {
|
||||||
// should reconnect modal
|
dataSources.ReconnectDataSource(
|
||||||
cy.get(reconnectDatasourceModal.Modal).should("be.visible");
|
|
||||||
cy.get(".t--ds-list .t--ds-list-title", {
|
|
||||||
withinSubject: null,
|
|
||||||
}).should("be.visible");
|
|
||||||
cy.get(".t--ds-list .t--ds-list-title").should(
|
|
||||||
"have.text",
|
|
||||||
"Untitled Datasource",
|
"Untitled Datasource",
|
||||||
|
"PostgreSQL",
|
||||||
);
|
);
|
||||||
// not configured yet
|
|
||||||
cy.get(".t--ds-list .ads-v2-icon").should("be.visible");
|
|
||||||
// check db type
|
|
||||||
cy.get(".t--ds-list").contains("PostgreSQL");
|
|
||||||
// check the postgres form config with default value
|
|
||||||
cy.get("[data-testid='section-Connection']").should("be.visible");
|
|
||||||
cy.get(datasource.authenticationSettingsSection).should(
|
|
||||||
"be.visible",
|
|
||||||
);
|
|
||||||
cy.get(datasource.sslSettingsSection).should("be.visible");
|
|
||||||
cy.get(
|
|
||||||
"[data-testid='datasourceConfiguration.connection.mode']",
|
|
||||||
).should("contain", "Read / Write");
|
|
||||||
cy.get(datasource.sslSettingsSection).click({ force: true });
|
|
||||||
// should expand ssl pan
|
|
||||||
cy.get(
|
|
||||||
"[data-testid='datasourceConfiguration.connection.ssl.authType']",
|
|
||||||
).should("contain", "Default");
|
|
||||||
|
|
||||||
cy.ReconnectDatasource("Untitled Datasource");
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.fillPostgresDatasourceForm();
|
|
||||||
cy.testDatasource(true);
|
|
||||||
cy.get(".t--save-datasource").click({ force: true });
|
|
||||||
cy.wait(2000);
|
|
||||||
|
|
||||||
// cy.get(reconnectDatasourceModal.SkipToAppBtn).click({
|
|
||||||
// force: true,
|
|
||||||
// });
|
|
||||||
// cy.wait(2000);
|
|
||||||
} else {
|
} else {
|
||||||
cy.get(homePage.toastMessage).should(
|
cy.get(homePageLocators.toastMessage).should(
|
||||||
"contain",
|
"contain",
|
||||||
"Application imported successfully",
|
"Application imported successfully",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
cy.wait("@getWorkspace");
|
|
||||||
// check datasource configured success modal
|
// check datasource configured success modal
|
||||||
cy.get(".t--import-app-success-modal").should("be.visible");
|
cy.get(".t--import-app-success-modal").should("be.visible");
|
||||||
cy.get(".t--import-app-success-modal").should(
|
cy.get(".t--import-app-success-modal").should(
|
||||||
|
|
@ -89,12 +54,12 @@ describe("Reconnect Datasource Modal validation while importing application", fu
|
||||||
const uuid = () => Cypress._.random(0, 1e4);
|
const uuid = () => Cypress._.random(0, 1e4);
|
||||||
const name = uuid();
|
const name = uuid();
|
||||||
appName = `app${name}`;
|
appName = `app${name}`;
|
||||||
cy.get(homePage.applicationName).click({ force: true });
|
cy.get(homePageLocators.applicationName).click({ force: true });
|
||||||
cy.get(".ads-v2-menu__menu-item-children:contains(Edit)")
|
cy.get(".ads-v2-menu__menu-item-children:contains(Edit)")
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.click();
|
.click();
|
||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
cy.get(homePage.applicationName)
|
cy.get(homePageLocators.applicationName)
|
||||||
// .clear()
|
// .clear()
|
||||||
.type(appName);
|
.type(appName);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -23,17 +23,33 @@ export class DefaultHostPort {
|
||||||
mssql_databaseName = "fakeapi";
|
mssql_databaseName = "fakeapi";
|
||||||
mssql_username = "SA";
|
mssql_username = "SA";
|
||||||
mssql_password = "Root@123";
|
mssql_password = "Root@123";
|
||||||
|
mssql_docker = (containerName: string) =>
|
||||||
|
`docker run --name=${containerName} -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=${
|
||||||
|
this.mssql_password
|
||||||
|
}" -p ${this.mssql_port.toString()}:${this.mssql_port.toString()} -d mcr.microsoft.com/azure-sql-edge`;
|
||||||
|
|
||||||
arango_host = "host.docker.internal";
|
arango_host = "host.docker.internal";
|
||||||
arango_port = 8529;
|
arango_port = 8529;
|
||||||
arango_databaseName = "_system";
|
arango_databaseName = "_system";
|
||||||
arango_username = "root";
|
arango_username = "root";
|
||||||
arango_password = "Arango";
|
arango_password = "Arango";
|
||||||
|
arango_docker = (containerName: string) =>
|
||||||
|
`docker run --name ${containerName} -e ARANGO_USERNAME=${
|
||||||
|
this.arango_username
|
||||||
|
} -e ARANGO_ROOT_PASSWORD=${
|
||||||
|
this.arango_password
|
||||||
|
} -p ${this.arango_port.toString()}:${this.arango_port.toString()} -d arangodb`;
|
||||||
|
|
||||||
elastic_host = "http://host.docker.internal";
|
elastic_host = "http://host.docker.internal";
|
||||||
elastic_port = 9200;
|
elastic_port = 9200;
|
||||||
elastic_username = "elastic";
|
elastic_username = "elastic";
|
||||||
elastic_password = "docker";
|
elastic_password = "docker";
|
||||||
|
elastic_docker = (containerName: string) =>
|
||||||
|
`docker run --name ${containerName} -d -p ${this.elastic_port.toString()}:${this.elastic_port.toString()} -e "discovery.type=single-node" -e "ELASTIC_USERNAME=${
|
||||||
|
this.elastic_username
|
||||||
|
}" -e "ELASTIC_PASSWORD=${
|
||||||
|
this.elastic_password
|
||||||
|
}" -e "xpack.security.enabled=true" docker.elastic.co/elasticsearch/elasticsearch:7.16.2`;
|
||||||
|
|
||||||
redshift_host = "localhost";
|
redshift_host = "localhost";
|
||||||
redshift_port = 543;
|
redshift_port = 543;
|
||||||
|
|
|
||||||
|
|
@ -821,10 +821,7 @@ export class AggregateHelper extends ReusableHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GetElementLength(selector: string) {
|
public GetElementLength(selector: string) {
|
||||||
const locator = selector.startsWith("//")
|
return this.GetElement(selector).its("length");
|
||||||
? cy.xpath(selector)
|
|
||||||
: cy.get(selector);
|
|
||||||
return locator.its("length");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sleep(timeout = 1000) {
|
public Sleep(timeout = 1000) {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,14 @@ export class DataSources {
|
||||||
private hp = ObjectsRegistry.DefaultHostPort;
|
private hp = ObjectsRegistry.DefaultHostPort;
|
||||||
private assertHelper = ObjectsRegistry.AssertHelper;
|
private assertHelper = ObjectsRegistry.AssertHelper;
|
||||||
|
|
||||||
|
public ContainerKVP = (containerName: string) => {
|
||||||
|
return {
|
||||||
|
MsSql: this.hp.mssql_docker(containerName),
|
||||||
|
Arango: this.hp.arango_docker(containerName),
|
||||||
|
Elasticsearch: this.hp.elastic_docker(containerName),
|
||||||
|
};
|
||||||
|
}; //Container KeyValuePair
|
||||||
|
|
||||||
private _dsCreateNewTab = "[data-testid=t--tab-CREATE_NEW]";
|
private _dsCreateNewTab = "[data-testid=t--tab-CREATE_NEW]";
|
||||||
private _addNewDataSource = ".t--entity-add-btn.datasources button";
|
private _addNewDataSource = ".t--entity-add-btn.datasources button";
|
||||||
private _createNewPlgin = (pluginName: string) =>
|
private _createNewPlgin = (pluginName: string) =>
|
||||||
|
|
@ -221,6 +229,8 @@ export class DataSources {
|
||||||
"[data-testid='t--where-clause-delete-[" + index + "]']";
|
"[data-testid='t--where-clause-delete-[" + index + "]']";
|
||||||
|
|
||||||
_bodyCodeMirror = "//div[contains(@class, 't--actionConfiguration.body')]";
|
_bodyCodeMirror = "//div[contains(@class, 't--actionConfiguration.body')]";
|
||||||
|
private _reconnectModalDSToolTip = ".t--ds-list .t--ds-list-title";
|
||||||
|
private _reconnectModalDSToopTipIcon = ".t--ds-list .ads-v2-icon";
|
||||||
|
|
||||||
public AssertDSEditViewMode(mode: "Edit" | "View") {
|
public AssertDSEditViewMode(mode: "Edit" | "View") {
|
||||||
if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton);
|
if (mode == "Edit") this.agHelper.AssertElementAbsence(this._editButton);
|
||||||
|
|
@ -437,6 +447,8 @@ export class DataSources {
|
||||||
cy.get(this._password).type(
|
cy.get(this._password).type(
|
||||||
password == "" ? this.hp.postgres_username : password,
|
password == "" ? this.hp.postgres_username : password,
|
||||||
);
|
);
|
||||||
|
this.ExpandSectionByName("SSL (optional)");
|
||||||
|
this.ValidateNSelectDropdown("SSL mode", "Default");
|
||||||
}
|
}
|
||||||
|
|
||||||
public FillOracleDSForm(
|
public FillOracleDSForm(
|
||||||
|
|
@ -567,7 +579,6 @@ export class DataSources {
|
||||||
|
|
||||||
public FillElasticSearchDSForm() {
|
public FillElasticSearchDSForm() {
|
||||||
this.agHelper.UpdateInputValue(this._host, this.hp.elastic_host);
|
this.agHelper.UpdateInputValue(this._host, this.hp.elastic_host);
|
||||||
|
|
||||||
this.agHelper.UpdateInputValue(this._port, this.hp.elastic_port.toString());
|
this.agHelper.UpdateInputValue(this._port, this.hp.elastic_port.toString());
|
||||||
this.ExpandSectionByName("Authentication");
|
this.ExpandSectionByName("Authentication");
|
||||||
this.agHelper.UpdateInputValue(this._username, this.hp.elastic_username);
|
this.agHelper.UpdateInputValue(this._username, this.hp.elastic_username);
|
||||||
|
|
@ -828,12 +839,23 @@ export class DataSources {
|
||||||
public ReconnectDataSource(dbName: string, dsName: "PostgreSQL" | "MySQL") {
|
public ReconnectDataSource(dbName: string, dsName: "PostgreSQL" | "MySQL") {
|
||||||
this.agHelper.AssertElementVisible(this._reconnectModal);
|
this.agHelper.AssertElementVisible(this._reconnectModal);
|
||||||
this.agHelper.AssertElementVisible(this._testDs); //Making sure modal is fully loaded
|
this.agHelper.AssertElementVisible(this._testDs); //Making sure modal is fully loaded
|
||||||
cy.xpath(this._activeDSListReconnectModal(dsName)).should("be.visible");
|
this.agHelper.AssertElementVisible(
|
||||||
cy.xpath(this._activeDSListReconnectModal(dbName)).should("be.visible"); //.click()
|
this._activeDSListReconnectModal(dsName),
|
||||||
|
);
|
||||||
|
this.agHelper.AssertElementVisible(
|
||||||
|
this._activeDSListReconnectModal(dbName),
|
||||||
|
);
|
||||||
|
|
||||||
|
//Checking if tooltip for Ds name & icon is present (useful in cases of long name for ds)
|
||||||
|
this.agHelper.AssertText(this._reconnectModalDSToolTip, "text", dbName);
|
||||||
|
this.agHelper.AssertElementVisible(this._reconnectModalDSToopTipIcon);
|
||||||
|
|
||||||
this.ValidateNSelectDropdown("Connection mode", "Read / Write");
|
this.ValidateNSelectDropdown("Connection mode", "Read / Write");
|
||||||
if (dsName == "PostgreSQL") this.FillPostgresDSForm();
|
if (dsName == "PostgreSQL") this.FillPostgresDSForm();
|
||||||
else if (dsName == "MySQL") this.FillMySqlDSForm();
|
else if (dsName == "MySQL") this.FillMySqlDSForm();
|
||||||
cy.get(this._saveDs).click();
|
this.agHelper.GetNClick(this._saveDs);
|
||||||
|
this.assertHelper.AssertNetworkStatus("@getPage", 200);
|
||||||
|
this.assertHelper.AssertNetworkStatus("getWorkspace");
|
||||||
}
|
}
|
||||||
|
|
||||||
RunQuery({
|
RunQuery({
|
||||||
|
|
@ -1341,4 +1363,64 @@ export class DataSources {
|
||||||
inputFieldName: fieldLabel,
|
inputFieldName: fieldLabel,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StopNDeleteContainer(containerName: string) {
|
||||||
|
// Stop the container
|
||||||
|
cy.exec(`docker stop ${containerName}`).then((stopResult) => {
|
||||||
|
cy.log("Output from stopping container:" + stopResult.stdout);
|
||||||
|
cy.log("Error from stopping container:" + stopResult.stderr);
|
||||||
|
|
||||||
|
// Delete the container
|
||||||
|
cy.exec(`docker rm ${containerName}`).then((deleteResult) => {
|
||||||
|
cy.log("Output from deleting container:" + deleteResult.stdout);
|
||||||
|
cy.log("Error from deleting container:" + deleteResult.stderr);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsContainerReady(containerName: string) {
|
||||||
|
return cy
|
||||||
|
.exec(`docker inspect -f '{{.State.Status}}' ${containerName}`)
|
||||||
|
.then((result) => {
|
||||||
|
const containerStatus = result.stdout.trim();
|
||||||
|
return containerStatus === "running";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public StartContainerNVerify(
|
||||||
|
containerType: "MsSql" | "Arango" | "Elasticsearch",
|
||||||
|
containerName: string,
|
||||||
|
timeout = 30000,
|
||||||
|
) {
|
||||||
|
let containerCommand = "";
|
||||||
|
switch (containerType) {
|
||||||
|
case "MsSql":
|
||||||
|
containerCommand = this.ContainerKVP(containerName).MsSql;
|
||||||
|
break;
|
||||||
|
case "Arango":
|
||||||
|
containerCommand = this.ContainerKVP(containerName).Arango;
|
||||||
|
break;
|
||||||
|
case "Elasticsearch":
|
||||||
|
containerCommand = this.ContainerKVP(containerName).Elasticsearch;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cy.exec(containerCommand).then((result) => {
|
||||||
|
// Wait for the container to be ready
|
||||||
|
cy.waitUntil(() => this.IsContainerReady(containerName), {
|
||||||
|
interval: 5000,
|
||||||
|
timeout: 60000,
|
||||||
|
}).then((isReady) => {
|
||||||
|
if (isReady) {
|
||||||
|
cy.log("Run id of started container is:" + result.stdout);
|
||||||
|
this.agHelper.Sleep(timeout); //allow some time for container to settle start for CI
|
||||||
|
} else
|
||||||
|
cy.log(
|
||||||
|
`Error from ${containerName} container start action:` +
|
||||||
|
result.stderr,
|
||||||
|
); // Container did not start properly within the timeout
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ Cypress.Commands.add("CreateAppInFirstListedWorkspace", (appname) => {
|
||||||
cy.wait(4000);
|
cy.wait(4000);
|
||||||
cy.get("#loading").should("not.exist");
|
cy.get("#loading").should("not.exist");
|
||||||
cy.get("#sidebar").should("be.visible");
|
cy.get("#sidebar").should("be.visible");
|
||||||
cy.wait("@updateLayout")
|
cy.wait("@getPluginForm") //replacing this since flaky in CI - to monitor
|
||||||
.its("response.body.responseMeta.status")
|
.its("response.body.responseMeta.status")
|
||||||
.should("eq", 200);
|
.should("eq", 200);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user