Conflict with simulation cron - angularjs

Community, I have the following problem. I am running an action every certain stretch of time, for example, 1 minute. The function, if the device is locked continues to run normally but there comes a time (about 5 minutes) fails, no error or any type of log to run, to keep track of the function check my log server as I check my webservice and receives more requests. I am occupying the interval function and as I said, it works well about 5 minutes and then with nothing to stop running calls.
setInterval(function(){update()}, 10000);
If anyone knows how to solve or a better way to simulate a cron on a device agradeceria.
Thanks!

Most likely the js runtime was unloaded from the device browser for your page (since the user is not looking at it and the device wants to save on battery), that is why it stops working, I don't think it is possible to overcome this completely
you could somewhat fake it by saving last run time in localStorage and running your code with windows.onfocus to determine what changes need to be made (did not test if it actually works tho I see no reason for it not to work)

Related

Protractor application get paused when system sleeps

I am working in a large project. There are about minimum 160 specs to be executed with protractor, and it consumes more than one hour to finish automation testing. But issue is my system get sleeps in between it when no action is performed. Is there any way to make system alive until protractor finishes its execution.
So that I could run it without system sleep. I cant increase my sleep time because it had to be run in many sytem. Please let me know how could I handle it ?
I am using chrome for running the automation.
Cheers.
Would it be possible to let me know what OS you are using? So that I can give step by step information. For example: if you are using windows machine then
Goto --> Control Panel\Hardware and Sound\Power Options --> Change the Sleep settings make it to "Never"
It will remain open for your lifetime till you switchoff your computer.
By the way there is no relation this question to Protractor.

android.hardware.camera2 ERROR CAMERA IN USE

I'm using the google sample 'android-Camera2Video':
https://github.com/googlesamples/android-Camera2Video
The problem is that when the app is finishing the recording, sometimes it stucks for a moment, and then calls the onError() handler of the CameraDevice.StateCallback with 1 - 'ERROR_CAMERA_IN_USE' error code.
It does not happen every single time, it happens in about 90% of cases, and sometimes everything works fine with no errors. I couldn't find out on what it depends and how to resolve this issue. If anyone have met this problem before, please help.

Windows Service with running some Process

I have a problem with windows service. I'd like to his level run the program in a given situation. Every minute check a certain value and if the value is to adopt "truth" is to me the program starts. Only at the moment this does not work ...
The problem is that when debugging the code executes correctly, it displays my window, but the service is run normally nothing happens ...
Link to movies about this all:
https://youtu.be/GPv5dn92BGg
You need to jump through several hoops to launch interactive applications from a service. First, the service needs to be explicitly allowed to interact with the desktop. Then the service needs to specify the correct WindowStation for it to show on.
It may be simpler to just set your child application up as a scheduled task, as these can interact with the desktop for you

Why do Selenium tests that pass locally fail on Browserstack specifying exact same browser?

I got a test that opens a webpage and does scraping.
It works. There's no question on that:
- Works on Phantomjs/Chrome/Firefox when run on my machine everytime.
However, when run on Browserstack (I want to cover 5 most popular browsers, several OS and even mobile devices, for the moment I specify the exact same browser and platform as on my machine to ensure first the test runs properly on Browserstack), the test SOMETIMES passes and SOMETIMES fails with different errors:
- Stale element
- No such element in cache
- Page fails to load after a submit
- etc
And almost never the same element or submit.
Which is making me wonder whether Browserstack has some inherent instability I'm not aware of. Has anyone seen this happen on Browserstack?
Welcome to BS. You get such errors because the environments on BS do lag a lot. They aren't giving much resources to their VMs so you will have to deal with it. Or put a lot of thread sleeps and special waits for your needs

Application.Dispatcher.UnhandledException and CurrentDomain.UnhandledException

I'm investigating strange WPF multi threaded application hang that happen randomly on production machines more easily than development ones.
I have added Application.Dispatcher.UnhandledException and CurrentDomain.UnhandledException event handlers to log the every and each exception in order to keep the application from crashing as it is a system shell.
I suspect the reason of the hang is that I'm handling those events and not allowing the application to crash, what make me say this is that when i monitored the application activity when it hanged using windows task manager i noticed CPU load probably caused by background tasks in the application and those background tasks are writing to logs as expected.
The logger class writes the logs to the disk asynchronously using BeginInvoke.
The big problem is every time the application hangs in production machine i find nothing in log files.
Now i have two questions:
What is the fire order of those events: "Application.Dispatcher.UnhandledException and CurrentDomain.UnhandledException".
2.Is there anyway i can manage to be able to know were my code is failing
Note: I use a lot of Thread.Sleep in background tasks as i manage the threads my self and i think i went wrong with this approach and I'm considering rewriting all of my background tasks from scratch.
Any help will be much appreciated.
Order of this event is:
Application.DispatcherUnhandledException
CurrentDomain.UnhandledException
If you want get information from exception where your code is failing, check property StackTrace. You can also attach to your project pdb files and in this case you will get StackTrace with line numbers.

Resources