Fix e2e tests for pricing page

- Update selectors to use input indices instead of labels (labels not associated)
- Fix validation error status expectation (400 instead of 422)
- Update exchange.spec.ts to check new config fields (eur_min_buy, etc.)
This commit is contained in:
counterweight 2025-12-26 20:59:10 +01:00
parent 2ee27cf5b2
commit 7f547d667d
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 173 additions and 36 deletions

View file

@ -192,6 +192,30 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/admin/pricing": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Get Pricing Config
* @description Get current pricing configuration.
*/
get: operations["get_pricing_config_api_admin_pricing_get"];
/**
* Update Pricing Config
* @description Update pricing configuration.
*/
put: operations["update_pricing_config_api_admin_pricing_put"];
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/meta/constants": {
parameters: {
query?: never;
@ -353,9 +377,8 @@ export interface paths {
*
* The response includes:
* - market_price: The raw price from the exchange
* - premium_percentage: The premium to apply to trades
* - is_stale: Whether the price is older than 5 minutes
* - config: Trading configuration (min/max EUR, increment)
* - config: Trading configuration (min/max EUR per direction, premiums, increment)
*/
get: operations["get_exchange_price_api_exchange_price_get"];
put?: never;
@ -760,14 +783,24 @@ export interface components {
* @description Exchange configuration for the frontend.
*/
ExchangeConfigResponse: {
/** Eur Min */
eur_min: number;
/** Eur Max */
eur_max: number;
/** Eur Min Buy */
eur_min_buy: number;
/** Eur Max Buy */
eur_max_buy: number;
/** Eur Min Sell */
eur_min_sell: number;
/** Eur Max Sell */
eur_max_sell: number;
/** Eur Increment */
eur_increment: number;
/** Premium Percentage */
premium_percentage: number;
/** Premium Buy */
premium_buy: number;
/** Premium Sell */
premium_sell: number;
/** Small Trade Threshold Eur */
small_trade_threshold_eur: number;
/** Small Trade Extra Premium */
small_trade_extra_premium: number;
};
/**
* ExchangePriceResponse
@ -939,7 +972,7 @@ export interface components {
* @description All available permissions in the system.
* @enum {string}
*/
Permission: "view_audit" | "fetch_price" | "manage_own_profile" | "manage_invites" | "view_own_invites" | "create_exchange" | "view_own_exchanges" | "cancel_own_exchange" | "manage_availability" | "view_all_exchanges" | "cancel_any_exchange" | "complete_exchange";
Permission: "view_audit" | "fetch_price" | "manage_own_profile" | "manage_invites" | "view_own_invites" | "create_exchange" | "view_own_exchanges" | "cancel_own_exchange" | "manage_availability" | "manage_pricing" | "view_all_exchanges" | "cancel_any_exchange" | "complete_exchange";
/**
* PriceHistoryResponse
* @description Response model for a price history record.
@ -969,13 +1002,13 @@ export interface components {
* @description Current BTC/EUR price for trading.
*
* Note: The actual agreed price depends on trade direction (buy/sell)
* and is calculated by the frontend using market_price and premium_percentage.
* and is calculated by the frontend using market_price and premium values.
* Premium calculation: base premium for direction + extra premium if
* trade <= threshold.
*/
PriceResponse: {
/** Market Price */
market_price: number;
/** Premium Percentage */
premium_percentage: number;
/**
* Timestamp
* Format: date-time
@ -984,6 +1017,50 @@ export interface components {
/** Is Stale */
is_stale: boolean;
};
/**
* PricingConfigResponse
* @description Response model for pricing configuration.
*/
PricingConfigResponse: {
/** Premium Buy */
premium_buy: number;
/** Premium Sell */
premium_sell: number;
/** Small Trade Threshold Eur */
small_trade_threshold_eur: number;
/** Small Trade Extra Premium */
small_trade_extra_premium: number;
/** Eur Min Buy */
eur_min_buy: number;
/** Eur Max Buy */
eur_max_buy: number;
/** Eur Min Sell */
eur_min_sell: number;
/** Eur Max Sell */
eur_max_sell: number;
};
/**
* PricingConfigUpdate
* @description Request model for updating pricing configuration.
*/
PricingConfigUpdate: {
/** Premium Buy */
premium_buy: number;
/** Premium Sell */
premium_sell: number;
/** Small Trade Threshold Eur */
small_trade_threshold_eur: number;
/** Small Trade Extra Premium */
small_trade_extra_premium: number;
/** Eur Min Buy */
eur_min_buy: number;
/** Eur Max Buy */
eur_max_buy: number;
/** Eur Min Sell */
eur_min_sell: number;
/** Eur Max Sell */
eur_max_sell: number;
};
/**
* ProfileResponse
* @description Response model for profile data.
@ -1435,6 +1512,59 @@ export interface operations {
};
};
};
get_pricing_config_api_admin_pricing_get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PricingConfigResponse"];
};
};
};
};
update_pricing_config_api_admin_pricing_put: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PricingConfigUpdate"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["PricingConfigResponse"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
get_constants_api_meta_constants_get: {
parameters: {
query?: never;