Urgent.News

What's breaking now, across thousands of outlets.

Tech

Test REST and GraphQL Contracts Beside Your UI with cy.request()

A broken API contract often surfaces as a vague UI failure: expected [data-cy="order-total"] to contain "$42.00" Was the React component wrong? Did the API rename total to amount ? Did GraphQL return 200 with an errors array? A focused API test answers those questions closer to the boundary that changed. Cypress can run REST and GraphQL checks through cy.request() in the same specs,…

API contract issues frequently manifest as ambiguous UI problems: the React component might be incorrect, or the API could have renamed "total" to "amount." GraphQL responses can return HTTP 200 status but contain errors in the body. Cypress allows running REST and GraphQL tests via `cy.request()` within the same specifications, configuration, and CI job as the UI tests.

When testing a REST endpoint like `GET /api/cart`, ensure the response contains the fields needed by the checkout process and adheres to domain constraints. Use assertions to verify the status code (200), presence of required keys (id, items, subtotal, tax, total, currency), the total being a number and non-negative, the currency being one of USD, EUR, or GBP, and each item in the body including sku, quantity, and unitPrice.

For expected error responses, disable Cypress's default status-code failure and assert the API's error contract. For instance, when making a POST request to `/api/orders` with an empty items array, expect a 422 status code and an `errors` object including a specific field and code.

GraphQL queries must also be tested. Although GraphQL typically uses a single endpoint, successful transport does not guarantee a successful query. Assert both the expected data and the absence of errors. Use `cy.request()` with a POST method to `/graphql`, passing the query and variables. Verify the status code is 200, ensure there are no error properties, and confirm the returned order data matches the expected structure (id, status, currency).

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

System Design Fundamentals: Understanding Scalability and the Dimensions of System Growth

One of the topics I’m really interested in is System Design & Distributed Systems , and one of the most important concepts we encounter in System Design is Scalability .

  • Scalability enables systems to handle growing demands without performance loss
  • Scalability allows managing increased workload by adding resources or refining architecture
  • System growth can occur in user base, features, or other dimensions

Atlassian Team '26 Europe recap and highlights

Atlassian Team '26 Europe ran at RAI Amsterdam from 6 to 8 October, with Partner Accelerate on the Monday before, and this is our recap. Atlassian announced a lot.

  • Atlassian Team 26 Europe held in Amsterdam from Oct 6-8
  • 23 Service Collection items marked Generally Available
  • Founder Keynote ended early due to power outage

Outside.exe - The Real World Is the Game Map 🌿🎮

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass What I Built Outside.exe — The Real World Is the Game Map 🌿🎮 What if going outside felt like playing a game?

  • Open-source AI-powered adventure game called Outside.exe
  • Encourages users to step outside via personalized quests
  • Built with Next.js, React, TypeScript, Node.js, and Ollama

How to Find and Fix Memory Leaks in Python

Hello, I’m Arthur. Have you ever noticed a Python application using more and more RAM even though you're not doing anything unusual? At first, everything works fine.

  • Python applications may use more memory over time due to memory leaks
  • Common causes include large lists, unlimited caches, and unnecessary references
  • Use tracemalloc to identify memory allocation hotspots in code

More from Friday 9 October →