test: Cypess | Oracle DS validations added (Part 3) + CI Stabilize (#27326)

## Description
- This PR does below:
- Oracle - Create new table, insert data & select. tc #
[2358](https://github.com/appsmithorg/TestSmith/issues/2358) tc #
[2360](https://github.com/appsmithorg/TestSmith/issues/2358)
- Oracle - Alter the new table for 2 new columns, insert multiple rows
into table
- Oracle - Select * from table & select with condition tc #
[2359](https://github.com/appsmithorg/TestSmith/issues/2359)
- Oracle - Add table widget from Suggested widget section, Deploy the
app & verify table data load
- Oracle - Back to Editor, Delete all queries, Delete DS
- Failure fix - ClientSide/Git/GitSync/Connection_spec.js fo CI runs

#### Type of change
- Script fix + update (non-breaking change which fixes an issue)

## Testing
#### How Has This Been Tested?
- [X] Cypress CI runs

## Checklist:
#### QA activity:
- [X] Added `Test Plan Approved` label after Cypress tests were reviewed
This commit is contained in:
Aishwarya-U-R 2023-09-15 14:06:23 +05:30 committed by GitHub
parent 469a78fb1a
commit 74f67fbfdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 274 additions and 37 deletions

View File

@ -207,7 +207,7 @@ jobs:
- name: Print cypress dashboard url
id: dashboard_url
run: |
cypress_url=$(cat ~/cypress_url)
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
# Download failed_spec list for all jobs
@ -306,7 +306,7 @@ jobs:
- name: Print cypress dashboard url
id: dashboard_url
run: |
cypress_url=$(cat ~/cypress_url)
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
# Download failed_spec list for all jobs

View File

@ -118,7 +118,7 @@ jobs:
continue-on-error: true
id: dashboard_url
run: |
cypress_url=$(cat ~/cypress_url)
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
# Download failed_spec list for all jobs

View File

@ -118,7 +118,7 @@ jobs:
continue-on-error: true
id: dashboard_url
run: |
cypress_url=$(cat ~/cypress_url)
cypress_url="https://internal.appsmith.com/app/cypressdashboard/rundetails-64ec3df0c632e24c00764938?branch=master&workflowId=${{ github.run_id }}&attempt=${{ github.run_attempt }}"
echo "dashboard_url=$cypress_url" >> $GITHUB_OUTPUT
# Download failed_spec list for all jobs

View File

@ -5,12 +5,9 @@ import * as _ from "../../../../../support/Objects/ObjectsCore";
const httpsRepoURL = "https://github.com/test/test.git";
const invalidURL = "test";
const invalidURLDetectedOnTheBackend = "test@";
const invalidEmail = "test";
const invalidEmailWithAmp = "test@hello";
const GITHUB_API_BASE = "https://api.github.com";
let repoName;
let generatedKey;
let windowOpenSpy;
@ -59,34 +56,11 @@ describe("Git sync modal: connect tab", function () {
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as(
"generateKey",
);
// Stubbing window.open
cy.window().then((window) => {
windowOpenSpy = cy.stub(window, "open").callsFake((url) => {
expect(url.startsWith("https://docs.appsmith.com/")).to.be.true;
windowOpenSpy.restore();
});
});
cy.get(gitSyncLocators.learnMoreSshUrl).click();
cy.get(gitSyncLocators.generateDeployKeyBtn).click();
cy.wait("@generateKey").then((result) => {
generatedKey = result.response.body.data.publicKey;
});
// generate key learn more
cy.window().then((window) => {
windowOpenSpy = cy.stub(window, "open").callsFake((url) => {
expect(
url.startsWith(
"https://docs.github.com/en/developers/overview/managing-deploy-keys",
),
).to.be.true;
windowOpenSpy.restore();
});
});
cy.xpath(gitSyncLocators.learnMoreDeployKey).click({ force: true });
});
it("2. validates copy key and validates repo url input after key generation", function () {
@ -95,7 +69,8 @@ describe("Git sync modal: connect tab", function () {
});
cy.get(gitSyncLocators.copySshKey).click();
cy.get(gitSyncLocators.gitRepoInput).type(`{selectAll}${httpsRepoURL}`);
cy.wait(2000);
cy.get(gitSyncLocators.gitRepoInput).clear().type(`${httpsRepoURL}`);
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO());
cy.get(gitSyncLocators.connectSubmitBtn).should("be.disabled");
@ -267,7 +242,6 @@ describe("Git sync modal: connect tab", function () {
});
after(() => {
//cy.deleteTestGithubRepo(repoName);
_.gitSync.DeleteTestGithubRepo(repoName);
});
});

View File

@ -0,0 +1,74 @@
import gitSyncLocators from "../../../../../locators/gitSyncLocators";
import homePage from "../../../../../locators/HomePage";
import * as _ from "../../../../../support/Objects/ObjectsCore";
const httpsRepoURL = "https://github.com/test/test.git";
const invalidURL = "test";
let repoName;
let generatedKey;
let windowOpenSpy;
describe("Git sync modal: Learn more links", function () {
it("1. validates repo URL", function () {
// open gitSync modal
cy.get(homePage.deployPopupOptionTrigger).click({ force: true });
cy.get(homePage.connectToGitBtn).click({ force: true });
cy.get(gitSyncLocators.gitRepoInput).type(`{selectAll}${httpsRepoURL}`);
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO());
cy.get(gitSyncLocators.generateDeployKeyBtn).should("not.exist");
cy.get(gitSyncLocators.gitRepoInput).type(`{selectAll}${invalidURL}`);
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO());
cy.get(gitSyncLocators.generateDeployKeyBtn).should("not.exist");
// generate key button should be disappeared if empty repo
cy.get(gitSyncLocators.gitRepoInput).type(`{selectAll}${""}`);
cy.get(gitSyncLocators.generateDeployKeyBtn).should("not.exist");
cy.get(gitSyncLocators.gitRepoInput).type(
`{selectAll}${_.dataManager.GITEA_API_URL_TED}/${repoName}.git`,
);
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO()).should(
"not.exist",
);
cy.get(gitSyncLocators.generateDeployKeyBtn).should("not.be.disabled");
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as(
"generateKey",
);
// Stubbing window.open
// cy.window().then((window) => {
// windowOpenSpy = cy.stub(window, "open").callsFake((url) => {
// expect(url.startsWith("https://docs.appsmith.com/")).to.be.true;
// windowOpenSpy.restore();
// });
// });
cy.window().then((window) => {
windowOpenSpy = cy.stub(window, "open").callsFake((url) => {
if (
url.includes("/version-control-with-git/connecting-to-git-repository")
) {
expect(url).to.contain(
"/version-control-with-git/connecting-to-git-repository",
);
} else if (url.includes("overview/managing-deploy-keys")) {
expect(url).to.contain("overview/managing-deploy-keys");
}
windowOpenSpy.restore();
});
});
// Click the "Learn More" link
cy.get(gitSyncLocators.learnMoreSshUrl).click();
cy.get(gitSyncLocators.generateDeployKeyBtn).click();
cy.wait("@generateKey").then((result) => {
generatedKey = result.response.body.data.publicKey;
});
cy.xpath(gitSyncLocators.learnMoreDeployKey).click({ force: true });
});
});

View File

@ -4,22 +4,24 @@ import {
propPane,
dataManager,
locators,
entityExplorer,
deployMode,
draggableWidgets,
table,
} from "../../../../support/Objects/ObjectsCore";
import { Widgets } from "../../../../support/Pages/DataSources";
describe("Validate Oracle DS", () => {
let dataSourceName: string;
let dataSourceName: string, guid: any;
before("Generate GUID", () => {
agHelper.GenerateUUID();
cy.get("@guid").then((uid) => {
guid = uid;
dataSourceName = "Oracle" + " " + uid;
});
});
after("Delete Oracle DS", () => {
dataSources.DeleteDatasouceFromActiveTab(dataSourceName);
});
it("1. Tc #2354, #2204 - Oracle placeholder & mandatory mark verification", () => {
dataSources.NavigateToDSCreateNew();
dataSources.CreatePlugIn("Oracle");
@ -107,4 +109,190 @@ describe("Validate Oracle DS", () => {
dataSources.AssertDSInActiveList(dataSourceName);
// });
});
it("3. Tc #2359, Tc # 2360 , Tc # 2358 - Create Insert, Alter & Select queries", () => {
dataSources.NavigateFromActiveDS(dataSourceName, true);
let query = `CREATE TABLE ${guid} (
aircraft_id NUMBER(5) PRIMARY KEY,
aircraft_type VARCHAR2(50) NOT NULL,
registration_number VARCHAR2(20) UNIQUE,
manufacturer VARCHAR2(50),
seating_capacity NUMBER(3),
maximum_speed NUMBER(5, 2),
range NUMBER(7, 2),
purchase_date DATE,
maintenance_last_date DATE,
notes CLOB
);`;
agHelper.RenameWithInPane("CreateAircraft");
dataSources.EnterQuery(query);
dataSources.RunQuery();
entityExplorer.ExpandCollapseEntity("Datasources");
entityExplorer.ExpandCollapseEntity(dataSourceName);
entityExplorer.ActionContextMenuByEntityName({
entityNameinLeftSidebar: dataSourceName,
action: "Refresh",
});
agHelper.AssertElementVisibility(
entityExplorer._entityNameInExplorer(guid.toUpperCase()),
);
query = `INSERT INTO ${guid} (
aircraft_id,
aircraft_type,
registration_number,
manufacturer,
seating_capacity,
maximum_speed,
range,
purchase_date,
maintenance_last_date,
notes) VALUES (
1,
'Cargo Plane',
'N12345',
'Boeing',
150,
550.03,
3500.30,
TO_DATE('2020-01-15', 'YYYY-MM-DD'),
TO_DATE('September 14, 2023', 'Month DD, YYYY'),
'This aircraft is used for domestic flights.');`;
entityExplorer.ActionTemplateMenuByEntityName(guid.toUpperCase(), "SELECT");
dataSources.RunQuery();
agHelper
.GetText(dataSources._noRecordFound)
.then(($noRecMsg) => expect($noRecMsg).to.eq("No data records to show"));
dataSources.EnterQuery(query);
dataSources.RunQuery();
let selectQuery = `SELECT * FROM ${guid} WHERE ROWNUM < 10`;
dataSources.EnterQuery(selectQuery);
dataSources.RunQueryNVerifyResponseViews();
query = `ALTER TABLE ${guid} ADD (raw_data RAW(16), maintenance_interval INTERVAL YEAR(3) TO MONTH);`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
query = `INSERT INTO ${guid} (
aircraft_id,
aircraft_type,
registration_number,
manufacturer,
seating_capacity,
maximum_speed,
range,
purchase_date,
maintenance_last_date,
notes,
raw_data,
maintenance_interval) VALUES (
4,
'Passenger Plane',
'N77777',
'Airbus',
100,
600.67,
3800.82,
TO_DATE('2017-05-25', 'YYYY-MM-DD'),
TO_DATE('2023-02-18', 'YYYY-MM-DD'),
'This aircraft is part of the international fleet.',
UTL_RAW.CAST_TO_RAW('raw_value'),
INTERVAL '1' YEAR(3) -- 1 year maintenance interval
);`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.EnterQuery(selectQuery);
dataSources.RunQueryNVerifyResponseViews(2);
query = `INSERT ALL
INTO ${guid} (
aircraft_id,
aircraft_type,
registration_number,
manufacturer,
seating_capacity,
maximum_speed,
range,
purchase_date,
maintenance_last_date,
notes,
raw_data,
maintenance_interval
)
VALUES (
5,
'Cargo Plane',
'N45678',
'Boeing',
280,
570.00,
5500.00,
TO_DATE('2018-08-30', 'YYYY-MM-DD'),
TO_DATE('2022-12-12', 'YYYY-MM-DD'),
'This cargo aircraft is used for long-haul freight.',
UTL_RAW.CAST_TO_RAW('cargo_raw_data'),
INTERVAL '2' YEAR(3) -- Two-year maintenance interval
)
INTO ${guid} (
aircraft_id,
aircraft_type,
registration_number,
manufacturer,
seating_capacity,
maximum_speed,
range,
purchase_date,
maintenance_last_date,
notes,
raw_data,
maintenance_interval
)
VALUES (
6,
'Helicopter',
'N98765',
'Robinson',
2,
150.00,
350.00,
TO_DATE('2019-06-15', 'YYYY-MM-DD'),
TO_DATE('2023-08-20', 'YYYY-MM-DD'),
'This helicopter is used for aerial photography.',
UTL_RAW.CAST_TO_RAW('helicopter_raw'),
INTERVAL '6' MONTH -- Six-month maintenance interval
);
SELECT * FROM DUAL;`;
dataSources.EnterQuery(query);
dataSources.RunQuery();
dataSources.EnterQuery(selectQuery);
dataSources.RunQueryNVerifyResponseViews(4);
selectQuery = selectQuery + ` and aircraft_id IN (1, 6)`;
dataSources.EnterQuery(selectQuery);
dataSources.RunQueryNVerifyResponseViews(2);
dataSources.AddSuggestedWidget(Widgets.Table);
deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.TABLE));
table.WaitUntilTableLoad(0, 0, "v2");
table.ReadTableRowColumnData(0, 10, "v2").then(($cellData) => {
expect($cellData).to.be.empty;
});
table.ReadTableRowColumnData(0, 11, "v2").then(($cellData) => {
expect($cellData).to.be.empty;
});
table.ReadTableRowColumnData(1, 10, "v2").then(($cellData) => {
expect($cellData).not.to.be.empty;
});
table.ReadTableRowColumnData(1, 11, "v2").then(($cellData) => {
expect($cellData).not.to.be.empty;
});
deployMode.NavigateBacktoEditor();
});
after(
"Verify Deletion of the Oracle datasource after all created queries are deleted",
() => {
dataSources.DeleteDatasouceFromWinthinDS(dataSourceName, 409); //Since all queries exists
entityExplorer.ExpandCollapseEntity("Queries/JS");
entityExplorer.DeleteAllQueriesForDB(dataSourceName);
deployMode.DeployApp();
deployMode.NavigateBacktoEditor();
entityExplorer.ExpandCollapseEntity("Queries/JS");
dataSources.DeleteDatasouceFromWinthinDS(dataSourceName, 200);
},
);
});

View File

@ -44,6 +44,7 @@ export class GitSync {
public _discardCallout = "[data-testid='t--discard-callout']";
public _gitStatusChanges = "[data-testid='t--git-change-statuses']";
private _gitSyncBranches = ".t--sync-branches";
learnMoreSshUrl = ".t--learn-more-ssh-url";
OpenGitSyncModal() {
this.agHelper.GetNClick(this._connectGitBottomBar);