Skip to content

Conversation

@jostnes
Copy link
Contributor

@jostnes jostnes commented Dec 12, 2022

Description

This PR adds a new test case Add new product - Simple physical product to the UI test suite. I've removed the first product currently on the Products list so that that product can be the new product. Also, I realized that the Create Order tests are dependent on this value on the mock file, so I've updated some of the orders mock with the new values.

To keep the test light while still maintaining the test's purpose (to validate that adding a simple physical product works), only the product name is added from the UI, and other data are added to the mock file.

The validation is on the new product screen where the test validates the existence of the Save button and an announcement (both of which do not appear when selecting the product from the product list)

Testing instructions

The new test test_add_simple_physical_product() should pass in CI and locally. The test should also fail when verification points are not met.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@jostnes jostnes added feature: add/edit products Related to adding or editing products. category: ui tests Related to UI testing. labels Dec 12, 2022
@jostnes jostnes added this to the 11.7 milestone Dec 12, 2022
@jostnes jostnes requested a review from a team as a code owner December 12, 2022 06:57
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 12, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8380-718db71 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@jostnes jostnes marked this pull request as draft December 12, 2022 07:49
@jostnes jostnes marked this pull request as ready for review December 12, 2022 09:06
Copy link
Contributor

@pachlava pachlava left a comment

Choose a reason for hiding this comment

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

Hi @jostnes 🙂 👋

Thanks for the new test! I especially like the parts related to adding new accessibility identifiers 👍.

There's a typo in the products types list for the virtual product, this is the only reason why I'm opting for "Comment"-type review, and not approving.

I also left some other notes - feel free to consider them.

Comment on lines 85 to 87
app.staticTexts[productType].tap()

return try SingleProductScreen()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noticing that there's a line break before return, while in two functions above there isn't:

Suggested change
app.staticTexts[productType].tap()
return try SingleProductScreen()
app.staticTexts[productType].tap()
return try SingleProductScreen()

Comment on lines 35 to 36
app.cells["product-title"].tap()
app.cells["product-title"].typeText(productTitle)
Copy link
Contributor

Choose a reason for hiding this comment

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

Tap followed by entering text is present in clearAndEnterText from XCTest+Extensions:

Suggested change
app.cells["product-title"].tap()
app.cells["product-title"].typeText(productTitle)
app.cells["product-title"].clearAndEnterText(text: productTitle)

The downside of it is that it also tries to clear existing text before entering, which takes time, so I'd recommend extracting the tap+type lines into a separate XCUIElement.enterText and call it instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the initial version of this was using clearAndEnterText() but clearing the text field isn't needed in this case so i changed it. good idea on extracting only tap and type, i'll do that! thanks for the suggestion!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in 91b15ef

Comment on lines +46 to +47
XCTAssertTrue(app.buttons["save-product-button"].exists)
XCTAssertTrue(app.staticTexts["TIP"].exists)
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT of checking that this screen contains the product name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


let productTypes = [
"physical": "Simple physical product",
"virtual": "Virtual physical product",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should say

Suggested change
"virtual": "Virtual physical product",
"virtual": "Simple virtual product",

SCR-20221212-rfw

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oof - such a bad typo, thanks for catching this! will fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pachlava pachlava self-requested a review December 13, 2022 12:08
Copy link
Contributor

@pachlava pachlava left a comment

Choose a reason for hiding this comment

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

Thanks for all the follow-ups and changes @jostnes! 🎉

I took the liberty of making a tiny commit 718db71, to save up on back and forth's, so that you can merge it once you're back online.

It now looks a bit questionable to approve a PR in which I made a commit, but I see no reasons why it can't be approved 😅.

Thank you once again! :shipit:

@jostnes
Copy link
Contributor Author

jostnes commented Dec 14, 2022

I think it's fine, since the change you made is a small change that I missed 😅 Thank you for the thorough review as always! 🚀

@jostnes jostnes merged commit 0dfcac1 into trunk Dec 14, 2022
@jostnes jostnes deleted the add-product-ui-test branch December 14, 2022 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: ui tests Related to UI testing. feature: add/edit products Related to adding or editing products.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants