0.11.4 Touch seems off target in landscape orientation - ios-simulator

Originally we had automated tests working and running continuously back in August. After a lapse they became out of date and we had to put them on hold. I'm trying to get them working again and after updating Calabash-ios, the calabash server, and the Calabash component to the Xamarin Cloud component I ran into a problem. The touch calls aren't working quite right anymore. It seems that the touch is off target.
For example: I try to touch the sign in button of our app and instead the "r" button on the keyboard gets pressed. The keyboard isn't covering the button either.
I've tried the workaround given here thinking that maybe the landscape orientation is causing the problem but no luck.
This is using an iPad 2 simulator running iOS 8.1. I've also tried 7.1 and had the same issue. We are using Xamarin if that makes any difference.
Versions:
~$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer/
~$
~$ xcodebuild -version
Xcode 6.1.1
Build version 6A2008a
~$
~$ calabash-ios version
0.11.4
~$
~$ curl http://localhost:37265/version
{
"app_version": "Unknown",
"outcome": "SUCCESS",
"app_id": "com._______.dev",
"simulator_device": "iPad",
"version": "0.11.4",
"app_name": "_____ Dev",
"iphone_app_emulated_on_ipad": false,
"4inch": false,
"git": {
"remote_origin": "git#github.com:calabash/calabash-ios-server.git",
"branch": "master",
"revision": "bcc992b"
},
"screen_dimensions": {
"scale": 1,
"width": 768,
"sample": 1,
"height": 1024
},
"iOS_version": "8.1",
"system": "x86_64",
"simulator": ""
}
I can reproduce it from calabash-ios console as well.
Both of these commands click the "R" button on the digital keyboard:
irb(main):011:0> touch("button marked:'Sign In'")
[
[0] {
"selected" => false,
"enabled" => true,
"rect" => {
"center_x" => 339.6667,
"y" => 341,
"width" => 58,
"x" => 310.6667,
"center_y" => 428,
"height" => 174
},
"id" => nil,
"description" => "<UIButton: 0x78f80b00; frame = (509 310.667; 174 58); opaque = NO; layer = <CALayer: 0x78f80ab0>>",
"label" => "Sign In",
"alpha" => 1,
"class" => "UIButton",
"frame" => {
"y" => 310.6667,
"width" => 174,
"x" => 509,
"height" => 58
}
}
]
irb(main):012:0> tap_point(339, 428)
Where as this command clicks the sign in button correctly:
irb(main):023:0> tap_point(639, 328)
true
Has anyone seen something like this before? Also, this doesn't happen when I use a physical device.

Has anyone seen something like this before? Also, this doesn't happen when I use a physical device.
Yes, we have had reports of problems like this and they have been, for the most part, resolved by the 0.12.0 pre-releases.
Can you try the following to reproduce:
$ DEVICE_TARGET="iPad Retina (8.1 Simulator)" bundle exec calabash-ios console
> start_test_server_in_background({ :uia_strategy => :host })
The :host strategy is slower than the :preferences strategy. However, because of several bugs in Apple's UIAAutomation API, it is the only strategy that works on iOS 8 devices.
The 0.12.0 pre-releases contain significant improvements in the :host and :preferences strategies. When 0.12.0 is released, you can drop the :uia_strategy => :host and stick with the recommended defaults.
The pre-release situation for UITest is improving; I believe that pre-releases are now available. I don't know what the latest pre-release is. I will inquire and update my answer.

Related

next-sitemap "Error: Expected ';' on Windows 11

Trying to get a sitemap made for my Next JS site using next-sitemap. From my research, next-sitemap doesn't work on Windows without including cross-env. Any suggestions on what to do?
I currently have my postbuild command set to:
"postbuild": "cross-env next-sitemap --config next-sitemap.js""postbuild": "cross-env next-sitemap --config next-sitemap.js"
And here is my next-sitemap.js:
let policy = {
userAgent: "*",
};
if (process.env.ENVIRONMENT !== "production") {
policy.disallow="/";
};
module.exports = {
siteUrl: process.env.URL,
generateRobotsTxt: true,
robotsTxtOptions: {
policies: [
policy
],
},
outDir: "./out"
}
Tryp running npm run build (or yarn build) first, on this youtube video happened the same to him and he did it like that:
https://www.youtube.com/watch?v=zS-6oiwvNnc
I don't think you need the cross-env, but for windows what you have to do is changing the file name instead. See the docs here.

Behavior change in speech-rule-engine 3.2?

I'm using the speech-rule-engine to generate English text from MathML. When trying to upgrade from v3.1.1 to v3.2.0 I'm seeing tests fail for reasons I don't understand.
I created a simple two file project that illustrates the issue:
package.json
{
"name": "failure-example",
"license": "UNLICENSED",
"private": true,
"engines": {
"node": "14.15.5",
"npm": "6.14.11"
},
"scripts": {
"test": "jest"
},
"dependencies": {
"speech-rule-engine": "3.2.0"
},
"devDependencies": {
"jest": "^26.6.3"
},
"jest": {
"notify": false,
"silent": true,
"verbose": true
}
}
example.test.js
const sre = require('speech-rule-engine');
beforeAll(() => {
sre.setupEngine({
domain: 'mathspeak'
});
});
test('simple single math', () => {
expect(JSON.parse(JSON.stringify(sre.engineSetup(), ['domain', 'locale', 'speech', 'style'])))
.toEqual({
locale: 'en',
speech: 'none',
style: 'default',
domain: 'mathspeak',
});
expect(sre.engineReady())
.toBeTruthy();
expect(sre.toSpeech('<math><mrow><msup><mn>3</mn><mn>7</mn></msup></mrow></math>'))
.toBe('3 Superscript 7');
});
Running npm install and npm run test results in a failure because SRE is returning 37 instead of 3 Superscript 7. Editing package.json to use v3.1.1 of the engine and rerunning results in a passing test.
Obviously something has changed, but I'm totally missing what I need to do to adapt. Has anyone else encountered this, or see what I clearly do not?
Problem solved, with the help of the maintainer of SRE. The problem is not in 3.2.0, but that jest does not wait for sre to be ready. The test was only correct by a fluke in 3.1.1 as the rules were compiled into the core. The following test fails with the above setup in 3.1.1 as well as the locale is not loaded:
expect(sre.toSpeech('<math><mo>=</mo></math>'))
.toBe('equals');
Expected: "equals"
Received: "="
The main reason is that jest fails to load the locale file. Setting "silent": false will show the error:
Unable to load file: /tmp/tests/node_modules/speech-rule-engine/lib/mathmaps/en.js
TypeError: Cannot read property 'readFileSync' of null
The reason for this error is that jest does not know that it runs in node. Adding:
"testEnvironment": "node",
to the jest configuration in package.json causes the expected behavior.

how to enable firebase notifications in ionic android application

i want to build an application and use firebase for notification done a lot of search over google but did not find any good guide and solution , everything i tried ended into some errors . i tried ionic docs but they are all messy after the ionic v4 they shows everything about v4 i have my app almost finished up just this thing remains .
i will appreciate any help .
Any idea how to proceed? I'm most probably not configuring Firebase properly. I have placed google-services.json in the root directory, no problems there. but after that its all out of my understanding
AN ERROR OCCURRED WHILE RUNNING ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID-150482406038 --SAVE EXIT CODE 1
Got this Working . Thanks everyone for help!
refrences used-
https://ionicframework.com/docs/v3/native/push/
https://github.com/phonegap/phonegap-plugin-push
works for
ionic 3.20.1
cordova 8.1.2
steps i followed
Removed my android platform using ionic cordova platform
removeandroid then i created it agin ionic cordova platform add
android. just to avoid any errors which my be there with my old
android version.
Got the google-services.json and placed it in the
rootDirectoryOfApp\platforms\android\app
then i run $ ionic cordova plugin add phonegap-plugin-push $ npm
install --save #ionic-native/push#4
Edit config.xml look for <platform name="android"> under that i
wrote <resource-file src="google-services.json"
target="app/google-services.json" />
Edit package.json look for "phonegap-plugin-push" and edit it
something like this
"phonegap-plugin-push": {
"ANDROID_SUPPORT_V13_VERSION": "27.+", // already there
"FCM_VERSION": "11.6.2", // already there
"SENDER_ID": "numeric key obtain from firebase console" // added
},
Open app.module.ts and import import { Push } from
'#ionic-native/push'; add Push under providers there ...
providers: [
StatusBar,
SplashScreen,
Push, ....
Then in a provider
i imported import { Push, PushObject, PushOptions } from '#ionic-native/push';
then in costructor i added private push: Push,
and in the class of that provider i wrote a function like below
pushSetup(){
// to check if we have permission
this.push.hasPermission()
.then((res: any) => {
if (res.isEnabled) {
console.log('We have permission to send push notifications');
} else {
console.log('We do not have permission to send push notifications');
}
});
// Create a channel (Android O and above). You'll need to provide the id, description and importance properties.
this.push.createChannel({
id: "testchannel1",
description: "My first test channel",
// The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
importance: 3
}).then(() => console.log('Channel created'));
// Delete a channel (Android O and above)
this.push.deleteChannel('testchannel1').then(() => console.log('Channel deleted'));
// Return a list of currently configured channels
this.push.listChannels().then((channels) => console.log('List of channels', channels))
// to initialize push notifications
const options: PushOptions = {
android: {
senderID:"150482406038",
},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}
Now imported that provider where I want to use that , and called
that function from there . but call it only after
this.platform.ready().then(() => { or when a successful login.
I have shared this because i found it little difficult and got confusing guides over web
Please comment if you found it wrong or not working in your case.
I have been using this tutorial: https://medium.com/#felipepucinelli/how-to-add-push-notifications-in-your-cordova-application-using-firebase-69fac067e821 and Android push notifications worked out of the box. Good luck!
^ you might wanna try the cordova-plugin-firebase plugin as Chrillewoodz has mentioned

How to test console command output when terminal widths differ?

I'm playing with the console component of Symfony and I'm facing an issue when it comes to testing.
I have a command that can move some files and display messages depending on the actions performed. I'm using SymfonyStyle to format my output.
I'm using the CommandTester to test my command but if I'm able to test whether the command did something or not, I can't find a efficient way to test its output.
Here is what I'm trying to do :
<?php
public function testIgnoreSamples()
{
$container = $this->application->getContainer();
$container['config'] = [
'source_directory' => vfsStream::url('Episodes/From'),
'target_directory' => vfsStream::url('Episodes/To'),
'ignore_if_nuked' => false,
'delete_nuked' => false,
'search_subtitles' => false,
'prefer_move_over_copy' => false
];
copy(
__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures/breakdance.mp4',
vfsStream::url('Episodes/From/sample-angie.tribeca.s01e07.720p.hdtv.x264-killers.mkv')
);
$commandTester = new CommandTester($this->application->find('episodes:move'));
$commandTester->execute([]);
$this->assertContains('because it\'s a sample', $commandTester->getDisplay());
$this->assertEquals([], vfsStream::inspect(new vfsStreamStructureVisitor())->getStructure()['Episodes']['To'], 'Target directory is empty');
}
The issue here is that depending on the console size, my output can be displayed on one or two lines, which makes it hard to write tests that can be executed in different environment.
For example in my environment it's displayed like this :
and in travis like this :
which brakes the tests.
Do you know if the component provides a workaround for this case?
Use the wordwrap function to constrain all output to 75 or so columns.
$output->writeln(wordwrap($long_string));
I finally figured how to fix the terminal size for the tests.
Starting in v3.2, symfony/console allows us to fix the terminal size, which is used by the SymfonyStyle to build the output.
Just call putenv('COLUMNS=80') before executing a command to fix its terminal size.
My test is now :
public function testIgnoreSamples()
{
$container = $this->application->getContainer();
$container['config'] = [
'source_directory' => vfsStream::url('Episodes/From'),
'target_directory' => vfsStream::url('Episodes/To'),
'ignore_if_nuked' => false,
'delete_nuked' => false,
'search_subtitles' => false,
'prefer_move_over_copy' => false
];
copy(
__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures/breakdance.mp4',
vfsStream::url('Episodes/From/sample-angie.tribeca.s01e07.720p.hdtv.x264-killers.mkv')
);
putenv('COLUMNS=80');
$commandTester = new CommandTester($this->application->find('episodes:move'));
$commandTester->execute([]);
$expected = <<<'EXPECTED'
! [NOTE] File sample-angie.tribeca.s01e07.720p.hdtv.x264-killers.mkv ignored
! because it's a sample
EXPECTED;
$this->assertContains($expected, $commandTester->getDisplay());
$this->assertEquals([], vfsStream::inspect(new vfsStreamStructureVisitor())->getStructure()['Episodes']['To'], 'Target directory is empty');
}
and the tests are green in travis and in my local environment :).

App closes after splash screen through Calabash test

When running the "cucumber" command, the iOS Simluator launches and attempts to open my app. The app's splash screen appears and then the simulator goes back to the home screen. I eventually receive an error stating:
Time out waiting for UIAutomation run-loop to Start.
I can manually start the -cal app in the iOS Simulator through xCode. Any troubleshooting steps I can try to figure out why my app isn't running through the simulator using Calabash?
My environment
$xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$xcodebuild -version
Xcode 6.1.1
Build version 6A2008a
$ calabash-ios version
0.12.2
$ calabash.framework/Resources/version
0.12.2
server_version
{
"app_id" => "com.madeupdomain.MyApp-cal",
"outcome" => "SUCCESS",
"server_port" => 37265,
"version" => "0.12.2",
"app_name" => "Unknown",
"system" => "x86_64",
"simulator_device" => "iPhone",
"simulator" => "",
"app_version" => "1.0",
"iphone_app_emulated_on_ipad" => false,
"git" => {
"revision" => "bafa9fd",
"remote_origin" => "git#github.com:calabash/calabash-ios-server.git",
"branch" => "master"
},
"screen_dimensions" => {
"sample" => 1,
"height" => 1136,
"width" => 640,
"scale" => 2
},
"4inch" => true,
"iOS_version" => "8.2"
}
I got the same problem several times.
First of all check the APP_BUNDLE_PATH
Check the DEVICE_TARGET (if your app does not support that target).
Does your app have a Privacy Alert that appears just after launch?
If so, see the advice on this page:
https://github.com/calabash/calabash-ios/wiki/Managing-Privacy-Alerts:--Location-Services,-APNS,-Contacts
Can you update your question with exact command you are using to start cucumber?

Resources