How to report custom message in protractor report? - jasmine

I am using protractor tool with Jasmine framework to write automation scripts.
Got "Wait timed out after 3000ms" error when an element was not appearing in the page. This message looks so generic. So, I want to report a custom message such as: "The element was not showed up for 5 seconds after the page loading. Hence, terminating the execution of the script.".
Can any anyone help me to add a custom message to the reporting?

The browser.wait function allow you to pass an additional parameter for custom log messages, see api documentation
browser.wait(element, 5 * 1000, 'The element was not showed up for 5 seconds after the page loading. Hence, terminating the execution of the script.');

Related

Cypress wait for delay in text change assertion?

So Im curious if there is a good solution for this. I have a text field I am asserting on that it changes to a specific text after updating a form in a modal.
The problem is the text takes a good 2 to 3 seconds to change and the field is there beforehand so the assertion fails before it changes.
By default does Cypress "wait" when looking for text changes/assertions on text fields? (IE: <element>.should('contain.text', 'Assertion text here!')
or if it sees ANYTHING will it just do the assertion right away?
Im looking for a "smart" way to wait essentially instead of just cy.wait(x)
From the banner at the top of the documentation on cy.should():
Assertions are automatically retried until they pass or time out.
By default, Cypress commands have a 4 second timeout. If your update consistently happens in under 3 seconds, you probably won't have to modify that value. But, if you needed to, you could modify that timeout value directly in the test.
// below changes the timeout to 10s (10000ms)
// timeout is passed from cy.get to cy.should
cy.get('foo', { timeout: 10000 }).should('have.text', 'bar');

How to get the exact loading time of website in jmeter

Just wanna know if this scenario is possible in jmeter:
I will create a website using docker image then i will have to check the exact accessibility time(from creating up to launching/checking the site). Once the requirement is met, the timer will stop and it will give me the exact time on when it is actually up. Also, in the view result tree, i only want to get the last successful status. The View Result Tree will only show the last successful status and will disregard the failed status. This is the sample of my thread that i am using: enter image description here
If you really want to discard non-successful results you can do this using JSR223 Assertion and the following Groovy code:
if (!prev.isSuccessful()) {
prev.setIgnore()
}
where prev is a shorthand for parent SampleResult and setIgnore() function tells the listener to ignore the result in case of failure.
More information: Scripting JMeter Assertions in Groovy - A Tutorial

how to get total specs count and pass and fail specs count in jasmine 2 and protractor

I want to generate the emailable report after my test suite gets completed using Jasmine and protractor.
How can I get the following information after my test suite is completed.
1.Total no of spec count
2.Total pass spec count
3.Total Failed test spec count
4. Total Pending specs counts
I could not find any proper solution so far. Please help me out solve this issue.
Using the spec-reporter writes down on your console the results of your testing, but if you really need something to email, you could also use jasmine2-html-reporter, which generates an html page with the results.
With that file, you can program a function to send via email a file or something that you need
CONSOLE: Jasmine spec reporter
HTML: Jasmine html reporter

Codeception Acceptance Test: How to test AJAX request?

Well I was using codeception to test on an ajax page, in which I click the button and some kind of text is shown after an AJAX request is performed.
$I->amOnPage('/clickbutton.html');
$I->click('Get my ID');
$I->see('Your user id is 1', '.divbox');
As you see, the test is supposed to work in a way that 'Your user id is {$id}' is returned(in this case the id is 1), and updates a div box with the text. However, it doesnt work at all, instead the test says the div box is blank. What did I do wrong? How can I use codeception to test an AJAX request?
You can also use this:
$I->click('#something');
$I->waitForText('Something that appears a bit later', 20, '#my_element');
20 = timeout (in seconds), give it some sane value.
It's a bit more flexible instead of hammering down things like $I->wait(X);, because they are usually a lot faster than waiting for them in seconds. So, for example, if you've got many elements that you need to "wait" for, let's say 15-20, then your test will spend 15-20 seconds "waiting" while actual operations finish in maybe 1-2s total. Across many tests this can increase build times significantly, which is... not good :)
Are you sure your request has finished by the time you check the div? Try adding a little wait after sending the request:
$I->amOnPage('/clickbutton.html');
$I->click('Get my ID');
$I->wait(1); //add this
$I->see('Your user id is 1', '.divbox');

Is Parse providing 15 seconds for Cloud Code functions

I'm currently coding an app that utilizes Parse as a backend, but have run into a '124' error. I admit that I do a lot in my cloud functions, but, from what I've observed, it doesn't appear over 15 seconds. Could someone please confirm this? Below is the output.
E2015-03-06T03:49:52.644Z] v286: Ran cloud function createEvent for
user puZNjFVfSm with:
Input:
{"RSVPDate":{"__type":"Date","iso":"2015-03-06T04:49:52.000Z"},"description":"Sample event to showcase
functionality","group":{"max":5,"min":4},"max":50,"reoccur":{"day":1,"month":1,"stop":{"__type":"Date","iso":"2015-03-06T04:49:52.000Z"},"week":1},"title":"SampleFCFS"}
Failed with: Execution timed out I2015-03-06T03:49:52.716Z] begin
I2015-03-06T03:49:52.717Z] creating Event - initial checks completed
I2015-03-06T03:49:52.718Z] Finished advanced checks
I2015-03-06T03:49:52.719Z] Event creation start
I2015-03-06T03:49:52.770Z] begin event creation
I2015-03-06T03:49:52.873Z] Finding role: company_employee_z0Zx39OyuY
I2015-03-06T03:49:52.875Z] Added and secured event
I2015-03-06T03:49:52.931Z] attaching role to 425Qy9v9e4
I2015-03-06T03:49:52.934Z] Adding participant
From what I can tell, it looks like I'm only getting 300Z (is that milliseconds?) on all my runs. Shouldn't I be getting 15 seconds?
Update: I found that the issue was caused by using the addUnique function of Parse Objects with an array of pointers. By inserting ids instead of pointers, the issue was resolved.
Thank you for your help.

Resources