API SDK for Einstein according to Einstein SDK HTTP API
npm install einstein-sdk
import EinsteinSDK from 'einstein-sdk';
// or use: const EinsteinSDK = require('einstein-sdk').default;
const EINSTEIN_ENDPOINT = 'https://einstein.ringcentral.com';
const einsteinSdk = new EinsteinSDK(EINSTEIN_ENDPOINT);
await einsteinSdk.login('username', 'password');
einsteinSdk.logout();
const projects = await einsteinSdk.getProjects();
const project = await einsteinSdk.getProject(projectId);
const suites = await einsteinSdk.getSuites(projectId);
const testCase = await einsteinSdk.getTestCase(testCaseId);
const testCase = await einsteinSDK.getTestCase(TEST_CASE_ID);
const parameter = {
id: testCase.id,
versionId: testCase.version.id,
name: `${testCase.name} new`,
summary: `${testCase.summary} new`,
preconditions: `${testCase.preconditions} new`,
priority: PRIORITY_ENUM.P3,
executionType: EXECUTION_TYPE_ENUM.Automated,
steps: [
...testCase.children,
{
name: 'step1',
expectedResult: 'no result',
execution: EXECUTION_TYPE_ENUM.Automated,
},
{
name: 'step2',
expectedResult: 'no result2',
execution: EXECUTION_TYPE_ENUM.Automated,
}
]
};
const response = await einsteinSDK.updateTestCase(parameter);
const data = {
projectId: ${projectId},
parentId: ${parentId},
name: 'Einstein SDK Test',
priority: PRIORITY_ENUM.P3,
executionType: EXECUTION_TYPE_ENUM.Automated,
summary: 'This is summary.',
preconditions: 'This is preconditions.',
steps: [
{
name: 'Step 1',
expectedResult: 'Expected result 1',
execution: EXECUTION_TYPE_ENUM.Automated,
},
{
name: 'Step 2',
expectedResult: 'Expected result 2',
execution: EXECUTION_TYPE_ENUM.Automated,
},
{
name: 'Step 3',
expectedResult: 'Expected result 3',
execution: EXECUTION_TYPE_ENUM.Automated,
},
]
};
const response = await einsteinSDK.createTestCase(data);
const testCases = await einsteinSdk.getTestCasesByKeywordIds(projectId, keywordsIds);
const testPlans = await einsteinSdk.getTestPlans(projectId);
await einsteinSdk.createTestPlan(projectId, testPlanName, notes);
await einsteinSdk.addTestCaseToTestPlans(testCaseId, testPlanIds);
await einsteinSDK.addTestCasesToTestPlan(projectIds, testCaseIds, testPlanId);
const builds = await einsteinSdk.getBuilds(testPlanId);
await einsteinSdk.createBuild(testPlanId, buildName, notes);
await einsteinSdk.addValueToCustomField(projectId, customFieldName, name, description, visibility);
const executions = await einsteinSdk.getTestExecutions(testCaseId);
const keywords = await einsteinSdk.getKeywords(projectId);
const metaData = await einsteinSdk.getMetaDataByProjectName(projectName);
const testCases = await einsteinSdk.searchTestCasesByExpression(projectName, expression);
const testCases = await einsteinSdk.searchTestCasesInTestExecutionsByExpression(projectName, testPlanName, expression);
await einsteinSDK.bulkUpdateTestCaseProperties(data);
const pattern = 'xxx';
await einsteinSDK.getSuggestTestCases(pattern);
Field | Keyword In Expression | Available Operators | Predefined Values | Available? |
---|---|---|---|---|
Project | project | = | n/a | ✅ |
Test plan | test_plan | =, in | n/a | ✅ |
Case Id | case_id | =, in | n/a | ✅ |
Case Name | case_name | like | n/a | ✅ |
Suite | suite | =, in | n/a | ✅ |
Suite Name | suite_name | like | n/a | ✅ |
Summary | summary | like | n/a | ✅ |
Preconditions | preconditions | like | n/a | ✅ |
Test Step | test_step | like | n/a | ✅ |
Expected Result | expected_result | like | n/a | ✅ |
Text | text | like | n/a | ✅ |
Priority | priority | =, in | "P0", "P1", "P2", "P3" | ✅ |
Execution Type | execution_type | =, in | "Manual", "Automated", "Automatable", "NotAutomatable", "ReadyForAutomation", "AutomationExpired", "AutomationSuspended" | ✅ |
Last Execution Status | last_execution_status | =, in | "Passed", "Failed", "Blocked", "Skipped", "NotApplicable", "NotRun" | ✅ |
Execution Status | execution_status | =, in | "Passed", "Failed", "Blocked", "Skipped", "NotApplicable", "NotRun" | ✅ |
Tested By | tested_by | =, in | n/a | ✅ |
Version | version | =, in | "Active", "Last" | ✅ |
Version Number | version_number | =, in | n/a | ✅ |
Created By | created_by | =, in | n/a | ✅ |
Date Created | date_created | <,<=,>,>= | n/a | ✅ |
Last Updated | last_updated | <,<=,>,>= | n/a | ✅ |
Date Update | date_updated | <,<=,>,>= | n/a | ✅ |
Updated By | updated_by | =, in | n/a | ✅ |
Req. Doc. Id (coverage) | document_id | like | n/a | ✅ |
Run | run | in | n/a | ✅ |
Custom Fields | @custom field name@ | in | n/a | ✅ |
project = "RC Cloud Integration"
project in "RC Cloud Integration" and test_plan = "Salesforce V3.41"
project in "RC Cloud Integration" and test_plan in "Salesforce V3.41, Google&Office365 - V2.6.0"
project = "RC Cloud Integration" and case_id = "1286"
project = "RC Cloud Integration" and case_id in "1286, 42"
project = "RC Cloud Integration" and case_name like "Log into RC CTI app with phone number/email"
Search Test Cases By Project Name And Suite Name (suite name can be a nested structure split by '.')
project = "RC Cloud Integration" and suite = "Firefox"
project = "RC Cloud Integration" and suite in "Firefox, Skype for Business"
project = "Ringcentral meetings" and suite = "SW - Settings/Reports/Dashboard.Meetings Report.Admin Portal.Webinar" and version = "Active"
project = "RC Cloud Integration" and suite_name like "Firefox"
project = "RC Cloud Integration" and summary like "To verify whether user is able to log into RC CTI"
project = "RC Cloud Integration" and preconditions like "User must have RC CTI account"
project = "RC Cloud Integration" and test_step like "enter extension(optional) and password"
project = "RC Cloud Integration" and expected_result like "Password entered, value is hidden"
project = "RC Cloud Integration" and text like "password"
Optional values for priority: "P0", "P1", "P2", "P3"
project = "RC Cloud Integration" and priority = "P0"
project = "RC Cloud Integration" and priority in "P0, P1, P2"
Optional values for execution type: "Manual", "Automated", "Automatable", "NotAutomatable", "ReadyForAutomation"
project = "RC Cloud Integration" and execution_type = "Automated"
project = "RC Cloud Integration" and execution_type in "Automated, Automatable"
Optional values for last execution status: "Passed", "Failed", "Blocked", "Skipped", "NotApplicable", "NotRun"
project = "RC Cloud Integration" and last_execution_status = "Passed"
project = "RC Cloud Integration" and last_execution_status in "Passed, Failed, Skipped"
Optional values for execution status: "Passed", "Failed", "Blocked", "Skipped", "NotApplicable", "NotRun"
project = "RC Cloud Integration" and execution_status = "Passed"
project = "RC Cloud Integration" and execution_status in "Passed, Failed, Skipped"
project = "RC Cloud Integration" and tested_by = "yuki.chen"
project = "RC Cloud Integration" and tested_by in "yuki.chen, klay.chen"
Optional values for version: "Active", "Last"
project = "RC Cloud Integration" and version = "Active"
project = "RC Cloud Integration" and version in "Active, Last"
project = "RC Cloud Integration" and version_number = "21"
project = "RC Cloud Integration" and version_number in "20, 21"
project = "RC Cloud Integration" and created_by = "yuki.chen"
project = "RC Cloud Integration" and created_by in "yuki.chen, klay.chen"
project = "RC Cloud Integration" and date_created >= "2019-04-01"
project = "RC Cloud Integration" and date_created < "2019-04-01"
project = "RC Cloud Integration" and updated_by = "yuki.chen"
project = "RC Cloud Integration" and updated_by in "yuki.chen, klay.chen"
project = "RC Cloud Integration" and last_updated >= "2019-04-01"
project = "RC Cloud Integration" and last_updated < "2019-04-01"
project = "RC Cloud Integration" and document_id like "abc"
Wrapper custom field with "@" and "@".
project = "RC Cloud Integration" and @Keywords@ in "Salesforce, Outlook"
project = "RC Cloud Integration" and @Automation@ in "Automatable, Automated"
project = "RC Cloud Integration" and @Release Name@ in "Release_10.0, Release_10.1"
project = "Ringcentral meetings" and run in "9.4 Meeings Dashboard Regression testing: 5.4 Mac Rooms" and version = "Active"
(project = "RC Cloud Integration" and @Keywords@ in "Salesforce, Outlook") or ((project = "RC Cloud Integration" and execution_type = "Automated"))
project = "RC Cloud Integration" and @Keywords@ in "Google" and priority="P0" and !(@Keywords@ in "Automation_Expired, Manual, Automated_Google")
It's necessary to add version = "Active"
in every query expression.
See Test Cases for Einstein SDK to get more details.