Skip to content

Commit

Permalink
Updated automated test (#4623)
Browse files Browse the repository at this point in the history
* updated testcafe version

* formatted k6 tests

* formatted testcafe tests

* updated testcafe version

* updated deploy test that triggered false fails

* test commit for screenshots test

* removed only clause for the test

* new api tests in storage

* app owner tests

* formatted test
  • Loading branch information
jeevananthank authored Aug 18, 2020
1 parent b72f913 commit dde891f
Show file tree
Hide file tree
Showing 69 changed files with 1,686 additions and 1,760 deletions.
30 changes: 15 additions & 15 deletions src/test/K6/src/api/app/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,46 @@ import * as config from "../../config.js";
import * as header from "../../buildrequestheaders.js"

//Api call to App Api:Data to get a data by id of an app instance and returns response
export function getDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, appOwner, appName){
export function getDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, dataId, "dataid");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.get(endpoint, params);
};

//Function to return the first data id from an instance JSON object
export function findDataId(instanceJson){
export function findDataId(instanceJson) {
instanceJson = JSON.parse(instanceJson);
var dataId = instanceJson.data[0].id ;
var dataId = instanceJson.data[0].id;
return dataId;
};

//Api call to App Api:Data to edit a data by id of an app instance and returns response
export function putDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, dataType, data, appOwner, appName){
export function putDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, dataType, data, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, dataId, "dataid");
var params = header.buildHeadersForData(dataType, altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
var requestBody = data;
return http.put(endpoint,requestBody, params);
var requestBody = data;
return http.put(endpoint, requestBody, params);
};

//Api call to App Api:Data to delete a data by id of an app instance and returns response
export function deleteDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, appOwner, appName){
export function deleteDataById(altinnStudioRuntimeCookie, partyId, instaceId, dataId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, dataId, "dataid");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.del(endpoint,"", params);
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.del(endpoint, "", params);
};

//Api call to App Api:Instances to validate an instance data and returns response
export function getValidateInstanceData(altinnStudioRuntimeCookie, partyId, instanceId, dataId, appOwner, appName){
export function getValidateInstanceData(altinnStudioRuntimeCookie, partyId, instanceId, dataId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instanceId, dataId, "dataid") + "/validate";
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.get(endpoint, params);
};


//Api call to App Api:Data to add a data to an app instance and returns response
export function postData(altinnStudioRuntimeCookie, partyId, instaceId, dataType, data, appOwner, appName){
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "instanceid") + "/data?dataType=" + dataType;
var params = header.buildHeadersForData(dataType, altinnStudioRuntimeCookie, "app");
export function postData(altinnStudioRuntimeCookie, partyId, instaceId, dataType, data, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "instanceid") + "/data?dataType=" + dataType;
var params = header.buildHeadersForData(dataType, altinnStudioRuntimeCookie, "app");
return http.post(endpoint, data, params);
};
28 changes: 14 additions & 14 deletions src/test/K6/src/api/app/instances.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@ import * as config from "../../config.js";
import * as header from "../../buildrequestheaders.js"

//Api call to App Api:Instances to create an app instance and returns response
export function postInstance(altinnStudioRuntimeCookie, partyId, appOwner, appName){
export function postInstance(altinnStudioRuntimeCookie, partyId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + "/instances?instanceOwnerPartyId=" + partyId;
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
return http.post(endpoint, null, params);
};

//Api call to App Api:Instances to create an app instance and returns response
export function getInstanceById(altinnStudioRuntimeCookie, partyId, instanceId, appOwner, appName){
export function getInstanceById(altinnStudioRuntimeCookie, partyId, instanceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instanceId, "", "instanceid");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
return http.get(endpoint, params);
};

//Api call to App Api:Instances to validate an app instance and returns response
export function getValidateInstance(altinnStudioRuntimeCookie, partyId, instanceId, appOwner, appName){
export function getValidateInstance(altinnStudioRuntimeCookie, partyId, instanceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instanceId, "", "instanceid") + "/validate";
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
return http.get(endpoint, params);
};

export function postCreateInstanceWithSsnOrOrg(altinnStudioRuntimeCookie, userType, value, appOwner, appName){
export function postCreateInstanceWithSsnOrOrg(altinnStudioRuntimeCookie, userType, value, appOwner, appName) {
var requestBody = '{"instanceOwner":{}}';
requestBody = JSON.parse(requestBody);
var endpoint = config.appApiBaseUrl(appOwner, appName) + "/instances";
var params = header.buildHearderWithRuntimeandJson(altinnStudioRuntimeCookie, "app");
if(userType == "ssn"){
requestBody.instanceOwner.personNumber = value ;
var params = header.buildHearderWithRuntimeandJson(altinnStudioRuntimeCookie, "app");
if (userType == "ssn") {
requestBody.instanceOwner.personNumber = value;
}
else if(userType == "org"){
requestBody.instanceOwner.organisationNumber = value ;
else if (userType == "org") {
requestBody.instanceOwner.organisationNumber = value;
};
requestBody = JSON.stringify(requestBody);
params.timeout = 120000;
Expand Down
16 changes: 8 additions & 8 deletions src/test/K6/src/api/app/instantiation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import * as header from "../../buildrequestheaders.js"


//Batch Api calls before creating an app instance
export function beforeInstanceCreation(altinnStudioRuntimeCookie, partyId, appOwner, appName){
export function beforeInstanceCreation(altinnStudioRuntimeCookie, partyId, appOwner, appName) {
let req, res;
var requestParams = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app")
req = [
{
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["texts"] + "nb",
"params": requestParams
},{
"params": requestParams
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appProfile["user"],
"params": requestParams
},{
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["applicationmetadata"],
"params": requestParams
},{
"params": requestParams
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appAuthorization["currentparties"],
"params": requestParams
},{
}, {
"method": "post",
"url": config.appApiBaseUrl(appOwner, appName) + config.appValidateInstantiation + "?partyId=" + partyId,
"params": requestParams
}];
res = http.batch(req);
return res;
return res;
};
20 changes: 10 additions & 10 deletions src/test/K6/src/api/app/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@ import * as config from "../../config.js";
import * as header from "../../buildrequestheaders.js"

//Api call to App Api:Process to start process of an app instance and returns response
export function postStartProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName){
export function postStartProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "process") + "/start";
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.post(endpoint, null, params);
};

//Api call to App Api:Process to move process of an app instance to a specific process element and returns response
export function putNextProcess(altinnStudioRuntimeCookie, partyId, instaceId, processElement, appOwner, appName){
export function putNextProcess(altinnStudioRuntimeCookie, partyId, instaceId, processElement, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "process") + "/next?elementId=" + processElement;
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
return http.put(endpoint, null, params);
};

//Api call to App Api:Process to GET current process of an app instance and returns response
export function getCurrentProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName){
export function getCurrentProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "process");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.get(endpoint, params);
};

//Api call to App Api:Process to GET next process of an app instance and returns response
export function getNextProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName){
export function getNextProcess(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "process") + "/next";
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
params.timeout = 120000;
return http.get(endpoint, params);
};

//Api call to App Api:Process to GET process history of an app instance and returns response
export function getProcessHistory(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName){
export function getProcessHistory(altinnStudioRuntimeCookie, partyId, instaceId, appOwner, appName) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.buildAppApiUrls(partyId, instaceId, "", "process") + "/history";
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.get(endpoint, params);
};
12 changes: 6 additions & 6 deletions src/test/K6/src/api/app/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import * as header from "../../buildrequestheaders.js"


//Batch Api calls after instance creation to get app resources like Appmetadata, Formlayoust.json, rulehandler.js, ruleconfiguration.json
export function batchGetAppResources(altinnStudioRuntimeCookie, appOwner, appName){
export function batchGetAppResources(altinnStudioRuntimeCookie, appOwner, appName) {
let req, res;
var requestParams = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app")
req = [
{
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["servicemetadata"],
"params": requestParams
},{
"params": requestParams
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["formlayout"],
"params": requestParams
},{
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["rulehandler"],
"params": requestParams
},{
"params": requestParams
}, {
"method": "get",
"url": config.appApiBaseUrl(appOwner, appName) + config.appResources["ruleconfiguration"],
"params": requestParams
Expand Down
4 changes: 2 additions & 2 deletions src/test/K6/src/api/app/texts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as config from "../../config.js";
import * as header from "../../buildrequestheaders.js"

//Api call to App Api:Texts to get app texts based on language
export function getAppTexts(altinnStudioRuntimeCookie, appOwner, appName, language){
export function getAppTexts(altinnStudioRuntimeCookie, appOwner, appName, language) {
var endpoint = config.appApiBaseUrl(appOwner, appName) + config.appResources["texts"] + language,
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
var params = header.buildHearderWithRuntime(altinnStudioRuntimeCookie, "app");
return http.get(endpoint, params);
};
2 changes: 1 addition & 1 deletion src/test/K6/src/api/platform/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as config from "../../config.js";
import * as header from "../../buildrequestheaders.js";

//Request to convert a maskinporten token and returns altinnstudioruntime token for en appOwner
export function convertMaskinPortenToken(maskinportentoken, isTest){
export function convertMaskinPortenToken(maskinportentoken, isTest) {
var endpoint = config.platformAuthentication["maskinporten"] + "?test=" + isTest;
var params = header.buildHearderWithRuntime(maskinportentoken);
var token = http.get(endpoint, params);
Expand Down
Loading

0 comments on commit dde891f

Please sign in to comment.