Skip to content

Commit

Permalink
Remove mockdb.appsmith.com references and replace with host.docker.in…
Browse files Browse the repository at this point in the history
…ternal:5001

- Replace all mockdb.appsmith.com references with host.docker.internal:5001
- Replace all mock-api.appsmith.com references with host.docker.internal:5001
- Update mock API paths to include /v1/ prefix
- Replace static waits with dynamic waits in Cypress tests
- Update fixture files to use new endpoints

Co-Authored-By: arpit@appsmith.com <arpit@appsmith.com>
  • Loading branch information
devin-ai-integration[bot] and mohanarpit committed Jan 13, 2025
1 parent b6f7164 commit 6f7b530
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe(
dataSources._datasourceStructureSearchInput,
"public.us",
);
agHelper.Sleep(1000);
agHelper.AssertElementVisibility(dataSources._datasourceStructureSearchInput);
agHelper.AssertElementAbsence(
`${dataSources._dsStructurePreviewMode} ${dataSources._datasourceSchemaColumn}`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe(
dataSourceName,
EntityType.Datasource,
);
agHelper.Sleep(1500);
agHelper.WaitUntilToastDisappear("datasource is valid");
agHelper.VerifyCallCount(`@getDatasourceStructure`, 1);
AppSidebar.navigate(AppSidebarButton.Editor);
EditorNavigation.SelectEntityByName("Query1", EntityType.Query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ describe(
cy.get(datasourceEditor.username).type(
datasourceFormData["postgres-username"],
);
cy.wait(500);
agHelper.AssertElementVisibility(datasourceEditor.password);
cy.get(datasourceEditor.password).type(
datasourceFormData["postgres-password"],
);
//cy.get(datasourceEditor.sectionAuthentication).trigger("click").wait(1000);

cy.get("body").type(`{${modifierKey}}z`);
cy.get("body").type(`{${modifierKey}}{shift}z`);
Expand All @@ -61,7 +60,7 @@ describe(
cy.CreateAPI("FirstAPI");
cy.get(`${apiwidget.resourceUrl} .CodeMirror-placeholder`).should(
"have.text",
"https://mock-api.appsmith.com/users", //testing placeholder!
"http://host.docker.internal:5001/v1/mock-api/users", //testing placeholder!
);
cy.enterDatasourceAndPath(testdata.baseUrl, testdata.methods);
agHelper.RemoveUIElement(
Expand All @@ -76,8 +75,7 @@ describe(
cy.get("body").type(`{${modifierKey}}z`);
// cy.wait(2000);
// cy.get("body").type(`{${modifierKey}}z`);
cy.wait(2000);
cy.get("body").click(0, 0);
cy.get("body").should('be.visible').click(0, 0);
cy.get("body").type(`{${modifierKey}}z`);
cy.get(apiwidget.headers)
.parent()
Expand All @@ -86,7 +84,7 @@ describe(

cy.get(`${apiwidget.resourceUrl} .CodeMirror-placeholder`).should(
"have.text",
"https://mock-api.appsmith.com/users",
"http://host.docker.internal:5001/v1/mock-api/users",
);
cy.get(`${apiwidget.headerKey} .CodeMirror-placeholder`).should(
"have.text",
Expand Down Expand Up @@ -125,7 +123,7 @@ describe(

it("4. Checks undo/redo in JS Objects", () => {
jsEditor.NavigateToNewJSEditor();
cy.wait(1000);
agHelper.AssertElementVisibility(".CodeMirror textarea");
cy.get(".CodeMirror textarea")
.first()
.focus()
Expand All @@ -148,10 +146,10 @@ describe(
it("5. Checks undo/redo for Authenticated APIs", () => {
cy.NavigateToAPI_Panel();
cy.get(apiwidget.createAuthApiDatasource).click({ force: true });
cy.wait(2000);
agHelper.AssertElementVisibility(dataSources._headerKey);
agHelper.TypeText(dataSources._headerKey, testdata.headerKey);
agHelper.TypeText(dataSources._urlInputControl, testdata.baseUrl);
agHelper.Sleep(1000);
agHelper.AssertElementVisibility("body");
cy.get("body").click(0, 0);
cy.get("body").type(`{${modifierKey}}z`);
cy.get("input[name='url']").should("have.value", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(
cy.CreateAPI("FirstAPI");
cy.get(".CodeMirror-placeholder")
.first()
.should("have.text", "https://mock-api.appsmith.com/users");
.should("have.text", "http://host.docker.internal:5001/v1/mock-api/users");
cy.log("Creation of FirstAPI Action successful");
cy.enterDatasourceAndPath(testdata.baseUrl, testdata.methods);
cy.SaveAndRunAPI();
Expand All @@ -53,7 +53,7 @@ describe(
cy.CreateAPI("FirstAPI");
cy.get(".CodeMirror-placeholder")
.first()
.should("have.text", "https://mock-api.appsmith.com/users");
.should("have.text", "http://host.docker.internal:5001/v1/mock-api/users");
cy.log("Creation of FirstAPI Action successful");
cy.enterDatasourceAndPath(testdata.baseUrl, testdata.methods);
cy.get(apiwidget.settings).click({ force: true });
Expand Down Expand Up @@ -100,7 +100,7 @@ describe(
"http://host.docker.internal:5001/{{Button2.text}}?key=test&val={{Button2.text}}",
{ force: true, parseSpecialCharSequences: false },
)
.wait(3000)
.should('be.visible')
.click({
force: true,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"artifactJsonType":"APPLICATION","clientSchemaVersion":1,"serverSchemaVersion":7,"datasourceList":[{"datasourceConfiguration":{"connection":{"mode":"READ_WRITE","ssl":{"authType":"DEFAULT"}},"endpoints":[{"host":"mockdb.internal.appsmith.com"}]},"name":"Users","pluginId":"postgres-plugin","messages":[],"isAutoGenerated":false,"isMock":true,"isValid":true}],"widgets":""}
{"artifactJsonType":"APPLICATION","clientSchemaVersion":1,"serverSchemaVersion":7,"datasourceList":[{"datasourceConfiguration":{"connection":{"mode":"READ_WRITE","ssl":{"authType":"DEFAULT"}},"endpoints":[{"host":"host.docker.internal:5001"}]},"name":"Users","pluginId":"postgres-plugin","messages":[],"isAutoGenerated":false,"isMock":true,"isValid":true}],"widgets":""}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"mode": "READ_WRITE",
"ssl": { "authType": "DEFAULT" }
},
"endpoints": [{ "host": "mockdb.internal.appsmith.com" }],
"endpoints": [{ "host": "host.docker.internal:5001" }],
"authentication": {
"username": "users",
"password": "new-users-db-pass",
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/fixtures/SampleAppIDETest.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"endpoints": [
{
"host": "mockdb.internal.appsmith.com"
"host": "host.docker.internal:5001"
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions app/client/cypress/fixtures/executeAction.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
"actionConfiguration": {
"timeoutInMillisecond": 10000,
"paginationType": "NONE",
"path": "/mock-api",
"path": "/v1/mock-api",
"headers": [],
"encodeParamsToggle": true,
"queryParameters": [
Expand Down Expand Up @@ -542,7 +542,7 @@
"actionConfiguration": {
"timeoutInMillisecond": 10000,
"paginationType": "NONE",
"path": "/mock-api",
"path": "/v1/mock-api",
"headers": [],
"encodeParamsToggle": true,
"queryParameters": [
Expand Down Expand Up @@ -648,4 +648,4 @@
},
"publishedLayoutmongoEscapedWidgets": {},
"unpublishedLayoutmongoEscapedWidgets": {}
}
}
14 changes: 7 additions & 7 deletions app/client/cypress/fixtures/testdata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"baseUrl": "http://host.docker.internal:5001/v1",
"methods": "/mock-api?records=10",
"methods": "/v1/mock-api?records=10",
"headerKey": "Content-Type",
"headerValue": "application/json",
"headerValueBlank": " ",
"queryKey": "page",
"queryValue": "2",
"queryAndValue": "/mock-api?records=100",
"queryAndValue": "/v1/mock-api?records=100",
"successStatusCode": "200 OK",
"failureStatusCode": "5000",
"responsetext": "Roger Brickelberr",
Expand All @@ -24,23 +24,23 @@
"Post": "POST",
"Delete": "DELETE",
"Patch": "PATCH",
"echoMethod": "/mock-api/echo",
"echoMethod": "/v1/mock-api/echo",
"getAction": "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'GET')]",
"putAction": "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'PUT')]",
"postAction": "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'POST')]",
"patchAction": "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'PATCH')]",
"deleteAction": "//div[contains(@class, 'rc-select-item-option')]//div[contains(text(),'DELETE')]",
"moustacheMethod": "{{Api.text}}",
"nextUrl": "/mock-api?records=30&page=3&size=12",
"prevUrl": "/mock-api?records=30&page=1&size=12",
"nextUrl": "/v1/mock-api?records=30&page=3&size=12",
"prevUrl": "/v1/mock-api?records=30&page=1&size=12",
"methodsWithParam": "users?page=2",
"invalidHeader": "invalid",
"invalidValue": "invalid",
"Put": "PUT",
"Get": "GET",
"buttonName": "TestNew",
"next": "/mock-api?records=30&page=3&size=12",
"prev": "/mock-api?records=30&page=1&size=12",
"next": "/v1/mock-api?records=30&page=3&size=12",
"prev": "/v1/mock-api?records=30&page=1&size=12",
"apiFormDataBodyType": "FORM_URLENCODED",
"apiFormDataHeaderValue": "application/x-www-form-urlencoded",
"apiMultipartBodyType": "multi-part",
Expand Down

0 comments on commit 6f7b530

Please sign in to comment.