Skip to content

[QA] Add Cypress coverage for Subscription Management (LAT-232) #12700

@HS-QUALIBOT

Description

@HS-QUALIBOT

Description

Add comprehensive Cypress test coverage for the Subscription Management feature, which includes CRUD operations and lifecycle management for subscriptions.

Endpoints Covered

  • POST /subscriptions — Create subscription
  • GET /subscriptions/:id — Retrieve subscription
  • PUT /subscriptions/:id — Update subscription
  • POST /subscriptions/:id/cancel — Cancel subscription
  • POST /subscriptions/:id/reactivate — Reactivate subscription

Test Scenarios

Create Subscription (Happy Path)

  • Valid payload creation with customer_id, billing details, and interval configuration
  • Verifies status: "active" and subscription_id presence in response

Retrieve Subscription

  • Fetch existing subscription by ID
  • Verify all fields match creation payload

Update Subscription

  • Modify subscription attributes (description, plan changes)
  • Verify updated fields reflect in response

Subscription Lifecycle

  • Active → Cancelled transition verification
  • Cancelled → Active reactivation flow
  • End-to-end lifecycle test (Create → Retrieve → Update → Cancel → Verify)

Negative Cases

  • Invalid customer ID handling (expects 400/IR_00)
  • Missing required fields validation (expects 400/IR_00)
  • Cancelled subscription update prevention (expects 4xx)
  • Invalid status transition handling

Files Added

  • cypress-tests/cypress/e2e/spec/Subscription/01-SubscriptionManagement.cy.js — Main test spec with 12 test cases
  • cypress-tests/cypress/e2e/configs/Subscription/Commons.js — Subscription connector configuration
  • cypress-tests/cypress/fixtures/create-subscription-body.json — Create subscription fixture
  • cypress-tests/cypress/fixtures/create-subscription-invalid-customer-body.json — Invalid customer test data
  • cypress-tests/cypress/fixtures/create-subscription-missing-fields-body.json — Missing fields test data
  • cypress-tests/cypress/fixtures/update-subscription-body.json — Update subscription fixture
  • cypress-tests/cypress/support/commands.js — Custom commands (createSubscriptionTest, retrieveSubscriptionTest, updateSubscriptionTest, cancelSubscriptionTest, reactivateSubscriptionTest)

Connector Support

Currently supports: stripebilling

Added to CONNECTOR_LISTS.INCLUDE.SUBSCRIPTION in Utils.js

Source Reference

api_models/subscription.rs — All error codes and response structures aligned with API model definitions

Acceptance Criteria

  • All CRUD operations covered with positive and negative cases
  • Lifecycle transitions (active → cancelled → active → expired) validated
  • Fixture response bodies match actual API responses from api_models/subscription.rs
  • Error codes in negative fixtures align with defined error variants in source
  • subscription_id stored in globalState and reused across chained test steps
  • No accidentally committed debug/result files in the PR

Parent Pipeline Issue

Related to: LAT-232 / QAA-72

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions