cucumber-studio

0.1.14 • Public • Published

cucumber-studio

CircleCI codecov npm version npm dev dependency version npm dev dependency version

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

Creates an instance of CucumberStudio.

Parameters

  • credentials Object object with params
    • credentials.TOKEN string Cucumber Studio API token
    • credentials.CLIENT string Cucumber Studio identifier
    • credentials.UID string User email of CucumberStudio Account
    • credentials.projectId string? project ID to work with
  • opts Object? object with params
    • opts.requestOptions string? some request options for request-promise-native
    • opts.proxy string? proxy settings

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
  • projectId (number | string) project ID (optional, default this.projectId)

Returns Object project object

getProjectIdByName

Get project ID by its name.

Parameters
Examples
const id = await cucumberStudio.getProjectIdByName('someName');

Returns number project id

getProjectBackupById

Get proect backup by project ID.

Parameters
  • projectId (number | string) project id (optional, default this.projectId)

Returns Object backup

getScenarios

Get all scenarios of project by its ID.

Parameters
  • projectId (number | string) project id (optional, default this.projectId)

Returns Array<Object> scenarios

getFolders

Get all folders of project by its ID.

Parameters
  • projectId (number | string) project ID (optional, default this.projectId)

Returns Array<Object> folders' objects

createScenario

Create a scneario in project with given ID.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.scenarioAttributes Object object with attributes for new scenario
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
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.scenarioId (number | string) scenario ID to update scenario
    • $0.newAttributes Object object with attributes
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
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.scenarioId (number | string) scenario ID

Returns Object empty object

createFolder

Create folder with name and parent-id given in folderAttributes.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) (optional, default this.projectId)
    • $0.folderAttributes Object object with attributes for new folder
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
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder id to update
    • $0.newAttributes Object object with new attributes for update folder
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
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder ID to delete

Returns Object empty object

getChildrenFolders

Get childern folders of folder by its ID.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder ID to delete

Returns Array<Object> array with children folder items

deleteChildrenFolders

Delete all children folders of folder by its ID.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder ID to delete

Returns Object empty object

getFolderScenarios

Get folder scenarios by its ID.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder ID to delete

Returns Array<Object> array with folder scenarios items

clearAllScenarios

Delete all scenarios in folder by its ID.

Parameters
  • $0 Object object with params
    • $0.projectId (number | string) project ID (optional, default this.projectId)
    • $0.folderId (number | string) folder ID to delete

Returns Object empty object

Readme

Keywords

none

Package Sidebar

Install

npm i cucumber-studio

Weekly Downloads

1

Version

0.1.14

License

MIT

Unpacked Size

37.3 kB

Total Files

11

Last publish

Collaborators

  • dmred