-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add MTE-1520 [v119] Add simple test for Fakespot #16405
Conversation
Generated by 🚫 Danger Swift against 9c50036 |
Tests/XCUITests/FakespotTests.swift
Outdated
import XCTest | ||
|
||
class FakespotTests: BaseTestCase { | ||
func testFakespotAvailable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the testrail link before the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not created yet, we should create the tests there, I already talked to @abodea about this and he agrees on having the test suite there with this basic test for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created the test on TestRail.
Tests/XCUITests/FakespotTests.swift
Outdated
// Tap shopping cart icon on Awesome bar | ||
// Note: I can't find the label for the shopping cart icon. | ||
// Workaround: Tap somewhere left of the "Share" button | ||
waitForExistence(app.buttons["TabLocationView.shareButton"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the accessibility ids to look for view elements? The id for the button is AccessibilityIdentifiers.Toolbar.shoppingButton
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app.debugDescription
does not show AccessibilityIdentifiers.Toolbar.shoppingButton
in the awesome bar. Such an icon is displayed and can be tapped. Here is the debugDescription:
Other, 0x7ff510a1bb60, {{7.0, 53.0}, {376.0, 42.0}}
TextField, 0x7ff510a3e0d0, {{48.0, 63.0}, {215.0, 22.0}}, identifier: 'url', label: 'Address Bar', placeholderValue: 'Search or enter address', value: www.amazon.com/gp/...
Button, 0x7ff510a3a870, {{343.0, 54.0}, {40.0, 40.0}}, identifier: 'TabLocationView.reloadButton', label: 'Reload page'
Button, 0x7ff510a3ac20, {{7.0, 54.0}, {40.0, 40.0}}, identifier: 'TabLocationView.trackingProtectionButton', label: 'Secure connection'
Button, 0x7ff510a3afd0, {{303.0, 54.0}, {40.0, 40.0}}, identifier: 'TabLocationView.shareButton', label: 'Share this page'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thatswinnie has that icon changed the ID, wondering why @clarmso cannot see it when printing the elements... I will give this a try later today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on the coordinates to tap on the shoppingButton
(via tapAtPoint
) is flaky on my end. I would not merge this PR before debugDescription
could see the icon. 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed... that coordinates are specific to a device's screen size.. better to have the ID...
Tests/XCUITests/FakespotTests.swift
Outdated
waitForExistence(app.buttons["TabLocationView.shareButton"]) | ||
app.buttons["TabLocationView.shareButton"].tapAtPoint(CGPoint(x: -10, y: 0)) | ||
waitForExistence(app.otherElements["PopoverDismissRegion"]) | ||
waitForExistence(app.staticTexts["Shopping.Sheet.HeaderTitle"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title has the a11y id AccessibilityIdentifiers.Shopping.sheetHeaderTitle
.
I run the test locally and it works consistently. Good job here! |
Tests/XCUITests/FakespotTests.swift
Outdated
// Workaround: Tap somewhere left of the "Share" button | ||
waitForExistence(app.buttons[AccessibilityIdentifiers.Toolbar.shareButton]) | ||
waitUntilPageLoad() | ||
app.buttons[AccessibilityIdentifiers.Toolbar.shareButton].tapAtPoint(CGPoint(x: -10, y: 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the coordinates to tap the shopping icon is flaky.
|
||
// Tap the shopping cart icon | ||
waitUntilPageLoad() | ||
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
bitrise.yml
Outdated
@@ -102,6 +102,7 @@ workflows: | |||
|
|||
echo "bitrise_xcode" | |||
COUNT_XCUI=$(./test-fixtures/generate-metrics.sh /Users/vagrant/git/xcodebuild_fennec.log all) | |||
cat /Users/vagrant/git/xcodebuild_fennec.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to debug the lint warning/error.
This is looking great @clarmso! Once the IDs are added as @thatswinnie commented, this could be ready to land. |
Bitrise is red due to the increase in warnings. There is a new warning added in this PR:
|
@isabelrios The test fails about 5-6 times out of 100 consecutive test runs. If we only run the test once every few minutes, we may be ok. 🤔 |
Tests/XCUITests/FakespotTests.swift
Outdated
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton]) | ||
app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap() | ||
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) | ||
XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, String.Shopping.SheetHeaderTitle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thatswinnie String.Shopping.SheetHeaderTitle
is not recognized. Please help. 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we need import Shared
for that to be recognized but then there is the new warning...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clarmso if you add the dependency here, it may not warn you ... we did something similar with Common and there is not a warning for that (not sure if this is why though)
app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap() | ||
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) | ||
XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, .Shopping.SheetHeaderTitle) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same style as in the source code here.
label.text = .Shopping.SheetHeaderTitle |
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
import XCTest | ||
import Shared |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import Shared
is giving me a new warning but the identifier does not work without this import. 🤔
⚠️ /Users/vagrant/git/Tests/XCUITests/FakespotTests.swift:5:8: implicit import of bridging header 'Shared-Bridging-Header.h' via module 'Shared' is deprecated and will be removed in a later version of Swift
import Shared
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clarmso we should try to fix this warning before merging, otherwise we will be close to threshold again... I can try to help you with that
Co-authored-by: Winnie Teichmann <[email protected]>
Co-authored-by: Winnie Teichmann <[email protected]>
@clarmso please rebase latest main, unit tests failures should be gone with that and we could land this PR |
📜 Tickets
Jira ticket
💡 Description
Fakespot has been enabled on Amazon.com. Let me write a new test to ensure that Fakespot is present.
📝 Checklist
You have to check all boxes before merging