Skip to content

[GraphQl] Gift Message coverage for customer order #28105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Usik2203
Copy link
Contributor

@Usik2203 Usik2203 commented May 5, 2020

Description (*)

This PR extends PR #27956 (Parent PR)
add coverage for customer order

This PR was mentioned for fixing failed static test related with composer.json file
#253

Related Pull Requests

#27956

Fixed Issues (if relevant)

  1. GraphQL Checkout :: Add support for Gift Wrapping / Gift Message during checkout.

Manual testing scenarios (*)

  1. For getting messages for customer order (note: You should be logged as customer)
{
  customerOrders {
  items {
      order_number
      status
      gift_message {
        to
        from
	message
      }
    }
  }
}

@m2-assistant
Copy link

m2-assistant bot commented May 5, 2020

Hi @Usik2203. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@magento-engcom-team magento-engcom-team added Component: GiftMessageGraphQl Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels May 5, 2020
@Usik2203 Usik2203 marked this pull request as draft May 5, 2020 09:23
gift_message: GiftMessage @resolver (class: "\\Magento\\GiftMessageGraphQl\\Model\\Resolver\\GiftMessage") @doc(description: "The entered gift message for the cart")
}
#TODO add resolver for SalesItemInterface
type SalesItemInterface {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rogyar .
I confused about implementing this point.
I can't understand which GraphQl query should be for testing this one.
Maybe you could clarify it.
Thanks a lot.

@rogyar rogyar self-assigned this May 5, 2020
@rogyar rogyar self-requested a review May 5, 2020 10:07
/**
* Class for getting GiftMessage from CustomerOrder
*/
class GiftMessageCustomerOrder implements ResolverInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we have 2 different resolvers in the directory called GiftMessage and GiftMessageCustomerOrder.
The naming is not 100% consistent. So I would propose moving resolvers to the separate directories, so we have:

  • Model/Resolver/Order/GiftMessage.php
  • Model/Resolver/Cart/GiftMessage.php
  • Model/Resolver/Order/Item/GiftMessage (in the future)

The same applies to the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done for all three PRs
Thanks

@Usik2203 Usik2203 force-pushed the graphql-256-order-messages branch 3 times, most recently from 5027759 to d727243 Compare May 12, 2020 08:26
@rogyar rogyar self-requested a review May 13, 2020 08:44
@rogyar rogyar marked this pull request as ready for review May 13, 2020 08:50
@rogyar rogyar changed the title [WIP][GraphQl] GiftMessageGraphQl coverage for Customer Order [GraphQl] GiftMessageGraphQl coverage for Customer Order May 13, 2020
@Usik2203 Usik2203 force-pushed the graphql-256-order-messages branch from d727243 to ad5c6a5 Compare May 14, 2020 11:14
@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run WebAPI Tests

@Usik2203
Copy link
Contributor Author

@magento run all tests

@paliarush
Copy link
Contributor

Verified that no new @api or interfaces were introduced in scope of this PR, so approval by the architecture team is not required.

@nrkapoor nrkapoor requested review from lenaorobei and paliarush May 29, 2020 15:45
@engcom-Bravo
Copy link
Contributor

✔️ QA Passed

query{
  customerOrders{
    items{
      gift_message{
        from
        message
        to
      }
    }
  }
}
response: 
{
  "data": {
    "customerOrders": {
      "items": [
        {
          "gift_message": {
            "from": "User2",
            "message": "Gift message",
            "to": "User1"
          }
        }
      ]
    }
  }
}

If user has two orders the response returns two messages:

{
  "data": {
    "customerOrders": {
      "items": [
        {
          "gift_message": {
            "from": "User2",
            "message": "Gift message",
            "to": "User1"
          }
        },
        {
          "gift_message": {
            "from": "User1",
            "message": "Thank you message",
            "to": "User2"
          }
        }
      ]
    }
  }
}

If incorrect Authorization token is provided:

{
  "errors": [
    {
      "message": "The current customer isn't authorized.",
      "extensions": {
        "category": "graphql-authorization"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "customerOrders"
      ]
    }
  ],
  "data": {
    "customerOrders": null
  }
}

If there is an order but with no gift message

{
  "errors": [
    {
      "message": "Can't load gift message for order",
      "extensions": {
        "category": "graphql-input"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "customerOrders",
        "items",
        0,
        "gift_message"
      ]
    }
  ],
  "data": {
    "customerOrders": {
      "items": [
        {
          "gift_message": null
        }
      ]
    }
  }
}

@engcom-Kilo
Copy link
Contributor

@magento run all tests

@engcom-Kilo
Copy link
Contributor

@magento run Magento Health Index

@engcom-Kilo
Copy link
Contributor

@magento run all tests

@slavvka slavvka added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Jun 5, 2020
@slavvka slavvka added this to the 2.4.1 milestone Jun 5, 2020
@magento-engcom-team magento-engcom-team merged commit d9ef0d9 into magento:2.4-develop Jun 5, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 5, 2020

Hi @Usik2203, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@lenaorobei lenaorobei added the QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope label Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: category of expertise Award: test coverage Component: GiftMessageGraphQl Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: accept Project: GraphQL QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

GraphQL Checkout :: Add support for Gift Wrapping / Gift Message during checkout.
9 participants