Datasource test with basic profile added (#4374)
This commit is contained in:
parent
fc10625d41
commit
408517de39
|
|
@ -121,5 +121,6 @@
|
||||||
"clientSecret": "505dac16a21681f277b5fde97445be18",
|
"clientSecret": "505dac16a21681f277b5fde97445be18",
|
||||||
"accessTokenUrl": "https://oauth.mocklab.io/oauth/token",
|
"accessTokenUrl": "https://oauth.mocklab.io/oauth/token",
|
||||||
"oauthResponse": "169444434892406",
|
"oauthResponse": "169444434892406",
|
||||||
"authorizationURL": "https://oauth.mocklab.io/oauth/authorize"
|
"authorizationURL": "https://oauth.mocklab.io/oauth/authorize",
|
||||||
|
"basicURl": "https://envyenksqii9nf3.m.pipedream.net"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
const testdata = require("../../../../fixtures/testdata.json");
|
||||||
|
describe("Create a rest datasource", function() {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.startRoutesForDatasource();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create a rest datasource", function() {
|
||||||
|
cy.NavigateToAPI_Panel();
|
||||||
|
cy.CreateAPI("Testapi");
|
||||||
|
cy.enterDatasource(testdata.basicURl);
|
||||||
|
cy.get(".t--store-as-datasource").click();
|
||||||
|
cy.addBasicProfileDetails("test", "test@123");
|
||||||
|
cy.saveDatasource();
|
||||||
|
cy.contains(".datasource-highlight", "envyenksqii9nf3.m.pipedream.net");
|
||||||
|
cy.SaveAndRunAPI();
|
||||||
|
cy.wait(2000);
|
||||||
|
var encodedStringBtoA = btoa("test:test@123");
|
||||||
|
cy.log(encodedStringBtoA);
|
||||||
|
cy.ResponseStatusCheck(testdata.successStatusCode);
|
||||||
|
cy.ResponseTextCheck("Basic ".concat(encodedStringBtoA));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -35,5 +35,8 @@
|
||||||
"grantType": "[data-cy='authentication.grantType']",
|
"grantType": "[data-cy='authentication.grantType']",
|
||||||
"authorizationURL":"[data-cy='authentication.authorizationUrl'] input",
|
"authorizationURL":"[data-cy='authentication.authorizationUrl'] input",
|
||||||
"authorisecode": "//div[contains(@class,'option') and text()='Authorization Code']",
|
"authorisecode": "//div[contains(@class,'option') and text()='Authorization Code']",
|
||||||
"saveAndAuthorize": "button:contains('Save and Authorize')"
|
"saveAndAuthorize": "button:contains('Save and Authorize')",
|
||||||
|
"basic": "//div[contains(@class,'option') and text()='Basic']",
|
||||||
|
"basicUsername": "input[name='authentication.username']",
|
||||||
|
"basicPassword": "input[name='authentication.password']"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,13 @@ Cypress.Commands.add(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Cypress.Commands.add("addBasicProfileDetails", (username, password) => {
|
||||||
|
cy.get(datasource.authType).click();
|
||||||
|
cy.xpath(datasource.basic).click();
|
||||||
|
cy.get(datasource.basicUsername).type(username);
|
||||||
|
cy.get(datasource.basicPassword).type(password);
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("firestoreDatasourceForm", () => {
|
Cypress.Commands.add("firestoreDatasourceForm", () => {
|
||||||
cy.get(datasourceEditor.datasourceConfigUrl).type(
|
cy.get(datasourceEditor.datasourceConfigUrl).type(
|
||||||
datasourceFormData["database-url"],
|
datasourceFormData["database-url"],
|
||||||
|
|
@ -474,6 +481,11 @@ Cypress.Commands.add("ResponseCheck", (textTocheck) => {
|
||||||
cy.get(apiwidget.responseText).should("be.visible");
|
cy.get(apiwidget.responseText).should("be.visible");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add("ResponseTextCheck", (textTocheck) => {
|
||||||
|
cy.ResponseCheck();
|
||||||
|
cy.get(apiwidget.responseText).contains(textTocheck);
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("NavigateToAPI_Panel", () => {
|
Cypress.Commands.add("NavigateToAPI_Panel", () => {
|
||||||
cy.get(pages.addEntityAPI)
|
cy.get(pages.addEntityAPI)
|
||||||
.should("be.visible")
|
.should("be.visible")
|
||||||
|
|
@ -649,21 +661,20 @@ Cypress.Commands.add("SearchEntityandOpen", (apiname1) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("enterDatasourceAndPath", (datasource, path) => {
|
Cypress.Commands.add("enterDatasourceAndPath", (datasource, path) => {
|
||||||
cy.get(apiwidget.resourceUrl)
|
cy.enterDatasource(datasource);
|
||||||
.first()
|
|
||||||
.click({ force: true })
|
|
||||||
.type(datasource);
|
|
||||||
/*
|
|
||||||
cy.xpath(apiwidget.autoSuggest)
|
|
||||||
.first()
|
|
||||||
.click({ force: true });
|
|
||||||
*/
|
|
||||||
cy.get(apiwidget.editResourceUrl)
|
cy.get(apiwidget.editResourceUrl)
|
||||||
.first()
|
.first()
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
.type(path, { parseSpecialCharSequences: false });
|
.type(path, { parseSpecialCharSequences: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add("enterDatasource", (datasource) => {
|
||||||
|
cy.get(apiwidget.resourceUrl)
|
||||||
|
.first()
|
||||||
|
.click({ force: true })
|
||||||
|
.type(datasource);
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("changeZoomLevel", (zoomValue) => {
|
Cypress.Commands.add("changeZoomLevel", (zoomValue) => {
|
||||||
cy.get(commonlocators.changeZoomlevel)
|
cy.get(commonlocators.changeZoomlevel)
|
||||||
.last()
|
.last()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user