Preconditions:
Appium 1.21.0
TestNG 7.4.0
Im trying to run a test class in 2 simulator. But when executing the allSuites.xml it runs the 2 test class in the same device (iPhone 4 Plus). It completely ignores the first device (iPhone 14 - although the class I want to run in this device is run in the second device).
I've been trying every solution on web but there's not so much to follow, can anybody help me please?
Here's the allSuitesParallel.xml:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="AllSuitesParallel" verbose="3" parallel="tests" thread-count="2">
<suite-files suite="1">
<parameter name="wda" value="8100"/>
<parameter name="deviceName" value="iPhone 14"/>
<parameter name="port" value="5555"/>
<suite-file path="suitesFolder/onboardingAndDiscoverSuites/discoverMeatSuite.xml"/>
</suite-files>
<suite-files suite="2">
<parameter name="wda" value="8101"/>
<parameter name="deviceName" value="iPhone 14 Plus"/>
<parameter name="port" value="4726"/>
<suite-file path="suitesFolder/onboardingAndDiscoverSuites/discoverMeatSuite.xml"/>
</suite-files>
</suite>
This is the base
public static AppiumDriverLocalService service;
public static IOSDriver<MobileElement> driver;
private static final String APP_LOCATION = [app Location];
#Parameters({"wda","deviceName","port"})
#BeforeSuite
public static void setUp(String wda, String deviceName, String port){
try {
service = new AppiumServiceBuilder().usingPort(Integer.valueOf(port)).build();
service.start();
DesiredCapabilities caps = new DesiredCapabilities();
//LOCAL
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "16.0");
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "IOS");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
caps.setCapability(IOSMobileCapabilityType.WDA_LOCAL_PORT, wda);
caps.setCapability("automationName", "XCUITest");
caps.setCapability("maxTypingFrequency", "7");
//--Experiments
//caps.setCapability("fullReset", false);
//caps.setCapability("noReset", true);
//caps.setCapability("appium:shouldTerminateApp", true);
//--App
caps.setCapability(MobileCapabilityType.APP, APP_LOCATION);
//--Driver
URL url = new URL("http://127.0.0.1:4723/wd/hub");
driver = new IOSDriver<MobileElement>(url, caps);
} catch (Exception exp) {
System.out.println("Cause is : " + exp.getCause());
System.out.println("Message is : " + exp.getMessage());
exp.printStackTrace();
}
Also, I enable Appium by adding 'appium' in the terminal from the IDE Intellij:
User iOSTasty % appium
[Appium] Welcome to Appium v1.22.3
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
I followed this guy: https://www.youtube.com/watch?v=SfPcxjFERKU&t=308s&ab_channel=TechTockTech
and his xml is not working for me
Related
I am using protobuf and gRPC to exchange information between a Flutter app and a python server (client in Flutter and the server in python). Server running on 0.0.0.0 and the client is using the IP address of the server machine.
import 'dart:async';
import 'User.pbgrpc.dart';
import 'User.pb.dart';
import 'package:grpc/grpc.dart';
Future<Null> main() async {
final channel = new ClientChannel('IP_ADDRESS',
port: 50051,
options: const ChannelOptions(
credentials: const ChannelCredentials.insecure()));
final stub = new StorageClient(channel);
Test input = new Test();
input.id = 1;
try {
var response = await stub.getPerson(input);
print('Greeter client received: ${response}');
} catch (e) {
print('Caught error: $e');
}
await channel.shutdown();
}
if I run this client using dart client.dart everything works fine and I get the expected response. But if I embed this method in a flutter app like:
#override
Widget build(BuildContext context) {
Future<Null> testRPC() async {
final channel = new ClientChannel('IP_ADDRESS',
port: 50051,
options: const ChannelOptions(
credentials: const ChannelCredentials.insecure()));
final stub = new StorageClient(channel);
Test input = new Test();
input.id = 1;
try {
var response = await stub.getPerson(input);
print('Greeter client received: ${response}');
} catch (e) {
print('Caught error: $e');
}
await channel.shutdown();
}
testRPC();
...etc
}
I get:
I/flutter (18824): Caught error: gRPC Error (14, Error connecting: SocketException: OS Error: No route to host, errno = 111, address = localhost, port = 45638)
UPDATE: It is working when I run the app with an emulator. So this is error is happening only when using a real device.
If you run AVD(Client) and the backend in same computer, you have to set the base URL instead of "localhost/127.0.0.1" to "10.0.2.2".
Here's the answer in Github.
In my case, it was a firewall problem. Running systemctl stop firewalld on the server solved it.
I had the same error, Flutter app as grpc client and C# as grpc server. The problem was in the server, I was using "localhost" as host parameter, changed to "0.0.0.0" and now is running fine.
Maybe you should add network permission to android project:
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.client">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:label="client"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher">
Unable to get my Xamarin.Android app to fire Toast after boot. I checked many accepted solutions but none seem to resolve my problem. I've also tried various "working" examples but haven't had any luck so clearly I'm missing something.
Device: Samsung Galaxy S3
API: 19
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.novak" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application android:label="ReceiverApp">
<receiver android:enabled="true"
android:exported="true"
android-permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:name="com.novak.BootReceiver" >
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
BootReceiver.cs
using Android.App;
using Android.Widget;
using Android.Content;
namespace ReceiverApp
{
[BroadcastReceiver]
[IntentFilter(new[] { Intent.ActionBootCompleted })]
public class BootReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
Toast.MakeText(context, "Receiver", ToastLength.Long).Show();
}
}
}
It would appear that what I want to do is not possible. Once my app is installed the app sits in a stopped state and must be executed manually the first time before it can receive broadcasts
[How to start a Service when .apk is Installed for the first time
P.S: On real device it takes a while to fire the event, ie: 2 minutes after unlock the screen on my Samsung. On emulator it takes very short.
I wrote the code below to notice when it will fire:
Autorun.cs - Just add this file into your project, that's it, it will start after the boot. No manifest modification needed.
using Android;
using Android.App;
using Android.Content;
// we need to ask permission to be notified of these events
[assembly: UsesPermission (Manifest.Permission.ReceiveBootCompleted)]
namespace XamarinCookbook
{
// we want this to fire when the device boots
[BroadcastReceiver]
[IntentFilter (new []{ Intent.ActionBootCompleted })]
public class ServiceStarter : BroadcastReceiver
{
public override void OnReceive (Context context, Intent intent)
{
#region Start chrome
var mesaj = "Autorun started";
Android.Widget.Toast.MakeText(Android.App.Application.Context, mesaj, Android.Widget.ToastLength.Long).Show();
var uri = Android.Net.Uri.Parse("https://500px.com");
var intent1 = new Intent(Intent.ActionView, uri);
intent1.AddFlags(ActivityFlags.NewTask);
intent1.SetPackage("com.android.chrome");
try
{
context.StartActivity(intent1);
}
catch (ActivityNotFoundException ex)
{
//Chrome browser not installed
intent.SetPackage(null);
context.StartActivity(intent1);
}
#endregion
/*
#region Real code
// just start the service
var myIntent = new Intent (context, typeof(XamarinService));
context.StartService (myIntent);
#endregion
*/
}
}
}
VS Solution:
https://drive.google.com/open?id=1iYZQ2YCvBkyym9-2FvU7KXoBKUWsMdlT
I have done a lot of searching online and I'm not sure what I'm doing wrong. The idea is that I want to launch my iOS app with the following location in a simulator. This works fine when I manually go to debug>location>custom location and set the longitude and latitude....however I need to do it programatically so that my app launches /picks up this location when I click enable locations. Here is my code
public class SampleTest extends SampleBaseTest {
private IOSDriver driver;
private String sessionId;
static UserData sampleUser = null;
#Test(priority = 0)
public void setUp() throws MalformedURLException {
DesiredCapabilities caps = DesiredCapabilities.iphone();
caps.setCapability("appiumVersion", "1.4.16");
caps.setCapability("deviceName","iPhone 6");
caps.setCapability("deviceOrientation", "portrait");
caps.setCapability("platformVersion","9.1");
caps.setCapability("platformName", "iOS");
caps.setCapability("browserName", "");
caps.setCapability("app","sauce-storage:sampleAppe.zip");
URL sauceUrl = new URL("http://" + "sauceUserName" + ":"+ "sauceUserKey" + "#ondemand.saucelabs.com:80/wd/hub");
driver = new IOSDriver(sauceUrl, caps);
Location location = new Location(-8.78319, -114.509, 0.0);
driver.setLocation(location);
sessionId = driver.getSessionId().toString();
#Test(priority = 1)
public void navigateToPayAhead()
throws Exception {
try{
// test logic here
}
catch(Exception e){
e.printStackTrace();
}
}
}
}
Unfortunately, there is a current issue with setting a location on the Sauce iOS simulators. From a support ticket on a similar issue, I was told that it is a known issue, and that it will be addressed (at some point).
I can verify that setting a location does work when using the Android emulators via Sauce Labs.
So, I guess the good news is that you aren't doing anything wrong!
Try adding
caps.setCapability("locationServicesEnabled", true);
caps.setCapability("locationServicesAuthorized", true);
caps.setCapability("bundleId", "YOUR_BUNDLE_ID_HERE");
To get your bundle id, see How to obtain Bundle ID for an IOS App when I have a '.ipa' file for the app installed on my iPAD
I have written a code to save my screen data and retrieve it for second time. Code is:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="HomeView"
add="addHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import spark.managers.PersistenceManager;
protected function saveButton_clickHandler(event:MouseEvent):void
{
var saveManager:PersistenceManager = new PersistenceManager();
saveManager.setProperty("myText", myInput.text);
}
protected function addHandler(event:FlexEvent):void
{
var loadManager:PersistenceManager = new PersistenceManager();
if(loadManager.load())
{
var savedData:Object = loadManager.getProperty("myText");
if(savedData)
myInput.text = savedData.toString();
}
}
protected function clearButton_clickHandler(event:MouseEvent):void
{
var persistenceManager:PersistenceManager = new PersistenceManager();
persistenceManager.clear();
myInput.text = "";
}
]]>
</fx:Script>
<s:TextInput width="100%" id="myInput"/>
<s:Group width="100%">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
</s:Group>
<s:Button id="saveButton" x="-1" y="65" width="100%" label="Save"
click="saveButton_clickHandler(event)"/>
<s:Button id="clearButton" x="0" y="116" width="100%" label="Clear"
click="clearButton_clickHandler(event)"/>
But, when I packaging it for deploying on iPad, it gives me a error like:
Error occurred while packaging the application:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Compilation failed while executing : ADT
I am using Flash builder 4.5 to create iOS application.
Thanx in advance
You need to modify your FlashBuilder.ini file
It's located in your FlashBuilder installation directory.
You need to modify the Xms size - this will allocate more memory while compiling and building project. Remember it should be in strongs of 2.
My file looks like this:
launcher.defaultAction
openFile
-nl
en_US
-vmargs
-Xms256m
-Xmx512m
-XX:MaxPermSize=256m
-XX:PermSize=64m
I am learning Auto-update feature of AIR application. I created simple application which is not working. code is below:
AutoUpdate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="checkForUpdate()" >
<fx:Script><![CDATA[
import air.update.ApplicationUpdaterUI;
import air.update.events.UpdateEvent;
private var appUpdater:ApplicationUpdaterUI=new ApplicationUpdaterUI();
private function checkForUpdate():void
{
setApplicationVersion();
appUpdater.delay = 1;
appUpdater.isDownloadProgressVisible = true;
appUpdater.isDownloadUpdateVisible = true
appUpdater.isInstallUpdateVisible = true;
appUpdater.isFileUpdateVisible = true;
appUpdater.updateURL = "http://localhost:8081/DynamicWeb/release/update.xml";
appUpdater.isCheckForUpdateVisible = false;
appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
appUpdater.addEventListener(ErrorEvent.ERROR, onError);
appUpdater.initialize();
}
}
// Find the current version for our Label below
private function setApplicationVersion():void
{
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
lbl.text = "Current version is " + appXML.ns::version;
//Common.helpDetails = appXML.ns::versionLabel;
}
private function onError(event:ErrorEvent):void
{
//Alert.show(event.toString());
}
private function onUpdate(event:UpdateEvent):void
{
appUpdater.checkNow(); // Go check for an update now }
}
]]></fx:Script>
<s:HGroup x="89" y="124" width="413" height="34">
<s:Label id="lbl" />
</s:HGroup>
</s:WindowedApplication>
*Initially in AutoUpdate-app.xml and update.xml file version tag is set to 1.0.0
* server side update.xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
<version>1.0.0</version>
<url>http://localhost:8081/DynamicWeb/release/Update_air.air</url>
<description><![CDATA[
Typically, this is used to summarize what's new in the release
]]></description>
</update>
Now I have exported application and installed it. After that i changed version on both file AutoUpdate-app.mxml and update.xml(server side) to 2.0.0 . Now i exported the application and dumped it to server (in 'release' folder where update.xml is there.).
Now when i launch the application , Update feature is not working. Its nothing happening.
CheckNow() method is called but doing nothing. Please help me.
I am working on AIR 3.1
Its not giving any kind of error. Only Updation Window is not working.
Please tell me what i m doing wrong. Thanks.
1) trace real version and from update.xml and be sure you did it correct. You must be sure you run old app with 1.0.0 version. BTW, you can use property ApplicationUpdaterUI.currentVersion instead of NativeApplication.nativeApplication.applicationDescriptor
2) You do not listen events after checkNow() calling. Listen all events, like in this article. In
http://thanksmister.com/2009/09/13/custom-air-updater-interface-using-applicationupdater/ (see UpdateManager.as#initialize()):
appUpdater.addEventListener(UpdateEvent.INITIALIZED, updaterEvent);
appUpdater.addEventListener(StatusUpdateEvent.UPDATE_STATUS, updaterEvent);
appUpdater.addEventListener(UpdateEvent.BEFORE_INSTALL, updaterEvent);
appUpdater.addEventListener(StatusUpdateErrorEvent.UPDATE_ERROR, updaterEvent);
appUpdater.addEventListener(UpdateEvent.DOWNLOAD_START, updaterEvent);
appUpdater.addEventListener(ProgressEvent.PROGRESS, updaterEvent);
appUpdater.addEventListener(UpdateEvent.DOWNLOAD_COMPLETE, updaterEvent);
appUpdater.addEventListener(DownloadErrorEvent.DOWNLOAD_ERROR, updaterEvent);
appUpdater.addEventListener(ErrorEvent.ERROR, updaterEvent);
private function updaterEvent(event : Event) : void {
trace(event.type);
}
possible, you missed some thing...
in your server side update.xml you should replace the tag version with versionNumber.
This changed since AIR 2.5.