-
Notifications
You must be signed in to change notification settings - Fork 24
chore: Share Image via share extension to 1:1 conversation - WPB-22550 #4056
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
Open
findms
wants to merge
8
commits into
develop
Choose a base branch
from
chore/test-share-extension-flow
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+283
−0
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3011da2
share extension tests
findms a0c4317
Merge branch 'develop' into chore/test-share-extension-flow
findms 35d497c
share image to 1:1 conversation via share extension
findms 8d68369
clean up and finish up this test
findms f961a6c
formatting and changed the logic to store id in UserInfo
findms a5366c7
formatting
findms 7684a92
pr feedbacks
findms ce37bea
formatting
findms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| // | ||
| // Wire | ||
| // Copyright (C) 2025 Wire Swiss GmbH | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with this program. If not, see http://www.gnu.org/licenses/. | ||
| // | ||
|
|
||
| import WireLocators | ||
| import XCTest | ||
|
|
||
| class PhotosAppPage: PageModel { | ||
| private let photosApp: XCUIApplication | ||
| private let timeout: TimeInterval = 2 | ||
|
|
||
| override var pageMainElement: XCUIElement { | ||
| photosApp.windows.firstMatch | ||
| } | ||
|
|
||
| init(photosApp: XCUIApplication) throws { | ||
| self.photosApp = photosApp | ||
| try super.init() | ||
| } | ||
|
|
||
| var continueButtonOnWhatsNewPhotosApp: XCUIElement { | ||
| photosApp.buttons[Locators.ShareExtensionPage.continueButton.rawValue].firstMatch | ||
| } | ||
|
|
||
| var firstImageTile: XCUIElement { | ||
| photosApp.images[Locators.ShareExtensionPage.imageTile.rawValue].firstMatch | ||
| } | ||
|
|
||
| var shareButton: XCUIElement { | ||
| photosApp.buttons | ||
| .matching(identifier: Locators.ShareExtensionPage.shareButton.rawValue) | ||
| .firstMatch | ||
| } | ||
|
|
||
| var shareToWireApp: XCUIElement { | ||
| photosApp.cells["Wire"].firstMatch | ||
| } | ||
|
|
||
| var chooseConversationButton: XCUIElement { | ||
| photosApp.buttons[Locators.ShareExtensionPage.chooseConversations.rawValue].firstMatch | ||
| } | ||
|
|
||
| var sendButton: XCUIElement { | ||
| photosApp.buttons[Locators.ShareExtensionPage.sendButtonOnShareExtension.rawValue].firstMatch | ||
| } | ||
|
|
||
| func selectConversation(name: String) -> XCUIElement { | ||
| photosApp.staticTexts[name].firstMatch | ||
| } | ||
|
|
||
| @discardableResult | ||
| func continueWhatsNewIfPresent() throws -> PhotosAppPage { | ||
| if continueButtonOnWhatsNewPhotosApp.waitForExistence(timeout: timeout) { | ||
| continueButtonOnWhatsNewPhotosApp.tap() | ||
| } | ||
| return self | ||
| } | ||
|
|
||
| @discardableResult | ||
| func openFirstImage() throws -> PhotosAppPage { | ||
| try continueWhatsNewIfPresent() | ||
| XCTAssertTrue(firstImageTile.waitForExistence(timeout: 10)) | ||
| // NOTE: Use a coordinate tap on center because Photos grid cells are not always directly hittable in UITests | ||
| firstImageTile | ||
| .coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) | ||
| .tap() | ||
| return self | ||
| } | ||
|
|
||
| @discardableResult | ||
| func shareImageToWire() throws -> PhotosAppPage { | ||
| XCTAssertTrue(shareButton.waitForExistence(timeout: timeout)) | ||
| shareButton.tap() | ||
| XCTAssertTrue(shareToWireApp.waitForExistence(timeout: timeout)) | ||
| shareToWireApp.tap() | ||
| return self | ||
| } | ||
|
|
||
| func chooseConversationAndSend(name: String) throws { | ||
| XCTAssertTrue(chooseConversationButton.waitForExistence(timeout: timeout)) | ||
| chooseConversationButton.tap() | ||
|
|
||
| let conversationToSend = selectConversation(name: name) | ||
| XCTAssertTrue(conversationToSend.waitForExistence(timeout: timeout)) | ||
| conversationToSend.tap() | ||
|
|
||
| XCTAssertTrue(sendButton.waitForExistence(timeout: timeout)) | ||
| sendButton.tap() | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // | ||
| // Wire | ||
| // Copyright (C) 2025 Wire Swiss GmbH | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with this program. If not, see http://www.gnu.org/licenses/. | ||
| // | ||
|
|
||
| import WireFoundation | ||
| import WireLocators | ||
| import XCTest | ||
|
|
||
| final class ShareExtensionTests: WireUITestCase { | ||
|
|
||
| private let photosAppBundleId = XCUIApplication(bundleIdentifier: "com.apple.mobileslideshow") | ||
|
|
||
| @MainActor | ||
| private func launchPhotosApp() async throws { | ||
| photosAppBundleId.launch() | ||
| XCTAssertTrue(photosAppBundleId.wait(for: .runningForeground, timeout: 10)) | ||
| } | ||
|
|
||
| @MainActor | ||
| private func shareFirstPhotoToWire(name: String) async throws { | ||
| let photosApp = try PhotosAppPage(photosApp: photosAppBundleId) | ||
| try photosApp | ||
| .openFirstImage() | ||
| .shareImageToWire() | ||
| .chooseConversationAndSend(name: name) | ||
| } | ||
|
|
||
| @MainActor | ||
| private func switchBackToWireApp() async throws { | ||
| app.activate() | ||
| if !app.wait(for: .runningForeground, timeout: 10) { | ||
| app.launch() | ||
| _ = app.wait(for: .runningForeground, timeout: 10) | ||
| } | ||
| } | ||
|
|
||
| @MainActor | ||
| func test_ShareImageOnetoOne() async throws { | ||
|
|
||
| let user1 = try await userHelper.createPersonalUser() | ||
| let user2 = try await userHelper.createPersonalUser() | ||
| let domain = BackendTarget.staging.domainInfo | ||
|
|
||
| try await userHelper.sendConnectionRequestToUser(domain: domain, userId: user1.id) | ||
| try await userHelper.acceptConnectionRequestFromUser(domain: domain, user1: user1, userId: user2.id) | ||
| let firstTimePage = try app.loginUser(email: user1.email, password: user1.password) | ||
| let conversationsPage = try firstTimePage.acceptPopup(with: self) | ||
|
|
||
| try await launchPhotosApp() | ||
| try await shareFirstPhotoToWire(name: user2.name) | ||
| try await switchBackToWireApp() | ||
|
|
||
| let activeConversationPage = try conversationsPage.openConversation() | ||
|
|
||
| XCTAssertTrue( | ||
| activeConversationPage.imageCell.exists, "No Image cell found" | ||
| ) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
question: interesting do you have reference to this? is it the only way to deal with it?
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.
In case if I don't use .coordinate..it returns isHittable = false and fails due to this. with co-ordinates works fine as it try to tap on center.
this is what it returns in debug desc
On in logs when fails to tap()
Tried some other approach navigating through parent hierarchy but still it returns false.
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.
well a image is never hittable in itself, so makes sense, I would expect cells or collectionViewCells in photoApp that you can select. can you have the hierarchy of photosApp?
Uh oh!
There was an error while loading. Please reload 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.
this is the hierarchy:
tried with scrollview as well but no luck.
Found that the 1st row of images are not hittable due to some reason but 2nd row is? So if I use
po photosApp.images.matching(identifier: Locators.ShareExtensionPage.imageTile.rawValue)..element(boundBy: 4).tap() - works