Datasource test with basic profile added (#4374)

This commit is contained in:
NandanAnantharamu 2021-05-10 17:27:54 +05:30 committed by GitHub
parent fc10625d41
commit 408517de39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 11 deletions

View File

@ -121,5 +121,6 @@
"clientSecret": "505dac16a21681f277b5fde97445be18",
"accessTokenUrl": "https://oauth.mocklab.io/oauth/token",
"oauthResponse": "169444434892406",
"authorizationURL": "https://oauth.mocklab.io/oauth/authorize"
"authorizationURL": "https://oauth.mocklab.io/oauth/authorize",
"basicURl": "https://envyenksqii9nf3.m.pipedream.net"
}

View File

@ -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));
});
});

View File

@ -35,5 +35,8 @@
"grantType": "[data-cy='authentication.grantType']",
"authorizationURL":"[data-cy='authentication.authorizationUrl'] input",
"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']"
}

View File

@ -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", () => {
cy.get(datasourceEditor.datasourceConfigUrl).type(
datasourceFormData["database-url"],
@ -474,6 +481,11 @@ Cypress.Commands.add("ResponseCheck", (textTocheck) => {
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", () => {
cy.get(pages.addEntityAPI)
.should("be.visible")
@ -649,21 +661,20 @@ Cypress.Commands.add("SearchEntityandOpen", (apiname1) => {
});
Cypress.Commands.add("enterDatasourceAndPath", (datasource, path) => {
cy.get(apiwidget.resourceUrl)
.first()
.click({ force: true })
.type(datasource);
/*
cy.xpath(apiwidget.autoSuggest)
.first()
.click({ force: true });
*/
cy.enterDatasource(datasource);
cy.get(apiwidget.editResourceUrl)
.first()
.click({ force: true })
.type(path, { parseSpecialCharSequences: false });
});
Cypress.Commands.add("enterDatasource", (datasource) => {
cy.get(apiwidget.resourceUrl)
.first()
.click({ force: true })
.type(datasource);
});
Cypress.Commands.add("changeZoomLevel", (zoomValue) => {
cy.get(commonlocators.changeZoomlevel)
.last()