magento2-cypress-testing-suite icon indicating copy to clipboard operation
magento2-cypress-testing-suite copied to clipboard

Refactor luma tests

Open kolaente opened this issue 3 years ago • 13 comments

This PR refactors luma tests, mainly by adding cy.intercept to get rid of calls to cy.wait with a fixed number of seconds. There are still a few of those in there but I think this already improves the reliability of the tests. The PR also uses the methods introduced in #47 to assert for success and error messages.

The things changed and fixed in this PR are mostly those I noticed while implementing the cypress test suite for a luma based shop. I've also added a few test cases from our MFTF-based testing suite (which we're going to retire very soon, thanks to Cypress!) which may be useful to others.

Each area of changes is in a separate commit, I could also split this PR into multiple smaller ones if that makes it easier to review.

kolaente avatar Mar 29 '22 09:03 kolaente

@vladhorielov could you do a review on this? Since we're not doing Luma anymore, I have no project to test this on.

peterjaap avatar Mar 29 '22 09:03 peterjaap

@vladhorielov How are you running these? Against a default Magento luma installation with test data? What fails?

They work perfectly fine in the instance I tested them in but that's one with a few customizations here and there.

kolaente avatar Mar 30 '22 08:03 kolaente

@vladhorielov How are you running these? Against a default Magento luma installation with test data? What fails?

They work perfectly fine in the instance I tested them in but that's one with a few customizations here and there.

I ran on a default Magento 2 Luma with a simple date. I have problem with some selectors and cy.intercept/cy.wait Can you provide a link to the site you tested on? or you can run these tests here for example https://magento2-demo.magebit.com/ ?

vladhorielov avatar Mar 30 '22 08:03 vladhorielov

@vladhorielov how is this review going?

@kolaente have you looked at Vlad's results yet?

peterjaap avatar Apr 14 '22 03:04 peterjaap

@peterjaap I've looked into it briefly but didn't had the time yet to properly fix this. I hope to get to that next week.

kolaente avatar Apr 14 '22 06:04 kolaente

I think most of the tests should work now - only the account tests needs further testing.

kolaente avatar May 13 '22 11:05 kolaente

@kolaente @peterjaap i just rechecked the tests:

The cart test fails at the coupon code generation stage. I don't think it's right to create code via rest api, as it requires additional steps for testing (create a token and additional logic for the request), what do you think? I think it's better to leave the standard code "H20" for this product "affirm-water-bottle.html"

Category test not working

The checkout test does not work, we also use € as the currency, although the default should be $

Account test still not working

vladhorielov avatar May 16 '22 13:05 vladhorielov

I initially added the create random coupon step because we didn't have a usable coupon in our test dump and I'd have to create one anyway via the api. Might as well do it directly in the test.

The checkout test does not work, we also use € as the currency, although the default should be $

You mean the test should work in a store with $?

kolaente avatar May 16 '22 14:05 kolaente

You mean the test should work in a store with $?

yes

vladhorielov avatar May 16 '22 14:05 vladhorielov

I initially added the create random coupon step because we didn't have a usable coupon in our test dump and I'd have to create one anyway via the api. Might as well do it directly in the test.

it doesn't work everywhere, i think we need use another way for testing this, the default code "H20" for this product "affirm-water-bottle.html" doesn't work for you ?

vladhorielov avatar May 16 '22 14:05 vladhorielov

Any work being done on this still @vladhorielov @kolaente ?

peterjaap avatar Sep 13 '22 12:09 peterjaap

@peterjaap nope from my side. I was just a code reviewer, but it doesn't work for me.

vladhorielov avatar Sep 13 '22 13:09 vladhorielov

@peterjaap currently not.

kolaente avatar Sep 13 '22 13:09 kolaente