how to check whether a specific checkbox is checked using protractor - protractor

I want to do e2e testing using protractor. My AngularJS application consists of large number of data with checkboxes out of which some will be checked. I want to test whether my required test data are checked.
I tried using below code:
expect(element(by.model("accordoptionGroup[optgroup.id][objopt.id].value")).get(index).isSelected()).toBe(true);
But error saying element(..).get is not a function
Please Help.

.get() method is available on an ElementArrayFinder. You meant to have:
expect(element.all(by.model("accordoptionGroup[optgroup.id][objopt.id].value")).get(index).isSelected()).toBe(true);

Related

"script time out" when using protractor (there is a referenced third-party resources(google map) that takes too long to load)

I am a fresh Protractor user trying to write some Protractor E2E test.
The page I am testing has some TextInput boxes, and a app-map(google map).
When I tried to enter some charactors by using "sendkeys" function, the script failed with the error "script time out".
I assumed that it took too long for protractor to load the entire page.
For this page I just want to find the textbox elements and enter some charactors. Could anyone help me to igore the loading of the google map?
best regards
shixiang
Set browser.waitForAngularEnabled(false) in your script file this ignores the wait time to load the components.
Use expected conditions to make your script wait till the text boxes appear. here is the link for more info on expected conditions
https://www.protractortest.org/#/api?view=ProtractorExpectedConditions
Add allScriptsTimeout in your config file which will override jasmine default timeout("allScriptsTimeout: 2400000"). You can set the timeout value depending on your requirement. it's in millisec.
Hope this helps

How to make a systematic report in protractor

I am working on protractor for testing an angularjs application. I am also able to fetch the report but I want to mention some more points and details about the test execution. For example Its model name, Test case name, Severity, Priority, Where the test failed if it gets fails etc. Where should I add all this points so that I can be able to fetch a complete detailed report.Currently I am able to get the report I have attached here.
Please help me in getting the solution as I am new to protractor. Thanks a lot in advance.
Jasmine framework does specs reporting, not Protractor in e2e testing. You can either leverage some of the popular ones listed below or need to create your own using custom reporter.
https://www.npmjs.com/package/jasmine-spec-reporter
https://www.npmjs.com/package/protractor-html-reporter
https://www.npmjs.com/package/protractor-beautiful-reporter
http://jasmine.github.io/2.1/custom_reporter.html
Or you can try with allure plugin here http://allure.qatools.ru/
I also advice to use allure report. It is easy to setup and has a good documentation. Just want to mention that there is Allure 2 is ready. Take a look at Git Hub and integration for JS

Sweetalert: e2e testing using Protractor

I am trying to test my web application which uses SweetAlert. I am using Protractor for e2e testing.
When I tried selecting an element using
var textElement = element(by.id("newWbName"));
protractor goes into an infinite loop, saying
W/element - more than one element found for locator By(css selector, *[id="newWbName"]) - the first result will be used
as seen here, even though there is only one id with newWbName.
I am wondering if there is anything in how sweet alert renders the alert that is causing this issue? The selectors work fine when I use them on the rest of the page. Any help is really appreciated.

Automated Testing (Watir): Retrieving data and implementing into your test?

I am just getting started with automated testing on RubyMine using Watir webdriver. So far I am having a blast and I find it works really well, even for a newb like me! :)
I want to create a test which retrieves an order code that is generated during the test and then later use the same code to run an 'include?' verification query on a different page.
I know I can use an HTML selector to show Watir where the code is, I want to know how to copy it and use it later. Can anyone point me in the right direction?

JBehave results displayed on a webpage

I have been working on a project that lets me test the behaviours of my companies webpage.
I have written an API and the testcase I am working on runs through JUnitRunner and the test passes.
The next step is to get the results displayed on a webpage, oes anyone know what plugin I need to get the JBehave results in HTML format or as a file.
I know I should be posting my code but there is no problems with the code, I just need the output in a different formatt.
Thanks
To get the HTML output you need to make sure that you are generating the views with STATS and HTML output.
In MostUsefulConfiguration, add
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
.withFormats(Format.CONSOLE, Format.HTML, Format.STATS)
In the Embedder method add
embedder = configuredEmbedder();
embedder
.embedderControls()
.doGenerateViewAfterStories(true)
This should be all you need to do to get HTML output.
We wanted more information than is provided in the default output so we created a new StoryReporter class to capture the additional data and '#Override' the existing methods where appropriate. The new reporter class also needs to be added to the mostUseFulConfiguration
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
We also needed to amend or create a new Freemarker template (jbehave-reports-with-totals.ftl) to actually get it to write out the new data from the new story reporter class into an HTML file. I am not going to provide an example here. Please read the Freemarker documentation which is very good.
check the reporting setup at JBehave's site.
and check the examples source code here. almost all examples is reporting to html and others.