angular dir-paginate paginate-id error - angularjs

i have a list and within that list i have a new list that needs to be paginated. To make sure that each inner list know which list they belong to i use: pagination-id:
<div class="list-group bg-white m-none b-t">
<span dir-paginate="module in category.organization_has_modules | itemsPerPage:10 | filter:search"
pagination-id="category.id">
<a ui-sref="app.library_assign({module_id:module.module.id})"
class="list-group-item"
ng-if="module.is_active != 0">
<i class="fa fa-fw {{module.module.module_type.icon}}"></i>
{{module.module.name}}
<span class="pull-right">
<i class="fa fa-sign-in"></i>
</span>
<div class="clear"></div>
</a>
</span>
<dir-pagination-controls class="pull-right" pagination-id="category.id"></dir-pagination-controls>
When i run this i sadly get the following error message:
error: [$parse:syntax] Syntax Error: Token '__currentPage' is an unexpected token at column 4 of the expression [103__currentPage] starting at [__currentPage].
if i run it without the pagination-id it runs fine however it is unable to differ the different lists which means all the pages change when i change it in one of the lists.
Does anyone have any idea of what im doing wrong?

The problem was apprently a bug with the id being a number. The parser in dirPagination.js line 206 does not accept numbers and the regex created to replace any numbers is apprently not working. So instead of using a number i used a string.

Related

Codeception with CakePHP gives PHPUnit array to string conversion error

I’m using Codeception with CakePHP 3.5, and has written a few testing steps. But when executing them, it gives me an error when there should be no error as far as I can see. The first few steps works fine, but when I get to the step to click on a button, I get the error “PHPUnit framework exception: array to string conversion”.
I’m using the codeception code:
$I->click([‘button’ => [‘title’ => ‘Delete testtest, tt’]]);
Trying to click on the element:
<button class="btn btn-primary btn-xs delete-namestring" title="Delete testtest, tt" id="20867"><span class="glyphicon glyphicon-trash"></span> Delete</button>
Clicking on it manually works fine.
This error occurs because you have an array as the value of the button.
Try one of these:
$I->click(['css' => 'button.delete-namestring']);
$I->click('button.delete-namestring');
$I->click('class', 'delete-namestring');

Unable to get value from paper-input

<question-chrome question="{{question}}">
<paper-input label="{{question.Description}}" id="answer" name="answer" type="number">
{{question.Description}}
</paper-input>
</question-chrome>
Where question-chrome.html has the followign code:
<template>
<div class="questioncontainer {{question.Type }}" style="padding-top:10px;">
<div class="questiontext">
<span class="questiontitle">{{question.Title}}</span>
</div>
<div class="questionanswers">
<content select=".questionanswers"></content>
</div>
</div>
</template>
I am using the above paper input, when I am trying to get the values from this, I cannot find the value anywhere. the question element/object, I can get and see every other item's value of the question object. How would I get the value of what is put into the input field? in this case, the value was 3323.
this:
The code to retrieve it I have tried all of these:
this.$.answer.value;
And the results through developer tools in chrome result in:
Object
AdditionalProperties:null
Answers:Array[0]
Code:720061
Description:"Monetary marks ...."
ExtensionData:null
HasAnswers:false
HasChildren:false
Id:"9999dcc3-d3eb-40cf-8414-05ae385e11cf"
IsDefault:true
IsDeleted:false
.....so on and so forth
I went through all of these and did not find it. It is a numeric type of field, so not sure if that has anything to do with it.

How to click element using Cucumber without using xpath?

My application requires to test favorite feature for any product.Products List & UI
When a user click on the heart icon shown in the snippet, it will add that product into Favorites list. I would like to know about the Capybara/Cucumber method to click on the heart icon.
I have tried using XPATH but it seems not working. The code that I tried is as follow.
When(/^I click on the favourite icon on the first product$/) do
find(:xpath,'/html/body/div[1]/div[2]/div/div/div/span/div/div/div/div[3]/div[1]/span[1]/div/div/div/div/div[4]/div[2]/div/favorite/a').click
end
I have also tried following capybara method using XPATH. It is also not working.
When(/^I click on the favourite icon on the first product$/) do
find(:xpath,'//a[contains(., "#heart")]).click
end
Also, I tried following code which is throwing out an error.
When(/^I click on the favourite icon on the first product$/) do
within("div.search-results-wrapper") do
find(first('a.ng-scope')).trigger(:mouseover)
end
end
Error:
The given selector #<Capybara::Node::Element:0x007fd18d841690> is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: An invalid or illegal selector was specified (Selenium::WebDriver::Error::InvalidSelectorError)
The HTML code for the Favorite icon is as follow:
<favorite product="result" ng-if="!ui.showIpsaProductCell()" class="product-action ng-scope ng-isolate-scope"><a ng-mousedown="product.favoriting = true" ng-mouseenter="product.showList = true" active="::product.favoriting" ng-click="toggle(true)" class="ng-scope active">
<i ng-class="::{
'icon-heart-filled':
product.hasFavorite || !showCount || newProductPage,
'icon-heart-outline':
!product.hasFavorite && showCount && !newProductPage
}" class="heart icon-heart-filled"></i>
<!-- ngIf: ::showCount --><span class="count ng-scope" ng-if="::showCount">
1
</span><!-- end ngIf: ::showCount -->
<!-- ngIf: ::addToList && product.hasFavorite --><div component="add-to-list" ng-if="::addToList && product.hasFavorite" class="ng-scope">
<!-- ngInclude: '/modules/components/add-to-list/add-to-list.tpl.html' --><span ng-include="'/modules/components/add-to-list/add-to-list.tpl.html'" ng-controller="AddToListCtrl" class="ng-scope"><div ng-mouseleave="product.showList = false" class="add-to-list-desktop ng-scope">
<!-- ngIf: product.showList -->
<!-- ngIf: product.showListMenu && product.showList -->
</div>
</span></div><!-- end ngIf: ::addToList && product.hasFavorite -->
</a></favorite>
Since you have multiple "favourite" icons you would need to find your icon within a given parent container, not being able to see the full html page it would go something like:
within(".myParentContainer") do
find(".icon-heart-filled").click
end

I cannot get ng-class working when the class I am adding has a hyphen in it .

I am trying to add a class to my element in Angular. Here's my code:
<button class="medium"
data-ng-disabled="!gridForm.$pristine || fetching.length != 0"
data-ng-click="getQuestions()">
Retrieve<span class="fa fa-spinner fa-fw mlr75" data-ng-class="{fa-spin: fetching.length > 0}"> </span>
</button>
However it's giving me a strange error:
Syntax Error
error in component $parse
Syntax Error: Token '-' is at column {2} of the expression [{3}] starting at [{4}].
Does anyone have any ideas as to what might be wrong? Note that it works when I use the class faspin without the hyphen !!
Surround class name with singe quotation.
data-ng-class="{'fa-spin': fetching.length > 0}"
Otherwise angular search your scope for fa-spin which is not a valid name for variables.

WebDriver: Locating elements with Dynamic Ids embedded in a string

Could anyone suggest how I can locate the element "ToBeSelected" that has the below html code:
<div id="Locate-17-tab-info" class="tab active" data-tab-name="tobeselected"> ToBeSelected </div>
The XPath
driver.findElement(By.xpath("input[contains(#id, '-tab-info')]")).click();
I did not have success with finding by XPath - starts-with and ends-with.
You May try
driver.findElement(By.xpath(//input[contains(#id,'Locate') and text()='ToBeSelected'])).click();

Resources