cucumber-studio
Install
npm
npm install cucumber-studio
yarn
yarn add cucumber-studio
Usage
Promise chaining
const CucumberStudio = require('cucumber-studio');
const { TOKEN, CLIENT, UID } = process.env;
const cucumberStudio = new CucumberStudio({
TOKEN,
CLIENT,
UID,
});
cucumberStudio
.getProjects()
.then(projects => console.log(projects));
Async/await
const CucumberStudio = require('cucumber-studio');
const { TOKEN, CLIENT, UID } = process.env;
const cucumberStudio = new CucumberStudio({
TOKEN,
CLIENT,
UID,
});
;(async () => {
const allProjects = await cucumberStudio.getAllProjects();
console.log(allProjects);
})();
API
Table of Contents
- CucumberStudio
CucumberStudio
Creates an instance of CucumberStudio.
Parameters
Examples
// returns instace of CucumberStudio
const cucumberStudio = new CucumberStudio({TOKEN, CLIENT, UID});
_setProjectId
Sets project ID to instance param.
Parameters
getAllProjects
Get array with all projects.
Returns Array<Object> with all projects objects
getProjectById
Get project by its ID.
Parameters
Returns Object project object
getProjectIdByName
Get project ID by its name.
Parameters
-
name
string project name
Examples
const id = await cucumberStudio.getProjectIdByName('someName');
Returns number project id
getProjectBackupById
Get proect backup by project ID.
Parameters
Returns Object backup
getScenarios
Get all scenarios of project by its ID.
Parameters
Returns Array<Object> scenarios
getFolders
Get all folders of project by its ID.
Parameters
Returns Array<Object> folders' objects
createScenario
Create a scneario in project with given ID.
Parameters
-
$0
Object object with params
Examples
const projectId = 154213;
const folderId = 12341;
const scenarioAttributes = {
name: 'testScenarioName',
'folder-id': folderId,
};
const scenario = await cucumberStudio.createScenario({
projectId,
scenarioAttributes
});
Returns Object created scenario item
updateScenario
Update scenario attributes.
Parameters
-
$0
Object object with params
Examples
const projectId = 154213;
const scenarioId = 123412;
const newAttributes = {
name: 'The new name of the scenario',
description: 'The new description of the scenario',
};
const updatedScenario = await cucumberStudio
.updateScenario({ projectId, scenarioId, newAttributes })
Returns Object updated scenario item
deleteScenario
Delete scenatio by its ID.
Parameters
-
$0
Object object with params
Returns Object empty object
createFolder
Create folder with name
and parent-id
given in folderAttributes.
Parameters
-
$0
Object object with params
Examples
const projectId = 154213;
const folderId = 23123;
const folderAttributes = {
name: 'testFolderName',
'folder-id': folderId,
};
const newFolder = await cucumberStudio.createFolder({
projectId,
folderAttributes
});
Returns Object created folder item
updateFolder
Update folder with new attributes.
Parameters
-
$0
Object object with params
Examples
const projectId = 154213;
const folderId = 123412;
const newAttributes = {
"name": 'The new name of the folder',
"description": 'The new description of the folder',
};
const updatedFolder = await cucumberStudio
.updateFolder({ projectId, folderId, newAttributes })
Returns Object updated folder item
deleteFolder
Delete folder by its ID.
Parameters
-
$0
Object object with params
Returns Object empty object
getChildrenFolders
Get childern folders of folder by its ID.
Parameters
-
$0
Object object with params
Returns Array<Object> array with children folder items
deleteChildrenFolders
Delete all children folders of folder by its ID.
Parameters
-
$0
Object object with params
Returns Object empty object
getFolderScenarios
Get folder scenarios by its ID.
Parameters
-
$0
Object object with params
Returns Array<Object> array with folder scenarios items
clearAllScenarios
Delete all scenarios in folder by its ID.
Parameters
-
$0
Object object with params
Returns Object empty object