Closed martijn-bigbridge closed 4 years ago
I see now that createGuestOrder (that was a test) really generates a order in the backend, haha so that is working but one step too far.
I need to see the random product at the cy.visit('/checkout/register'); page
Hello @martijn-bigbridge :wave: thank you for your issue and sorry for being late :see_no_evil:
1) Unfortunately, I can't reproduce this issue as the commands work as intended in our tests. Can you provide us more information, e.g. a gist with your full test or similar?
2) If you want to start your test with a full cart, using order commands alone aren't enough. As the context token is not stored in the Storefront session automatically via fixture, you need to write a small handler that writes the context token into the user session.
In our tests, we use the "old school" way as it's part of the workflow the customer would do. You can find our tests in the platform repository.
Well, I hope I was able to help you already, at least a bit. Kind regards, Ramona
Hi @leichteckig,
Thanks for the info.
Using cy.createGuestOrder(product, UserData) will give this error in the latest clean build (shopware) version.
sales-channel-api/v1/checkout/guest-order 400 (Bad Request) VIOLATION::IS_BLANK_ERROR
To fix this problem I hard coded this file: custom/plugins/x/src/Resources/app/storefront/test/e2e/node_modules/@shopware-ag/e2e-testsuite-platform/cypress/support/service/saleschannel/fixture/order.fixture.js
Into
Then I get the correct data.
But I don't understand how to do e2e test this page /checkout/register 1.) I thought these were the right steps.
But when I do this, I cart is still empty without products.
2.) Or do I need to use some posts (this give the same empty cart problem)
3.) Or do I use cypress old school by navigate to the random product url, and search for the "add to cart" button, and than go to the checkout/register page
The full test code at the moment. It would be cool if someone can give a working example.
I'm using 3 fixtures