einstein-sdk
v1.12.2
Published
einstein sdk for javascript and typescript.
Downloads
257
Readme
Einstein SDK
API SDK for Einstein according to Einstein SDK HTTP API
Installation
npm install einstein-sdk
APIs
Login
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');
Logout
einsteinSdk.logout();
Get Projects
const projects = await einsteinSdk.getProjects();
Get Project
const project = await einsteinSdk.getProject(projectId);
Get Suites
const suites = await einsteinSdk.getSuites(projectId);
Get Test Cases
const testCase = await einsteinSdk.getTestCase(testCaseId);
Update Test Case
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);
Create Test Case
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);
Get Test Cases By Keyword Ids
const testCases = await einsteinSdk.getTestCasesByKeywordIds(projectId, keywordsIds);
Get Test Plans
const testPlans = await einsteinSdk.getTestPlans(projectId);
Create Test Plan
await einsteinSdk.createTestPlan(projectId, testPlanName, notes);
Add Test Case To Test Plans
await einsteinSdk.addTestCaseToTestPlans(testCaseId, testPlanIds);
Add Test Cases To Test Plan
await einsteinSDK.addTestCasesToTestPlan(projectIds, testCaseIds, testPlanId);
Get Builds
const builds = await einsteinSdk.getBuilds(testPlanId);
Create Build
await einsteinSdk.createBuild(testPlanId, buildName, notes);
Add Value To Custom Field
await einsteinSdk.addValueToCustomField(projectId, customFieldName, name, description, visibility);
Get Test Executions
const executions = await einsteinSdk.getTestExecutions(testCaseId);
Get Project Keywords
const keywords = await einsteinSdk.getKeywords(projectId);
Get Meta Data By Project Name
const metaData = await einsteinSdk.getMetaDataByProjectName(projectName);
Search Test Case In Test Suite Scope
const testCases = await einsteinSdk.searchTestCasesByExpression(projectName, expression);
Search Test Case In Test Executions Scope
const testCases = await einsteinSdk.searchTestCasesInTestExecutionsByExpression(projectName, testPlanName, expression);
Update test case properties
await einsteinSDK.bulkUpdateTestCaseProperties(data);
Get suggest test cases
const pattern = 'xxx';
await einsteinSDK.getSuggestTestCases(pattern);
Fields For Searching Test Cases
| 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 | ✅ |
Searching Expression Samples
Search Test Cases By Project Name Only
project = "RC Cloud Integration"
Search Test Cases By Project Name And Test Plan Name
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"
Search Test Cases By Project Name And Test Case Id
project = "RC Cloud Integration" and case_id = "1286"
project = "RC Cloud Integration" and case_id in "1286, 42"
Search Test Cases By Project Name And Test Case Name
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"
Search Test Cases By Project Name And Summary
project = "RC Cloud Integration" and summary like "To verify whether user is able to log into RC CTI"
Search Test Cases By Project Name And Preconditions
project = "RC Cloud Integration" and preconditions like "User must have RC CTI account"
Search Test Cases By Project Name And Test Step
project = "RC Cloud Integration" and test_step like "enter extension(optional) and password"
Search Test Cases By Project Name And Expected Result
project = "RC Cloud Integration" and expected_result like "Password entered, value is hidden"
Search Test Cases By Project Name And Text
project = "RC Cloud Integration" and text like "password"
Search Test Cases By Project Name And Priority
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"
Search Test Cases By Project Name And Execution Type
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"
Search Test Cases By Project Name And Last Execution Status
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"
Search Test Cases By Project Name And Execution Status
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"
Search Test Cases By Tested By
project = "RC Cloud Integration" and tested_by = "yuki.chen"
project = "RC Cloud Integration" and tested_by in "yuki.chen, klay.chen"
Search Test Cases By Project Name And Version
Optional values for version: "Active", "Last"
project = "RC Cloud Integration" and version = "Active"
project = "RC Cloud Integration" and version in "Active, Last"
Search Test Cases By Project Name And Version Number
project = "RC Cloud Integration" and version_number = "21"
project = "RC Cloud Integration" and version_number in "20, 21"
Search Test Cases By Created By
project = "RC Cloud Integration" and created_by = "yuki.chen"
project = "RC Cloud Integration" and created_by in "yuki.chen, klay.chen"
Search Test Cases By Date Created
project = "RC Cloud Integration" and date_created >= "2019-04-01"
project = "RC Cloud Integration" and date_created < "2019-04-01"
Search Test Cases By Updated By
project = "RC Cloud Integration" and updated_by = "yuki.chen"
project = "RC Cloud Integration" and updated_by in "yuki.chen, klay.chen"
Search Test Cases By Last Updated
project = "RC Cloud Integration" and last_updated >= "2019-04-01"
project = "RC Cloud Integration" and last_updated < "2019-04-01"
Search Test Cases By Document Id
project = "RC Cloud Integration" and document_id like "abc"
Search Test Cases By Project Name And Custom Fields
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"
Search Test Cases By Run
project = "Ringcentral meetings" and run in "9.4 Meeings Dashboard Regression testing: 5.4 Mac Rooms" and version = "Active"
Search Test Cases Using "in", "or", "()" and "!'
(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")
Important Notice
It's necessary to add version = "Active"
in every query expression.
More Information
See Test Cases for Einstein SDK to get more details.