I have some Cypress tests which are passing due to the fact that the cy.get elements have briefly come up in the DOM before an error page has been redirected to. I can only get the test to fail if a cy.wait is added before the assertion but I do not want to use those. Has anyone come across this before and able to offer some best practices on what to assert next?
I am thinking to either assert cy.url does not exist, but I would have to put this at the end of absolutely every test so hoping for a better option. Thanks
Related
I am pretty new to power automate. I created a flow that triggers when an item is created or modified. It initializes some variables and then does some switch cases to assign values to each of them. The variables then go into an array and another variable is incremented to get the total of the array. I then have a conditional to assign a value to a column in the list. I tested the flow specifically going into the modern view of the list and clicking the save button. This worked a bunch of times and I sent it for user testing. One of the users edited multiple items by double clicking into the item which saves after each column change(which I assume triggers a run of the flow)
The flow seemingly works but seemed to get bogged down at a point based on run history. I let it sit overnight and then tested again and now it shows runs from multiple IDs at a time even though I only edited one specific one.
I had another developer take a look at my flow and he could not spot anything wrong with it and it never had a hard error in testing only warnings about conditionals causing a loop but all my conditionals rectify. Pictures included. I am just not sure of any caveats I might be missing.
I am currently letting the flow sit to see if it finishes getting caught up. I read about the concurrent run option as well as conditions on the trigger itself. I am curious as to why it seems to run on two records(or more) all at once without me or anyone editing each one.
You might be able to ignore the updates from the service account/account which is used in the connection of the actions by using the following trigger condition expression:
#not(equals(triggerOutputs()?['body/Editor/Claims'], 'i:0#.f|membership|johndoe#contoso.onmicrosoft.com'))
I've an application that have some room for performance improvements.
Our customer has requested some performance measurements on the Client (Browser) side,
and I'm trying to use testcafe to have some execution time indications.
One option is to have people accessing the different features, activating in Chrome
the development tools, and taking note of DOMContentLoaded values, too boring, error prone and time consuming.
Using testcafe we can do begin-end measurements, but because testcafe is loading
the pages through it's proxy is clear that this figures will be worst.
There are several questions
1. amount of delay added by the proxy:
does anybody have idea of something like a multiplier factor,
i.e.: times in testcafe will be -> X times the DOMContentLoaded you get from the developer console.
2. When to get Selector value from the page
I'm trying to do this:
S1 - access the page PageUnderTest
S2 - set filter values
S3 - click search to submit the page and apply the filters
S4 - the PageUnderTest is rendered with the filters applied.
Because I'm trying to get the time till the page is loaded,
I get BEGIN Timestamp before issuing t.click(button) (S3)
then I expect for the page title, but not knowing how testcafe works
I fear that testcafe get this value from S3 because the PageUnderTest is already
rendered.
Can anybody provide some clarifications?
I've a token that is changed on each submit then I'm getting the token in S3 (before the click)
and loop reading the token till the value is different to the value got in S3.
Do you think this is a good approach?
3- How to understand page has been fully rendered.
Do you have any suggestions?
Best regards
TestCafe is a tool built for functional testing, supporting you to write end-to-end tests which should replicate real user scenarios within your web application. Do not use it to perform non-functional testing (like performance or load testing). Such tests would not yield any conclusive results. You can read more about TestCafe's scope here
Try artillery for load testing or performance testing.
Also, if you want to measure the time it takes for an UI element to appear, you can build a counter, but those results will not be very accurate.
I used testcafe to do this:
Start a timer & click button X
Stop the timer when element Y appeared.
I wanted to see how long it takes for an UI element to appear, but this was not a valid test, because the UI wasn't slow, the API behind it was slow, that is when I gave Artillery a try.
I use Artillery + Testcafe for my tests. I'm a QA so I don't really know others.
Is there any downside to using a promise with only .catch section, but without .then at all?
I'm asking about the cases where the resolution result is not needed, only error handling.
Is this a good pattern to rely on .catch only and skip .then?
Or is it something that depends on which promise implementation it is?
Conceptually, there's nothing wrong with an operation that only has an error handler and has nothing else to do upon successful completion. If that's all it needs, then that's fine. For example, suppose you're updating a server with some new data from the client. If the data is successfully sent to the server, there's nothing else to do because the operation is complete, but if there's an error, then there is perhaps something else to do (retry, inform the user, correct the data based on the error code, etc...).
To comment on whether that's the right way to design your specific code, we'd have to see the actual code and understand what it is doing and then form an opinion on whether that is the best way to structure that specific code.
If I was designing a general purpose function, I'd certainly provide both completion (resolving the promise) and error (rejecting the promise) so the caller could hook into either one. But it is really up to the caller which events they want to know about and if only the error matters, then just having a .catch() is fine.
Message expectations allow you to check if the object under test is sending the right message, but not that the target object can actually respond to this call. On the other end of the spectrum, integration testing checks that everything actually work, that is, that the calls are made, understood and executed properly.
Is there a middle ground, like checking that the object under test sends the right messages and that the receiving object can respond to these message ? This would ensure that the test break when the receiving object changes, without running a full integration test. In essence:
target.should_receive(:my_method) && target.should respond_to(:my_method)
using a custom matcher like
target.should_get_message(:my_method)
this could be useful for glue classes that just coordinate different actions I think.
What are your opinions on that ? Is it a viable approach ?
Checkout rspec-fire it solves this exact problem. I've been using it in lots of projects.
I would like to perform a load test on a site that uses ValidateAntiForgeryTokens on a number of HttpPosts. However, as you would expect, when I run my load test script, I receive a number of 500 errors because the __RequestVerificationToken is either copied from an earlier request or is blank. Both of which fail.
Are there any ways to load test sites where I am using the ValidateAntiForgeryToken attribute on my HttpPost methods?
I've tried using StresStimulus and also SmartBear's LoadComplete for my tests.
If you are using fiddler and http://stresstimulus.stimulustechnology.com/ (which I haven't used) I have to imagine you can first login, and then use that session as your load. The AntiForgeryTokens are NOT one time, and as long as the cookie is there for your auth info and an anti forgery token generated during that login session, it should be fine.
I had the same problem with StressStimulus. Some of the forms submitted to the site were failing because the __RequestVerificationToken are not updated when the recorded request is run. {{Auto-Correlation}} did not work in my case. I used regex extractor to solve it. Here's the link to my post on StressStimulus
Without seeing the details of the scenario you are working with, it is hard to say for sure. But we've been able to automate many of these types of dynamic fields for load testing purposes (the only ones we haven't been able to bypass are those that require human input, i.e. captchas). In general, you need to find where the value of the __RequestVerificationToken field came from - be it a cookie, a javascript calculation, a hidden form field, etc. Once you've located that, you can extract or calculate that value as part of the load test scenario and send it along with the request. If my memory serves, we've tackled this one before with out much work - if you'd like to give us a shot at the problem, contact us. In general, we can handle these types of problems much more gracefully than either of the solutions you mentioned.