Removed redundant tests.
Added all verb tests to same spec file. Added pagination test. updated beforeEach in index file.
This commit is contained in:
parent
16652c0b4c
commit
a102ca9d6f
|
|
@ -30,5 +30,7 @@
|
|||
"putAction": "//div[contains(@id,'react-select') and contains(text(),'PUT')]",
|
||||
"postAction": "//div[contains(@id,'react-select') and contains(text(),'POST')]",
|
||||
"patchAction": "//div[contains(@id,'react-select') and contains(text(),'PATCH')]",
|
||||
"moustacheMethod": "{{Api.text}}"
|
||||
"moustacheMethod": "{{Api.text}}",
|
||||
"nextUrl": ".data.next}}",
|
||||
"prevUrl": ".data.previous}}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
|
||||
describe("Test Add blank API flow", function() {
|
||||
it("Test Add blank API flow", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.testCreateApiButton();
|
||||
cy.get("@createNewApi").then(response => {
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField).should(
|
||||
"have.value",
|
||||
response.response.body.data.name,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
|
||||
describe("Test Add blank API and delete flow", function() {
|
||||
it("Test Add blank API and delete flow", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.testCreateApiButton();
|
||||
cy.get("@createNewApi").then(httpResponse => {
|
||||
cy.expect(httpResponse.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField).should(
|
||||
"have.value",
|
||||
httpResponse.response.body.data.name,
|
||||
);
|
||||
});
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
cy.get(ApiEditor.ApiDeleteBtn).click();
|
||||
cy.get(ApiEditor.ApiDeleteBtn).should("be.disabled");
|
||||
cy.testDeleteApi();
|
||||
cy.get(ApiEditor.ApiHomePage).should("be.visible");
|
||||
cy.get(ApiEditor.formActionButtons).should("not.be.visible");
|
||||
cy.get("@deleteAction").then(httpResponse => {
|
||||
cy.expect(httpResponse.response.body.responseMeta.success).to.eq(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
|
||||
describe("Test Add api blank and execute api flow", function() {
|
||||
it("Test Add blank api and execute api by selecting available datasource", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.testCreateApiButton();
|
||||
cy.get("@createNewApi").then(response => {
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField).should(
|
||||
"have.value",
|
||||
response.response.body.data.name,
|
||||
);
|
||||
});
|
||||
cy.get(ApiEditor.dataSourceField).click();
|
||||
cy.contains("https://jsonplaceholder.typicode.com/posts/1/comments").click({
|
||||
force: true,
|
||||
});
|
||||
/*
|
||||
cy.get(ApiEditor.ApiRunBtn).click();
|
||||
//cy.get(ApiEditor.ApiRunBtn).should("be.disabled");
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
*/
|
||||
cy.SaveAPI();
|
||||
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
||||
cy.get(ApiEditor.ApiRunBtn).should("not.be.disabled");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
|
||||
describe("Test curl import api and delete flow", function() {
|
||||
it("Test curl import api and delete flow", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.get(ApiEditor.curlImage).click({ force: true });
|
||||
cy.get("textarea").type(
|
||||
"curl -X GET http://app.appsmith.com/scrap/api?slugifiedName=Freshdesk&ownerName=volodimir.kudriachenko",
|
||||
);
|
||||
cy.importCurl();
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
cy.get("@curlImport").then(response => {
|
||||
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField).should(
|
||||
"have.value",
|
||||
response.response.body.data.name,
|
||||
);
|
||||
});
|
||||
cy.get(ApiEditor.ApiDeleteBtn).click();
|
||||
cy.get(ApiEditor.ApiDeleteBtn).should("be.disabled");
|
||||
cy.testDeleteApi();
|
||||
cy.get("@deleteAction").then(response => {
|
||||
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
});
|
||||
cy.get(ApiEditor.ApiHomePage).should("be.visible");
|
||||
cy.get(ApiEditor.formActionButtons).should("not.be.visible");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
|
||||
describe("Test curl import api and run flow", function() {
|
||||
it("Test curl import api and run flow", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.get(ApiEditor.curlImage).click({ force: true });
|
||||
cy.get("textarea").type(
|
||||
"curl -X GET http://app.appsmith.com/scrap/api?slugifiedName=Freshdesk&ownerName=volodimir.kudriachenko",
|
||||
);
|
||||
cy.importCurl();
|
||||
cy.get(ApiEditor.ApiNameField).should("be.visible");
|
||||
cy.get("@curlImport").then(httpResponse => {
|
||||
cy.expect(httpResponse.response.body.responseMeta.success).to.eq(true);
|
||||
cy.get(ApiEditor.ApiNameField).should(
|
||||
"have.value",
|
||||
httpResponse.response.body.data.name,
|
||||
);
|
||||
});
|
||||
/*
|
||||
cy.get(ApiEditor.ApiRunBtn).click();
|
||||
cy.get(ApiEditor.ApiRunBtn).should("be.disabled");
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
*/
|
||||
cy.SaveAPI();
|
||||
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
||||
cy.get("@postExecute").then(httpResponse => {
|
||||
cy.expect(httpResponse.response.body.responseMeta.success).to.eq(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
const ApiEditor = require("../../../locators/ApiEditor.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("Test curl import flow", function() {
|
||||
it("Test curl import flow", function() {
|
||||
it("Test curl import flow Run and Delete", function() {
|
||||
localStorage.setItem("ApiPaneV2", "ApiPaneV2");
|
||||
cy.NavigateToApiEditor();
|
||||
cy.get(ApiEditor.curlImage).click({ force: true });
|
||||
|
|
@ -17,5 +18,18 @@ describe("Test curl import flow", function() {
|
|||
response.response.body.data.name,
|
||||
);
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.get(ApiEditor.formActionButtons).should("be.visible");
|
||||
cy.get("@postExecute").then(httpResponse => {
|
||||
cy.expect(httpResponse.response.body.responseMeta.success).to.eq(true);
|
||||
});
|
||||
cy.get(ApiEditor.ApiDeleteBtn).click();
|
||||
cy.get(ApiEditor.ApiDeleteBtn).should("be.disabled");
|
||||
cy.testDeleteApi();
|
||||
cy.get("@deleteAction").then(response => {
|
||||
cy.expect(response.response.body.responseMeta.success).to.eq(true);
|
||||
});
|
||||
cy.get(ApiEditor.ApiHomePage).should("be.visible");
|
||||
cy.get(ApiEditor.formActionButtons).should("not.be.visible");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,152 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("API Panel Test Functionality", function() {
|
||||
afterEach(function() {
|
||||
cy.get(".t--apiFormDeleteBtn").click();
|
||||
cy.wait("@deleteAction").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
});
|
||||
|
||||
it("PUT Action test API fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.putAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodput,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/putjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("updatedAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
|
||||
it("Post Action test API fetaure", function() {
|
||||
cy.CreateSubsequentAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.postAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodpost,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/postjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("201 CREATED");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("createdAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
|
||||
it("PATCH Action test API fetaure", function() {
|
||||
cy.CreateSubsequentAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.patchAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodpatch,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/patchjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("updatedAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
|
||||
it("Test GET Action for mock API with header and pagination", function() {
|
||||
const apiname = "FirstAPI";
|
||||
cy.CreateSubsequentAPI(apiname);
|
||||
cy.log("Creation of API Action successful");
|
||||
cy.EnterSourceDetailsWithHeader(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.ResponseStatusCheck(testdata.successStatusCode);
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck(testdata.responsetext);
|
||||
cy.log("Response data check successful");
|
||||
cy.switchToPaginationTab();
|
||||
cy.selectPaginationType(apiwidget.paginationWithUrl);
|
||||
cy.enterUrl(apiname, apiwidget.panigationNextUrl, testdata.nextUrl);
|
||||
cy.clickTest(apiwidget.TestNextUrl);
|
||||
cy.ResponseStatusCheck(testdata.successStatusCode);
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("Josh M Krantz");
|
||||
cy.log("Response data check successful");
|
||||
cy.enterUrl(apiname, apiwidget.panigationPrevUrl, testdata.prevUrl);
|
||||
cy.clickTest(apiwidget.TestPreUrl);
|
||||
cy.ResponseStatusCheck(testdata.successStatusCode);
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck(testdata.responsetext);
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
|
||||
it("API check with query params test API fetaure", function() {
|
||||
cy.CreateSubsequentAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.EnterSourceDetailsWithQueryParam(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
testdata.queryKey,
|
||||
testdata.queryValue,
|
||||
);
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck(testdata.responsetext3);
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
|
||||
it("API check with Invalid Header", function() {
|
||||
cy.CreateSubsequentAPI("FirstAPI");
|
||||
cy.log("Creation of SecondAPI Action successful");
|
||||
cy.EnterSourceDetailsWithQueryParam(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValueBlank,
|
||||
testdata.queryKey,
|
||||
testdata.queryValue,
|
||||
);
|
||||
cy.ResponseStatusCheck("5000");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("Invalid value for Content-Type");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
describe("API Panel Test Functionality ", function() {
|
||||
it("Test API copy fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.CopyAPIToHome("FirstAPI");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
describe("API Panel Test Functionality ", function() {
|
||||
it("Test API delete fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.DeleteAPI("FirstAPI");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
describe("API Panel Test Functionality ", function() {
|
||||
it("Test API Move To Home fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.MoveAPIToHome("FirstAPI");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("API Panel Test Functionality", function() {
|
||||
it("PUT Action test API fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.putAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodput,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/putjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("updatedAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("API Panel Test Functionality", function() {
|
||||
it("PATCH Action test API fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.patchAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodpatch,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/patchjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("updatedAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("API Panel Test Functionality", function() {
|
||||
it("Post Action test API fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.SelectAction(testdata.postAction);
|
||||
cy.EnterSourceDetailsWithbody(
|
||||
testdata.baseUrl2,
|
||||
testdata.methodpost,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.readFile("cypress/fixtures/postjson.txt").then(json => {
|
||||
cy.log(json);
|
||||
cy.xpath(apiwidget.postbody)
|
||||
.click({ force: true })
|
||||
.focus()
|
||||
.type(json, { force: true });
|
||||
});
|
||||
cy.SaveAPI();
|
||||
cy.ResponseStatusCheck("201 CREATED");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("createdAt");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
const apiwidget = require("../../../locators/apiWidgetslocator.json");
|
||||
|
||||
describe("API Panel Test Functionality", function() {
|
||||
it("API check with query params test API fetaure", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.EnterSourceDetailsWithQueryParam(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
testdata.queryKey,
|
||||
testdata.queryValue,
|
||||
);
|
||||
cy.ResponseStatusCheck("200 OK");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck(testdata.responsetext3);
|
||||
cy.log("Response data check successful");
|
||||
cy.DeleteAPI();
|
||||
cy.CreateAPI("SecondAPI");
|
||||
cy.log("Creation of SecondAPI Action successful");
|
||||
cy.EnterSourceDetailsWithQueryParam(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValueBlank,
|
||||
testdata.queryKey,
|
||||
testdata.queryValue,
|
||||
);
|
||||
cy.ResponseStatusCheck("5000");
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck("Invalid value for Content-Type");
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/// <reference types="Cypress" />
|
||||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
describe("API Panel Test Functionality ", function() {
|
||||
it("Test GET Action for mock API with header", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.viewport("macbook-15");
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("TestAPINew");
|
||||
cy.log("Creation of API Action successful");
|
||||
cy.EnterSourceDetailsWithHeader(
|
||||
testdata.baseUrl,
|
||||
testdata.methods,
|
||||
testdata.headerKey,
|
||||
testdata.headerValue,
|
||||
);
|
||||
cy.ResponseStatusCheck(testdata.successStatusCode);
|
||||
cy.log("Response code check successful");
|
||||
cy.ResponseCheck(testdata.responsetext);
|
||||
cy.log("Response data check successful");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
const testdata = require("../../../fixtures/testdata.json");
|
||||
|
||||
describe("API Panel Test Functionality ", function() {
|
||||
it("Test API Name uniqueness fetaure", function() {
|
||||
it("Test API copy/Move/delete feature", function() {
|
||||
cy.log("Login Successful");
|
||||
cy.viewport("macbook-15"); //To avoid screen Resize issues
|
||||
cy.NavigateToAPI_Panel();
|
||||
cy.log("Navigation to API Panel screen successful");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.CopyAPIToHome("FirstAPI");
|
||||
cy.DeleteAPI("FirstAPI");
|
||||
cy.MoveAPIToPage();
|
||||
cy.DeleteAPI("FirstAPI");
|
||||
cy.CreateAPI("FirstAPI");
|
||||
cy.log("Creation of FirstAPI Action successful");
|
||||
cy.CreationOfUniqueAPIcheck("FirstAPI");
|
||||
});
|
||||
});
|
||||
|
|
@ -32,3 +32,12 @@ describe("Table Widget Functionality", function() {
|
|||
// put your clean up code if any
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.on("test:after:run", attributes => {
|
||||
/* eslint-disable no-console */
|
||||
console.log(
|
||||
'Test "%s" has finished in %dms',
|
||||
attributes.title,
|
||||
attributes.duration,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,5 +23,14 @@
|
|||
"marketPlaceapi": ".t--eachProviderCard p",
|
||||
"addPageButton": ".t--addToPageBtn",
|
||||
"apidocumentaionLink": ".linkStyles",
|
||||
"postbody": "(//div[contains(@class,'CodeMirror-wrap')]//textarea)[1]"
|
||||
"postbody": "(//div[contains(@class,'CodeMirror-wrap')]//textarea)[1]",
|
||||
"paginationTab": "li:contains('Pagination')",
|
||||
"apiInputTab": "li:contains('API Input')",
|
||||
"paginationOption": ".t--apiFormPaginationType div>input",
|
||||
"paginationWithTable": "//div[contains(@id,'react') and contains(text(),'Paginate with Table Page No')] ",
|
||||
"paginationWithUrl": "//div[contains(@id,'react') and contains(text(),'Paginate with Response Url')]",
|
||||
"panigationNextUrl": ".t--apiFormPaginationNext div>textarea",
|
||||
"panigationPrevUrl": ".t--apiFormPaginationPrev div>textarea",
|
||||
"TestNextUrl": ".t--apiFormPaginationNextTest",
|
||||
"TestPreUrl": ".t--apiFormPaginationPrevTest"
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ const LayoutPage = require("../locators/Layout.json");
|
|||
const formWidgetsPage = require("../locators/FormWidgets.json");
|
||||
const ApiEditor = require("../locators/ApiEditor.json");
|
||||
const apiwidget = require("../locators/apiWidgetslocator.json");
|
||||
let pageidcopy = " ";
|
||||
|
||||
Cypress.Commands.add("CreateApp", appname => {
|
||||
cy.get(homePage.CreateApp)
|
||||
|
|
@ -241,6 +242,40 @@ Cypress.Commands.add("EditSourceDetail", (baseUrl, v1method) => {
|
|||
cy.SaveAPI();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("switchToPaginationTab", () => {
|
||||
cy.get(apiwidget.paginationTab)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("switchToAPIInputTab", () => {
|
||||
cy.get(apiwidget.apiInputTab)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("selectPaginationType", option => {
|
||||
cy.get(apiwidget.paginationOption)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.xpath(option).click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("clickTest", testbutton => {
|
||||
cy.get(testbutton)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
});
|
||||
|
||||
Cypress.Commands.add("enterUrl", (apiname, url, value) => {
|
||||
cy.get(url)
|
||||
.first()
|
||||
.type("{{".concat(apiname).concat(value), {
|
||||
force: true,
|
||||
parseSpecialCharSequences: false,
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add(
|
||||
"EnterSourceDetailsWithQueryParam",
|
||||
(baseUrl, v1method, hKey, hValue, qKey, qValue) => {
|
||||
|
|
@ -309,6 +344,21 @@ Cypress.Commands.add("MoveAPIToHome", apiname => {
|
|||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("MoveAPIToPage", () => {
|
||||
cy.get(apiwidget.popover)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
cy.get(apiwidget.moveTo).click({ force: true });
|
||||
cy.get(
|
||||
".single-select >div:contains('".concat(pageidcopy).concat("')"),
|
||||
).click({ force: true });
|
||||
cy.wait("@createNewApi").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
201,
|
||||
);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("CopyAPIToHome", apiname => {
|
||||
cy.get(apiwidget.popover)
|
||||
.first()
|
||||
|
|
@ -507,6 +557,7 @@ Cypress.Commands.add("Createpage", Pagename => {
|
|||
cy.get(pages.editInput)
|
||||
.type(Pagename)
|
||||
.type("{Enter}");
|
||||
pageidcopy = Pagename;
|
||||
cy.get("#loading").should("not.exist");
|
||||
cy.wait(2000);
|
||||
});
|
||||
|
|
@ -539,6 +590,7 @@ Cypress.Commands.add("addDsl", dsl => {
|
|||
const myRegexp = /pages(.*)/;
|
||||
const match = myRegexp.exec(currentURL);
|
||||
pageid = match[1].split("/")[1];
|
||||
cy.log(pageidcopy + "page id copy");
|
||||
cy.log(pageid + "page id");
|
||||
//Fetch the layout id
|
||||
cy.server();
|
||||
|
|
@ -888,6 +940,67 @@ Cypress.Commands.add("pageNoValidate", index => {
|
|||
const pageVal = cy.get(data);
|
||||
return pageVal;
|
||||
});
|
||||
|
||||
Cypress.Commands.add("startServerAndRoutes", () => {
|
||||
cy.server();
|
||||
cy.route("GET", "/api/v1/applications").as("applications");
|
||||
cy.route("GET", "/api/v1/users/profile").as("getUser");
|
||||
cy.route("GET", "/api/v1/plugins").as("getPlugins");
|
||||
cy.route("POST", "/api/v1/logout").as("postLogout");
|
||||
|
||||
cy.route("GET", "/api/v1/configs/name/propertyPane").as("getPropertyPane");
|
||||
cy.route("GET", "/api/v1/datasources").as("getDataSources");
|
||||
cy.route("GET", "/api/v1/pages/application/*").as("getPagesForApp");
|
||||
cy.route("GET", "/api/v1/pages/*").as("getPage");
|
||||
cy.route("GET", "/api/v1/actions*").as("getActions");
|
||||
cy.route("GET", "api/v1/providers/categories").as("getCategories");
|
||||
cy.route("GET", "api/v1/import/templateCollections").as(
|
||||
"getTemplateCollections",
|
||||
);
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAPI");
|
||||
cy.route("DELETE", "/api/v1/applications/*").as("deleteApp");
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
||||
cy.route("DELETE", "/api/v1/pages/*").as("deletePage");
|
||||
|
||||
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
||||
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
||||
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
||||
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
||||
|
||||
cy.route("GET", "/api/v1/organizations").as("organizations");
|
||||
cy.route("POST", "/api/v1/actions/execute").as("executeAction");
|
||||
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
||||
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
|
||||
|
||||
cy.route("POST", "/v1/t").as("postSave");
|
||||
cy.route("PUT", "/api/v1/actions/*").as("putActions");
|
||||
cy.route("POST", "/track/*").as("postTrack");
|
||||
cy.route("POST", "/v1/m").as("postexe");
|
||||
cy.route("POST", "/api/v1/actions/execute").as("postExecute");
|
||||
cy.route("POST", "/api/v1/actions").as("postaction");
|
||||
|
||||
cy.route("POST", "/api/v1/actions").as("createNewApi");
|
||||
cy.route("POST", "/api/v1/import?type=CURL&pageId=*&name=*").as("curlImport");
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
||||
cy.route("GET", "/api/v1/marketplace/providers?category=*&page=*&size=*").as(
|
||||
"get3PProviders",
|
||||
);
|
||||
cy.route("GET", "/api/v1/marketplace/templates?providerId=*").as(
|
||||
"get3PProviderTemplates",
|
||||
);
|
||||
cy.route("POST", "/api/v1/items/addToPage").as("add3PApiToPage");
|
||||
|
||||
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
||||
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
||||
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
||||
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
||||
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
|
||||
|
||||
cy.route("PUT", "/api/v1/actions/*").as("saveQuery");
|
||||
});
|
||||
|
||||
Cypress.Commands.add("alertValidate", text => {
|
||||
cy.get(commonlocators.success)
|
||||
.should("be.visible")
|
||||
|
|
|
|||
|
|
@ -22,65 +22,8 @@ let appId;
|
|||
import "./commands";
|
||||
before(function() {
|
||||
console.log("**** Got Cypress base URL as: ", process.env.CYPRESS_BASE_URL);
|
||||
|
||||
cy.server();
|
||||
cy.route("GET", "/api/v1/applications").as("applications");
|
||||
cy.route("GET", "/api/v1/users/profile").as("getUser");
|
||||
cy.route("GET", "/api/v1/plugins").as("getPlugins");
|
||||
cy.route("POST", "/api/v1/logout").as("postLogout");
|
||||
|
||||
cy.route("GET", "/api/v1/configs/name/propertyPane").as("getPropertyPane");
|
||||
cy.route("GET", "/api/v1/datasources").as("getDataSources");
|
||||
cy.route("GET", "/api/v1/pages/application/*").as("getPagesForApp");
|
||||
cy.route("GET", "/api/v1/pages/*").as("getPage");
|
||||
cy.route("GET", "/api/v1/actions*").as("getActions");
|
||||
cy.route("GET", "api/v1/providers/categories").as("getCategories");
|
||||
cy.route("GET", "api/v1/import/templateCollections").as(
|
||||
"getTemplateCollections",
|
||||
);
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAPI");
|
||||
cy.route("DELETE", "/api/v1/applications/*").as("deleteApp");
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
||||
cy.route("DELETE", "/api/v1/pages/*").as("deletePage");
|
||||
|
||||
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
||||
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
||||
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
||||
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
||||
|
||||
cy.route("GET", "/api/v1/organizations").as("organizations");
|
||||
cy.route("POST", "/api/v1/actions/execute").as("executeAction");
|
||||
cy.route("POST", "/api/v1/applications/publish/*").as("publishApp");
|
||||
cy.route("PUT", "/api/v1/layouts/*/pages/*").as("updateLayout");
|
||||
|
||||
cy.route("POST", "/v1/t").as("postSave");
|
||||
cy.route("PUT", "/api/v1/actions/*").as("putActions");
|
||||
cy.route("POST", "/track/*").as("postTrack");
|
||||
cy.route("POST", "/v1/m").as("postexe");
|
||||
cy.route("POST", "/api/v1/actions/execute").as("postExecute");
|
||||
cy.route("POST", "/api/v1/actions").as("postaction");
|
||||
|
||||
cy.route("POST", "/api/v1/actions").as("createNewApi");
|
||||
cy.route("POST", "/api/v1/import?type=CURL&pageId=*&name=*").as("curlImport");
|
||||
cy.route("DELETE", "/api/v1/actions/*").as("deleteAction");
|
||||
cy.route("GET", "/api/v1/marketplace/providers?category=*&page=*&size=*").as(
|
||||
"get3PProviders",
|
||||
);
|
||||
cy.route("GET", "/api/v1/marketplace/templates?providerId=*").as(
|
||||
"get3PProviderTemplates",
|
||||
);
|
||||
cy.route("POST", "/api/v1/items/addToPage").as("add3PApiToPage");
|
||||
|
||||
cy.route("GET", "/api/v1/plugins/*/form").as("getPluginForm");
|
||||
cy.route("POST", "/api/v1/datasources").as("createDatasource");
|
||||
cy.route("POST", "/api/v1/datasources/test").as("testDatasource");
|
||||
cy.route("PUT", "/api/v1/datasources/*").as("saveDatasource");
|
||||
cy.route("DELETE", "/api/v1/datasources/*").as("deleteDatasource");
|
||||
cy.route("DELETE", "/api/v1/applications/*").as("deleteApplication");
|
||||
|
||||
cy.route("PUT", "/api/v1/actions/*").as("saveQuery");
|
||||
|
||||
cy.viewport("macbook-15");
|
||||
cy.startServerAndRoutes();
|
||||
cy.LogintoApp(loginData.username, loginData.password);
|
||||
// cy.SearchApp(inputData.appname)
|
||||
cy.generateUUID().then(id => {
|
||||
|
|
@ -103,6 +46,7 @@ before(function() {
|
|||
|
||||
beforeEach(function() {
|
||||
Cypress.Cookies.preserveOnce("SESSION", "remember_token");
|
||||
cy.startServerAndRoutes();
|
||||
});
|
||||
|
||||
after(function() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user