How to swipe iOS emulator screen - appium-ios

As soon as I upgraded my local version of Appium, all my swipe logic stopped working. I moved to the non deprecated API, and but I'm till not able to observe swipes. I'm pretty sure I'm just not using the coordinate system correctly but I'm not sure how. I want to swipe vertically down the screen of an iOS simulator to refresh a list view.
Any pointers on how to treat properly swipe and why, and what the mechanics of it are?
Here is my code for swiping
PointOption fromPoint = PointOption.point(
topView.getLocation().x,
topView.getLocation().y);
PointOption toPoint = PointOption.point(
bottomView.getLocation().x,
bottomView.getLocation().y);
new TouchAction(user.mDriver)
.press(fromPoint)
.moveTo(toPoint)
.release()
.perform();

I upgraded my version of Appium and my Java client, but those improvements didn't fix the swiping.
Apparently, one must add a wait duration for the swipe to take place.
WaitOptions waitOptions = WaitOptions.waitOptions(Duration.ofMillis(500));
new TouchAction(mUser.mDriver)
.press(fromPoint)
.waitAction(waitOptions)
.moveTo(toPoint)
.release()
.perform();

This is my code it is working fine for IOS simulator swiping .
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", "left");
js.executeScript("mobile: swipe", scrollObject);

Related

Xamarin.Forms - Community Toolkit Popup working in iOS not Android

I have a bit of code that uses the Community Toolkit popup control. It works fine in iOS but no text is shown in Android. When I put a breakpoint, it does not appear to hit the breakpoint -- nor does it appear to hit other breakpoints.
var popup = new SwipePopUp
{
CheckBoxText=CheckboxLabelText,
GotItText=GotItText,
CentralText=CentralText,
Size=size
};
App.Current.MainPage.Navigation.ShowPopup(popup);
Any thoughts?
Thanks!
We have discovered that while iOS does not need OnPropertyChanged, Android does, and adding that fixed the problem.
Thanks!

Vaadin: How to react to a tray notification click?

I'm using Tray Notifications to let the user know about some pending actions. It works fine but would love to be able to click on it and do what I need it to do like showing the correct screen, etc. Sadly I'm unable to find some click listener like other components.
Am I'm missing something?
As far as I know that's not possible with the default notification in either Vaadin 7 or 8.
If you're using Vaadin 7, you can either fake it using a non-modal window (or something similar), or use the fancy-layouts add-on (also compatible with 8) that offers a FancyNotifications component (online demo and source). It's not exactly the same thing but it may provide what you need. Also be careful to select the v7 version and to add the suggested maven repo.
Basic usage:
public class MyUi extends UI {
#Override
protected void init(VaadinRequest request) {
FancyNotifications fancyNotifications = new FancyNotifications();
fancyNotifications.setPosition(FancyNotificationsState.Position.BOTTOM_RIGHT);
Button button = new Button("Show notification", buttonClickEvent -> {
FancyNotification fancyNotification = new FancyNotification(null, "Meh", "Click me to navigate to GITHUB");
fancyNotification.getTitleLabel().setContentMode(ContentMode.HTML);
fancyNotification.getDescriptionLabel().setContentMode(ContentMode.HTML);
fancyNotification.addLayoutClickListener(notificationClickEvent -> Page.getCurrent().setLocation("https://github.com/alump/FancyLayouts"));
fancyNotifications.showNotification(fancyNotification);
});
VerticalLayout content = new VerticalLayout();
content.setSizeFull();
setContent(content);
content.addComponents(button, fancyNotifications);
content.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
}
}
Result:
If you're using 8, there's the notify add-on (online demo and github page) which supports click-listeners. Please be aware that this add-on currently supports Vaadin 8 and works with browsers that support the Notification API:
Development is mainly done on Chrome. Also Firefox is tested and mainly works as planned. Other browsers are still not tested. IE11 and Edge does not support Notification API as far as I know. Anyway add-on can use used only to show notifications on browsers that do support Notification APIs.
From the github demo:
private void showWithClickHandling() {
Notify.show(new NotifyItem()
.setTitle("Notification can be also clicked")
.setBody("Click here to navigate to project's GitHub page")
.setIcon(new ThemeResource("images/github.png"))
.setClickListener(e -> {
Page.getCurrent().setLocation(GITHUB_URL);
}));
}
... which will look like:

JComboBox only appears where window was created

I have a very large database program that I am developing in IntelliJ IDEA, I am using the GridLayoutManager from IntelliJ and just became aware of a bug with my JComboBoxes, when I click on them they appear where the window was initially shown; If I move the window the combo box list stays in place if its not showing, else if it is showing it moves with the window, any ideas would be much appreciated
OSX 10.9
Java 8
IntelliJ Idea 16
This is the source for the dialog, IntelliJ handles creation of components
behind the scenes...
public DestinationSetupDialog(){
super(ResourceLoader.TITLE);
this.add(mainPanel);
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.pack();
this.setVisible(true);
closeButton.addActionListener(e -> dispose());
saveButton.addActionListener(e -> saveData());
selectStartDate.setModel(Dates.populateDates(365).getModel());
}
private void saveData(){
}
Is this an issue with setting the model ? Because even newly created empty JComboBoxes do the same thing.

Custom URL issue in flex ios app

i am using custom url scheme in my flex iOS app and it’s working fine when i start my app from a web link..but the issue is when i start my app from start menu in iPad and move to webpage in safari.In page i click a button that redirects it to my app, at that time app call “preinitialize” method more than once..it wary every time, some time it’s 2,3,4 and different one each time..i don't know why it’s behaving like this..can i know the reason please its urgent..
thanks…any help will be appreciated.
Create a flag initialized and set it to true when preinitialize is called. All other calls to this method can be filtered out. Simple example:
private var initialized:Boolean = false;
public function preinitialize():void
{
if (initialized) return;
initialized = true;
}
Next step would be finding the real cause of the multiple calls, but for that we would need to see some code of your app.

Carbon, LSUIElement, and showing a window

I have a Carbon LSUIElement application, which runs in the background (possibly with an icon in the menubar, depending on a pref) and occasionally needs to show a dialog to the user - sometimes in response to a user event, but sometimes in response to a background task failing or similar.
(I'm using Qt 4.5, so the application is Carbon based; With Qt 4.6 things will be Cocoa based, but it sounds as if the problem may exist there too).
The problem is that when I open a window, and show it, it doesn't get brought to the front. I assume this is an artefect of being an LSUIElement app. Qt uses SelectWindow in Carbon, and [makeKeyAndOrderFront] in Cocoa, to bring a window (and the app) to the front.
To work around the problem, I tried going direct to the window server: (the first few steps are to get the WindowID, this will be simpler with Qt-Cocoa, since I can use NSWindow:nativeWindow)
WindowRef ref = HIViewGetWindow((HIViewRef) aWidget->winId());
CGSWindow wid = GetNativeWindowFromWindowRef(ref);
CGSConnection cid =_CGSDefaultConnection();
CGSOrderWindow(cid, wid, 1 /* above everything */, 0 /* NULL */);
This works, sort of - the window comes to the front, but it's not highlighted or keyboard focused. Are there additional steps to fix those issues, or is there a simpler solution to the whole problem?
Use SetFrontProcessWithOptions to bring your window in front of other apps.
Try:
[NSApp activateIgnoringOtherApps: YES]

Resources