Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Improve coverage for mutation addSimpleProductToCart or Cart contains a product after product got status Out of Stock #439

Closed
TomashKhamlai opened this issue Mar 5, 2019 · 0 comments

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Mar 5, 2019

Can be related to #437

Preconditions (*)

Steps to reproduce (*)

  1. Create Simple Product with
    Name Simple Product
    SKU: simple-product
    Weight: 1
    Price: 1
    Qty: 1000
  2. Create empty cart as a Guest or as Customer (GraphQL)
  3. Add simple product to Cart (GraphQL)
  4. Go to admin
  5. Set Simple Product to be Out of Stock
  6. Add Simple Product to Cart again (GraphQL) and get this
{
  "errors": [
    {
      "message": "Could not add the product with SKU simple-product to the shopping cart: Product that you are trying to add is not available.",
      "category": "graphql-input",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "addSimpleProductsToCart"
      ]
    }
  ],
  "data": {
    "addSimpleProductsToCart": null
  }
}
  1. Try to checkout from GraphQL when [Checkout coverage] Place order concept #404 will be ready

Expected result (*)

  1. Checkout is not successful
  2. No internal server error

Actual result (*)

  1. Cart query
query {
  cart(
    cart_id: "hFWUVh9KPZ4FdgsnpEZDcfLpxW96vm56"
  ) {
    items {
      product {
        sku
      }
      __typename
      qty
      id
    }
  }
}

returns:

{
  "data": {
    "cart": {
      "items": [
        {
          "product": {
            "sku": "simple-product"
          },
          "__typename": "SimpleCartItem",
          "qty": 1,
          "id": "50"
        }
      ]
    }
  }
}

So there could be problems. And tests do not cover such cases

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants