I have random timeouts in cypress tests - cypress

I'm working with cypress now for 3 months and I try to fix this problem for 2 months now and i really don't now how to fix it.
When i run all my tests there are a lot of tests failing. And every-time its another test (random).
The application that i'm testing has an button that is disabled and when the fields are stuffed with text, the button becomes active.
but the problem is that cypress clicks on the button when the button is still disabled. the button needs some time to get active, now I have put the following in the code:
cy.wait('#budgetblindsPost')
cy.wait(500)
But this is also not working. I have less errors but I still get errors.
Here is an example of an error I get
Here is also an example of my code

Using cy.wait() all over the place may eventually solve issues related to timeout, but will make your test suite unnecessarily slow. Instead, you should increase the timeout(s)
One-off
This command will only fail after 30 seconds of not being able to find the object, or, when it finds it, 30 seconds of not being able to click it.
cy.get('#model_save', {timeout: 30000}).click({timeout: 30000});
Please note that your value of 500 means half a second, which may not be enough.
Global
If you find yourself overriding the timeout with the same value in a lot of places, you may wish to increase it once for all in the config.
defaultCommandTimeout: 4000
Time, in milliseconds, to wait until most DOM based commands are considered timed out

Related

power automate keyword not always triggering flow

I have a pretty simple flow. I have tried "mytest" in the test channel every 30 seconds since the last one fires. as you can see, sometimes it fires, sometimes it doesnt. the keyword trigger doesnt always fire. it seems sporatic. any ideas why? What other info would you need to assist?
it seems like im hitting some type of limit. i was able to make a bunch of keyword tests today and got expected results. after a few test, it stops working again.

Random POST requests being made after test case is executed

I began to write a portion of a test in which an input on a form gets filled out. But, for some reason, after that part of the test ends, the logs on Cypress are showing me a bunch of POST Requests with a little yellow box that has numbers, which I am guessing is the number of requests being made? As a result, the CPU on my laptop is in high usage, my laptop is overheated and at times, the Cypress Browser in which I am seeing these logs is breaking. Does anyone have any idea as to why this could be happening? The only thing this test case is doing so far is filling out the name input on a form. I have provided an image below to show you.

How do i add a WAIT in a Web Performance Test loop?

Writing a Web Performance Test for a process that will run for an undetermined time, and have to put a refresh command in a while that runs until the process state indicates it is done.
The refresh command consumes about 3 seconds. so do not want it running constantly in the loop. So, am trying to find a sleep/wait function to stop the execution between loops.
The only reference i've found is for Thread.Sleep which seems to do the job.
BUT, this method seems to also stop the test's timers. so, however many times the loop runs, and whatever the actual time taken by the process, the test report will only show the cumulative time of the refresh statements.
Is there another method that will not stop the test's timers?
If the refresh is in a loop within the Web Performance Test then set a suitable "think time" on the request. This will pause the test after the response is received. (Think times are normally used to simulate the time a person spends reading a web page and filling in forms etc before the next request is issued.)
Think times are set via the properties of the request. Think times (also reporting names) for all requests in a test can be viewed and modified using the "Set request detail" command accessed using the (rightmost) command icon in eth web test editor.
Think times can also be set or adjusted in the PreRequest method of a WebTestRequest plugin.

TestComplete stuck on unknown object

I have a question about TestComplete. My automated tests jump sometimes into a different window in the tested application and they become stuck there. This is caused by unknown controls for the specified test (it is searching for f.e. combobox which doesn't exists on the window). I was wandering if there is some way to avoid this situation and just skip to another test?
The problem is that TC stays in endless loop of searching for the not existing object.
Thanks in advance for your responses.
Josef
You need to organize your tests with test items. In this case, you will be able to specify the Test Item value for your test items' Stop on error property and TestComplete will start executing the next test if an error occurs during execution of the current test. You can find more information on this in the Tests and Test Items and Stopping Tests on Errors and Exceptions help topics.
It does not jump there alone, does it? Be sure to have the right buttons pressed. If 2 windows are similar and in one window there is the ComboBox you want to test and in the other window not then I would go for something like this:
if(Aliases.GenericWindow.WaitAliasChild("ComboBoxInQuestion", customTimeoutInMilliseconds).Exists)
Log.Message("Do something with ComboBox");
The timeout can be set in the WaitAliasChild function. This waits customTimeoutInMilliseconds and if there is no ComboBox found it just skips the tests that were made for the ComboBox.

Run code for a certain length of time and kill if necessary

I'm using the scripting bridge to query iTunes from my cocoa application. Sometimes iTunes pops up a window (like if an ipod needs updating etc.) and while that popup window is open I can't get any information from iTunes. So if I request information from iTunes when it's in this state my application completely locks-up until that popup window is dismissed.
So I need some sort of mechanism where I can ask itunes something simple in a separate thread to see if I can get a response from it... and if that separate thread doesn't receive a response within a short period of time my main thread will just kill that thread and thus know not to query itunes at that particular time.
Any ideas how to create such a mechanism? I searched for ways to kill a thread but haven't found any.
Your problem is nothing to do with threads; it's that your timeout is too long. Whatever you're doing should fail after about a minute.
To fix this, send a setTimeout: message to the SBApplication object, passing the amount of time you want it to wait. The value is in ticks, of which there are exactly 60 per second.
(Some sources say 60.15, and Apple's own docs say “approximately” 60, but I just measured ten minutes' worth of TickCount, and the result of the division by 600 seconds is exactly 60.0. The code I used:
NSLog(#"Ticks per second: %f", (end - start) / (60.0 * numMinutes)); where end and start are results from TickCount.)
Check out NSOperation/NSOperationQueue.

Resources