Detox
Detox copied to clipboard
How to test with pasteboard?
I'm using detox to test a RN app, how to test with Clipboard?
@iwater what is that?
set some string at clipboard, then read that from app, or set string into clipboard from app and check it from test as expected
2017-08-06 3:39 GMT+08:00 Anton Kuznetsov [email protected]:
@iwater https://github.com/iwater what is that?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wix/detox/issues/222#issuecomment-320466013, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGpiWv2it9N_1EB9Ns5Dg4M_BwSG7Zwks5sVMTdgaJpZM4Oug5d .
not sure that it will be a main priority feature :)
It's a perfectly valid feature request though. I quickly checked Earlgrey, It seems there is no support for this there.
What will this feature test? That the system clipboard is working correctly?
I had an app many many years ago, where the primary event to it was copy pasting a longer text to it. It is actually a different event than typing characters into the textfield one after another. (Although, you have to work a bit for that. ;) )
I am not talking about what @iwater described.
I am thinking about actions like, copy paste into a specific view the current clipboard.
Edge case? Definitely. But, I think it can't be covered by simply long clicking into a textview then trying to tap the paste button.
in my app, it check the clipboard , if there is a url as expected, the app will show a dialog
2017-08-07 7:16 GMT+08:00 Simon Racz [email protected]:
I had an app many many years ago, where the primary event to it was copy pasting a longer text to it. It is actually a different event than typing characters into the textfield one after another. (Although, you have to work a bit for that. ;) )
I am not talking about what @iwater https://github.com/iwater described.
I am thinking about actions like, copy paste into a specific view the current clipboard.
Edge case? Definitely. But, I think it can't be covered by simply long clicking into a textview then trying to tap the paste button.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wix/detox/issues/222#issuecomment-320539242, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGpiYO_uoDDHlMbZHGcIb8Q7y5bV8tTks5sVkldgaJpZM4Oug5d .
I can think of many cases where apps would want to test that they have copied the correct text to clipboard. For example, a passwords keeping app.
You can use xcrun simctl pbcopy/pbpaste to pass clipboard between device and computer. This would be nice if you could add this feature via PR.
Would Paste text be faster than "simulated" typing? Speed is valuable when running [many] automated test cases.
@markhu No, it should be the same. Detox’ future support for Pasteboard will only be for expecting values in the pasteboard, so I don’t see how Detox can be helpful in your case. Replacing text is the fastest way to enter text.
I would welcome readPasteboard method.
I have a usecase with copy to clipboard button. I would like to read the device's pasteboard to verify, that the button actually works.
As mentioned above there is simctl in the xcode utils (for iOS of course), but seems somehow broken.
I found JS sim utils, which don't work properly... https://github.com/appium/node-simctl/issues/79 It would be valuable to have this API...
Would be nice https://github.com/wix/Detox/pull/658/files
@LeoNatan Can you please share why the related pull request was deleted without any comment?
The issue has been closed for inactivity.
Pull request was closed because it had many issues, the person working on it was no longer working on it and it went stale. We don’t have the resources to commit to this. If someone takes the JS side and implements it in a PR, I’ll add the iOS native side.
@LeoNatan I think I'm able to work on it on the last week of the year. Do you mind pointing me to the PR and related information? Feel free to share any thoughts on how to best implement it.
@sidferreira Hello, thank you for offering to assist!
We need to come up with the Detox API first, I think, and its limitations, and then we can discuss implementation. I can give pointers with iOS.
Pasteboard on iOS can hold many different objects, such as generic data, images, colors, etc. I don't think we can support all of them. Perhaps we can limit testing to strings? Or other common objects. I think strings are enough.
UIPasteboard reference: https://developer.apple.com/documentation/uikit/uipasteboard?language=objc
API design is problematic, I think. We don't currently have expectations over device.
My idea of API is:
await expect(device.pasteboard()).toHaveValue("hello");
@LeoNatan I think we should, at least for now, focus on string content. The only note is that, if possible, I would like to have a way to return such string. What you think?
@sidferreira That's also possible, and then let the user test the value on their own.
So, an API of this sort:
await device.getPasteboard()
could work.
@sidferreira did you end up working on this? I have an interesting use case as I wrote here, where we want to test a flow where a user shares a deeplink to the app. Assuming I'll be able to get Detox to tap the 'copy link' dialog (an assumption I'm not sure is valid), having this feature could really help. Otherwise we'll resort to mocking the Share.share(arguments) call and somehow pass the arguments to the test.
@electricmonk Sadly I couldn't. Some last-minute plans changed all my December schedule and still trying to get back on track.
Hi @electricmonk is there any news on this topic. I'd be highly interested in this as well. Thanks for contributing to such an awesome framework.
Ended up mocking Share.share
Is there any news in regards to the possible device.getPasteboard() API?
One possibility is that when you tap on the copy to clipboard button, a toast with that information appears but only for the E2E environment or some environment variable that enables showing toast when copying to the clipboard.