elgentos / magento2-cypress-testing-suite

A community-driven Cypress testing suite for Magento 2
MIT License
172 stars 37 forks source link

Refactor luma tests #48

Open kolaente opened 2 years ago

kolaente commented 2 years ago

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.

peterjaap commented 2 years ago

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

kolaente commented 2 years ago

@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.

vladhorielov commented 2 years ago

@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/ ?

peterjaap commented 2 years ago

@vladhorielov how is this review going?

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

kolaente commented 2 years ago

@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 commented 2 years ago

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

vladhorielov commented 2 years ago

@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

kolaente commented 2 years ago

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 $?

vladhorielov commented 2 years ago

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

yes

vladhorielov commented 2 years ago

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 ?

peterjaap commented 2 years ago

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

vladhorielov commented 2 years ago

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

kolaente commented 2 years ago

@peterjaap currently not.