I use flutter_driver and gherkin for test my app.
I want to use action to page back (find.pageBack()) but the Flutter Driver doesn't found the button on IOS emulator. On Android, it's ok.
I don't have any error just a timeout : TimeoutException after 0:00:10.000000: Future not completed
import 'package:flutter_driver/flutter_driver.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
class NavValidation extends ThenWithWorld<FlutterWorld> {
#override
Future<void> executeStep() async {
await FlutterDriverUtils.getText(world.driver, find.text('sagittarius / yesterday'));
await FlutterDriverUtils.tap(world.driver, find.pageBack());
}
RegExp get pattern => RegExp(r"user should land on result screen");
}
Related
Here is my dart code
import 'package:tpdart/tpdart.dart' as tpdart;
void main(List<String> arguments) {
print('Hello world: ${tpdart.calculate()}!');
}
But when I type F5, I get this issue:
I tried to looking in Google but I didn't see any solution.
In my vaadin application I need to implement a fixed header, that changes size depending on the scroll position of the UI.
While there are geters for scroll position in Vaadin 8, there seems to be no functionallity implemented to listen for scroll events. So I tried to implement a JavaScript connector, that just informs the server-side UI, that the user has scrolled, so the server-side UI can then notify the Header as a scrollListener.
So far thats what I planned, but I just can't find out, how to implement my connector in a way that it.
is active after the site got requested by a Client.
is able to call my server-side UI.onScrollEvent() method.
Does anyone know, how the described behavior could be implemented?
Thank you for your help in advance.
After I ran into a few issues with implementaton of a custom widget to achieve, I went for a different approach, using extensions in a vaadin-sense. Here is the truncated code for what I did.
(Vaadin requires the client-side connector code shown later in this post to be in a Widget package. I'm not entirely sure if the server-side component has to be in one too, but for conformity reasons with the usual widget-skeleton I put it into one)
So in the package for the widget:
package my.company.project.scrollUI;
import com.vaadin.server.AbstractExtension;
import com.vaadin.ui.UI;
import my.company.project.scrollUI.client.scrollUI.ScrollUIServerRpc;
public class ScrollUI extends AbstractExtension {
private ScrollUIServerRpc rpc = new ScrollUIServerRpc() {
#Override
public void onScroll() {
//do whatever you need for your implementation
...
}
};
public ScrollUI() {
registerRpc(rpc);
}
public void extend(UI ui) {
super.extend(ui);
}
}
as usual the .gwt.xml file in the package folder, nothing special here:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
</module>
In the package for the client-side code to be compiled to JavaScript:
package my.company.project.scrollUI.client.scrollUI;
import com.vaadin.shared.communication.ServerRpc;
public Interface ScrollUIServerRpc extends ServerRpc {
public void onScroll();
}
And finally the connector for the extension:
package my.company.project.scrollUI.client.scrollUI;
import com.google.gwt.event.dom.client.ScrollEvent;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.extensions.AbstractExtensionConnector;
import com.vaadin.shared.ui.Connect;
#Connect(ScrollUI.class)
public class ScrollUIConnector extends AbstractExtensionConnector {
ScrollUIServerRpc rpc = RpcProxy.create(ScrollUIServerRpc.class, this);
#Override
protected void extend(ServerConnector target) {
final Widget ui = ((ComponentConnector) target).getWidget();
ui.addDomHandler(new ScrollHandler() {
#Override
public void onScroll(ScrollEvent event) {
rpc.onScroll();
}
}, ScrollEvent.getType());
}
}
Now don't forget to compile the Widgetset and everything is good to go to be used for your actual UI like all other vaadin extensions:
public class MyUI extends com.vaadin.ui.UI {
#Override
protected void init(VaadinRequest vaadinRequest) {
ScrollUI scrollUI = new ScrollUI();
scrollUI.extend(this);
//everything else that needs to be done
...
}
//everything else that Needs to be done
...
}
I hope this was helpfull for anyone with a similar issue.
I have done this once few years ago by extending the layout component that wrapped the part of UI where I needed this. In GWT there is gwtproject.org/javadoc/latest/com/google/gwt/event/dom/client/… which can be used in DOM handler. So yes, GWT provides suitable client side event. I then used RPC call to server side, where I triggered the corresponding server side event, which I could listen in other parts of the app. The code is not public, but there is LazyLayout add-on that has similar type of implementation, which you could check as reference for your implementation.
https://github.com/alump/LazyLayouts/blob/master/lazylayouts-addon/src/main/java/org/vaadin/alump/lazylayouts/client/LazyVerticalLayoutConnector.java
In the Dart vm the following code will not hang - the VM will exit:
import 'dart:async';
Future<Null> main() async {
await neverCompletes();
print('Will not run');
}
Future<Null> neverCompletes() => new Completer<Null>().future;
Is there any way to detect this situation? It would be easier to investigate if the VM hangs waiting for the Future. Any flags I can pass?
i am new to Appium. I want to perform mobile testing on android and i OS app using appium tool on sauce labs.
I want to know what are the pre-requisites, and how to write the scripts(in java) and how exactly the flow goes.
can anybody help me out??
Thanks a lot in advance.. :-)
package com.saucelabs;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import static junit.framework.Assert.assertEquals;
/**
* Simple {#link RemoteWebDriver} test that demonstrates how to run your Selenium tests with Sauce OnDemand.
* *
* #author Ross Rowe
*/
public class DemoScript {
private WebDriver driver;
#Before
public void setUp() throws Exception {
DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("browserName", "");
caps.setCapability("platformVersion", "4.4");
caps.setCapability("appiumVersion", "");
caps.setCapability("platformName", "Android");
caps.setCapability("deviceName", "Android Emulator");
caps.setCapability("device-orientation", "portrait");
/* DesiredCapabilities capabillities = DesiredCapabilities.iphone();
capabillities.setCapability("version", "5.0");
capabillities.setCapability("platform", Platform.MAC);*/
this.driver = new RemoteWebDriver(
new URL("http://**********************"),caps);
}
#Test
public void basic() throws Exception {
driver.get("http://www.amazon.com/");
assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle());
}
#After
public void tearDown() throws Exception {
driver.quit();
}
}
i am new to Appium. I want to perform mobile testing on android and i OS app using appium tool on sauce labs.
I want to know what are the pre-requisites, and how to write the scripts(in java) and how exactly the flow goes.
can anybody help me out??
Thanks a lot in advance.. :-)
Are there any changes required in the code?
Is appium server should be started before running the script?
I am trying to use deferred libraries and the new async style, but it does not seem to work:
import 'dart:async';
import 'package:defer/library1.dart' deferred as lib1;
void main() async {
var b = await lib1.loadLibrary();
var a = new lib1.MyClass('Peter');
print(a.name);
}
The deferred library is never loaded and Dartium loading indication always stays on.
Am I doing something wrong?
For some reason using the async_await transformer was the issue. See https://github.com/dart-lang/async_await/issues/81