Services
Good to know: This document provides a step-by-step guide for setting up and using @ordino.ai/ordino-engine for API testing with Cypress. framework exposes the Ordino Engine directly, allowing test teams to build custom service classes that encapsulate business logic.
Prerequisites
Before you begin, ensure the following dependencies and requirements are met:
Node.js
>= 22.x
Cypress
>= 13.x
Package Manager
npm or yarn
Language Support
TypeScript / JavaScript
Installation
Add @ordino.ai/ordino-engine to your Cypress project:
npm install @ordino.ai/ordino-engine@2.2.0-cy.8 --save-devA recommended directory layout for using @ordino.ai/ordino-engine with Cypress:
/ordino
/e2e
/api
users.spec.ts
/services
add_user.ts
/payloads
user_info.ts
/support
commands.ts
cypress.config.ts
package.jsonDirectory / File Details
/e2e/api/Contains your end-to-end test specifications.users.spec.ts→ Example Cypress spec file testing user-related API endpoints.
/services/Houses service classes that encapsulate API calls and business logic.add_user.ts→ Example service class for handling user-related API operations.
/payloads/Stores request/response payloads used in tests.user_info.ts→ Example test payload for creating or validating users data.
/support/Contains Cypress custom commands and global hooks.commands.ts→ Extend Cypress with reusable commands for common actions.
cypress.config.tsCypress configuration file. Define base URL, environment variables, and test settings here.package.jsonProject dependencies, scripts, and metadata. Includes the installed@ordino.ai/ordino-enginepackage.
Engine Import
In any service or test file, import the HTTP API from @ordino.ai/ordino-engine:
import { ordinoSuite } from '@ordino.ai/ordino-engine';
const http = ordinoSuite.api(ApiServiceType.HTTP);ordinoSuite→ Main entry point to the Ordino Engine.ApiServiceType.HTTP→ Specifies that the API service should use HTTP as the communication layer.http→ An initialized API client instance to perform requests.
Last updated