Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,34 @@ import {
apiPage,
} from "../../../support/Objects/ObjectsCore";

describe(
xdescribe(
"Create a rest datasource",
{
tags: ["@tag.Datasource", "@tag.Sanity", "@tag.Git", "@tag.AccessControl"],
},
function () {
it("1. Create a rest datasource + Bug 14566", function () {
//Issue: https://github.com/appsmithorg/appsmith/issues/37353 hence commenting test
it.skip("1. Create a rest datasource + Bug 14566", function () {
apiPage.CreateAndFillApi(testdata.baseUrl + testdata.methods);
cy.get(".t--store-as-datasource").click();
agHelper.WaitUntilEleAppear(apiPage._saveAsDS);
cy.get(apiPage._saveAsDS).click({ force: true });
Comment on lines +17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid using force: true in click operations

Replace the force click with proper element state verification:

 agHelper.WaitUntilEleAppear(apiPage._saveAsDS);
-cy.get(apiPage._saveAsDS).click({ force: true });
+cy.get(apiPage._saveAsDS)
+  .should('be.visible')
+  .and('be.enabled')
+  .click();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
agHelper.WaitUntilEleAppear(apiPage._saveAsDS);
cy.get(apiPage._saveAsDS).click({ force: true });
agHelper.WaitUntilEleAppear(apiPage._saveAsDS);
cy.get(apiPage._saveAsDS)
.should('be.visible')
.and('be.enabled')
.click();

//verifying there is no error toast, Bug 14566
agHelper.AssertElementAbsence(
locators._specificToast("Duplicate key error"),
); //verifying there is no error toast, Bug 14566
);
cy.testSelfSignedCertificateSettingsInREST(false);
cy.get("body").then((body) => {
if (
body.find('[value="http://host.docker.internal:5001"]').length < 1
) {
cy.contains(
".datasource-highlight",
"http://host.docker.internal:5001",
);
}
});
cy.saveDatasource();
cy.contains(".datasource-highlight", "http://host.docker.internal:5001"); //failing here since Save as Datasource is broken
cy.contains(".datasource-highlight", "http://host.docker.internal:5001");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use data attributes and avoid hardcoded values

Replace class selector with data attribute and use the URL from test data.

-cy.contains(".datasource-highlight", "http://host.docker.internal:5001");
+cy.get(apiPage._datasourceURLHighlight)
+  .should('contain', testdata.restApiUrl);

Committable suggestion skipped: line range outside the PR's diff.

cy.SaveAndRunAPI();
});
},
Expand Down