Failed to load resource:soy template {Not all code is in Soy V 2 syntax (found file simple.soy not in Soy V2 syntax). } - jira-plugin

I have two soy templates in my plugin one of them loads fine but other is not getting loaded with 500 Internal server error. I am attaching the error from console.
Here is the code I have:
{namespace JIRA.Templates.Impacttemplate.ImpactRow}
/**
* Render the information page for the Requirement Template.
* #param actor : string
#param impact: string
*
*/
{template .renderImpactRow}
<tr class="impact-soy" data-key="{$impact}" >
/*<td><span class="key">{$productName}</span></td>*/
<td><span class="key">{$impact}</span></td>
<td><span class="name">{$actor}</span></td>
</tr>
{/template}

Finally I could figure out the solution:
There should not be blank line after soy doc comment.
#param impact: string should be like #param impact : string
Here is the actual working code:
/**
* Render the impact.
* #param new_actor : string
* #param impact : string
*/
{template .renderImpactRow}
<tr class="impact-soy" data-key="{$impact}" >
<td><span class="key">{$impact}</span></td>
<td><span class="name">{$new_actor}</span></td>
</tr>
{/template}

Related

Custom Selenium Formatter - How do I get comments?

I've been following this tutorial to write a custom selenium formatter: http://seleniumrecipes.com/content/adding-custom-formats.
Comments in a Selenium test script don't follow the general layout
<tr>
<td>pause</td>
<td>6000</td>
<td></td>
</tr>
<!--This is a comment-->
But you still get a command as you loop through the commands in the testCase, but all the values are undefined.
var commands = testCase.commands;
for (var i = 0; i < commands.length; i++) {
var command = commands[i];
result += command.command + ',' + command.target + ',' + command.value + "\n";
}
return result;
I've briefly looked at the source and can't see anything.
Is there a way to get the comments from a Selenium script in a formatter?

what does this fluid error means? No unique path segment could be found after 100 iterations

I get this error on an order review page:
Exception while rendering
checkout<TYPO3.Neos:Page>/
body<TYPO3.TypoScript:Template>/
content/
main<TYPO3.Neos:PrimaryContent>/
default<TYPO3.TypoScript:Matcher>/
element<TYPO3.Neos:ContentCollection>/
itemRenderer<TYPO3.Neos:ContentCase>/
default<TYPO3.TypoScript:Matcher>/
element<SeeThroughWeb.Shop:ShopOrderReview>:
No unique path segment could be found after 100 iterations. (201409261654538b6e30)
Any idea why or what it means? BTW, I use the same template on another site and get no such error there. I am using Flow 2.1 and Neos .99 .
Thanks
The method declaration is:
/**
* A new form to fill shipping address
*
* #param \SeeThroughWeb\Shop\Domain\Model\Address $address List of address
* #param integer $changeAddress
* #return void
*/
public function shippingAddressAction(\SeeThroughWeb\Shop\Domain\Model\Address $address = NULL, $changeAddress = 0) {
and here is a fuller listing of the template section referenced in my comment below:
<f:for each="{addresses}" as="address">
<li>
<f:link.action action="shippingAddress" arguments="{address: address}">{address.title}</f:link.action>
</li>
</f:for>
A similar error ont he same page, seems to be related tot he address variable somehow:
14-11-05 17:18:27 CRITICAL Fluid Uncaught exception #1316441798: No unique path segment could be found after 100 iterations. - See also: 201411051718246a61dd.txt
previousException => Uncaught exception #1316441798 in line 198 of /home/thebigcarrot/domains/shop.thebigcarrot.ca/public_html/releases/20131219160416/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Mvc_Routing_IdentityRoutePart.php: No unique path segment could be found after 100 iterations.
and the exception log looks like this:
Uncaught exception #1316441798: No unique path segment could be found after 100 iterations.
80 TYPO3\Fluid\ViewHelpers\Link\ActionViewHelper_Original::render("editOrderAddressForAdmin", array|2|, "OrderManagement", NULL, NULL, "", "", array|0|, FALSE, array|0|, FALSE)
79 call_user_func_array(array|2|, array|11|)
78 TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::callRenderMethod()
77 TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::initializeArgumentsAndRender()
76 TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode_Original::evaluate(TYPO3\Fluid\Core\Rendering\RenderingContext)
75 TYPO3\Fluid\Core\Parser\SyntaxTree\AbstractNode::evaluateChildNodes(TYPO3\Fluid\Core\Rendering\RenderingContext)
74 TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::renderChildren()
73 TYPO3\Fluid\ViewHelpers\SectionViewHelper_Original::render()
72 call_user_func_array(array|2|, array|0|)
71 TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::callRenderMethod()
70 TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper::initializeArgumentsAndRender()
69 TYPO3\Fluid\Core\Parser\SyntaxTree\ViewHelperNode_Original::evaluate(TYPO3\Fluid\Core\Rendering\RenderingContext)
The declaration of editOrderAddressForAdmin looks like this:
/**
* Edit order address for admin
*
* #param \SeeThroughWeb\Shop\Domain\Model\Address $address
* #param integer $shipping
* #Flow\IgnoreValidation("$address")
* #return void
*/
public function editOrderAddressForAdminAction(\SeeThroughWeb\Shop\Domain\Model\Address $address , $shipping = 0) {
$this->view->assign('address', $address);
$this->view->assign('shipping', $shipping);
$countryAndStates = $this->taxZoneService->getCountryAndStates();
$this->view->assign('countries', $countryAndStates['country']);
$this->view->assign('states', $countryAndStates['state']);
}
In the template I can avoid the exception by commenting out the following line:
<f:link.action action="editOrderAddressForAdmin" controller="OrderManagement" arguments="{address: order.shippingAddress, shipping: 1}" >
<div class="editOrderDetails">(edit)</div>
</f:link.action>
So again its a link that involves an address object.
Problem lies in address argument..
I guess you may have wrong type defined for address argument for shippingAddressAction().. sth like #param \My\Package\..\wrongType $address.
Second thing might be related to Routes.yaml - for example error in routeParts.. not unique property used in uriPattern or again wrong objectType there..
You can also add #Flow\IgnoreValidation("$address") in shippingAddressAction() - and check what happens, look at the bottom of http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartII/Validation.html

Jekyll Pygments Processing

I have been fighting with Jekyll and Pygments highlighting for a while now. I have pygments installed and have generated the css file, however when I run Jekyll to generate the site, the code highlighting does not appear to generate properly.
Here is some example code I have in place for processing
{% highlight php lineos %}
/**
* Passing by reference
*
* Outputs
*
* 10 - before add() call
* 10 - after add() call
* 15 - after addref() call
*/
$a = 10;
echo $a;
add($a);
echo $a;
addref($a);
echo $a;
function addref(&$a)
{
$a += 5;
}
function add($a)
{
$a += 5;
}
{% endhighlight %}
and here is what it looks like after Jekyll builds my site.
<div class="highlight"><pre><code class="php"><span class="x">/**</span>
<span class="x"> * Passing by reference</span>
<span class="x"> *</span>
<span class="x"> * Outputs</span>
<span class="x"> *</span>
<span class="x"> * 10 - before add() call</span>
<span class="x"> * 10 - after add() call</span>
<span class="x"> * 15 - after addref() call</span>
<span class="x"> */</span>
<span class="x">$a = 10;</span>
<span class="x">echo $a;</span>
<span class="x">add($a);</span>
<span class="x">echo $a;</span>
<span class="x">addref($a);</span>
<span class="x">echo $a;</span>
<span class="x"> </span>
<span class="x">function addref(&$a)</span>
<span class="x">{</span>
<span class="x"> $a += 5;</span>
<span class="x">}</span>
<span class="x"> </span>
<span class="x">function add($a)</span>
<span class="x">{</span>
<span class="x"> $a += 5;</span>
<span class="x">}</span>
</code></pre>
</div>
As you can see Jekyll seems to be marking every line as class="x" and I am not quite sure why.
I have tried using both the liquid and jekyll from the Github repos, I have even tried using redcarpet even though it has nothing to do with the liquid template processing. I have tried just about everything I can think of but cannot seem to get this to work.
This is what it actually looks like when I view my website
http://i.stack.imgur.com/kCvLN.png
I am running the following versions.
Ruby: ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]
rdiscount: rdiscount (1.6.8)
redcarpet: redcarpet (2.2.2)
pygments: pygments.rb (0.2.13)
Liquid: liquid (2.4.1)
Jekyll: jekyll (0.11.2)
I have just gone as far as using a redcarpet_markdown.rb plugin and setting the configuration settings to use redcarpet2 and I set the extensions for redcarpet.
markdown: redcarpet2
redcarpet:
extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "strikethrough", "superscript", "with_toc_data"]
Once that was in place I changed the code highlighting to be like this
```php
/**
* Passing by reference
*
* Outputs
*
* 10 - before add() call
* 10 - after add() call
* 15 - after addref() call
*/
$a = 10;
echo $a;
add($a);
echo $a;
addref($a);
echo $a;
function addref(&$a)
{
$a += 5;
}
function add($a)
{
$a += 5;
}
```
I then tried generating the site again and I got the same result. I am not sure if this is Jekyll causing the issue or Pygments but I have been fighting with this for the last 2 days now. But I now know it is not the markdown processor.
If you have any ideas I would be more than willing to try anything.
If you want to avoid the <?php tags you can specify the Pygment option startinline
{% highlight php startinline %}
phpinfo();
{% endhighlight %}
This way it should render properly (it worked for me).
It appears you not only have to include the opening tag for the code block but with PHP you also have to include the
```php
<?php
/**
* Passing by reference
*
* Outputs
*
* 10 - before add() call
* 10 - after add() call
* 15 - after addref() call
*/
$a = 10;
echo $a;
add($a);
echo $a;
addref($a);
echo $a;
function addref(&$a)
{
$a += 5;
}
function add($a)
{
$a += 5;
}
```

Selenium tbody text extraction

The web application I am trying to automate has a diagnostic tool that allows to ping to a website. It provides output in a box that has a table structure (all of it is included i na ).
I am automating it using Selenium WebDriver and Java to program one. It is structured as a JUnit 4 test and uses WebDriver (not Selenium RC, but the newer one)
Here is what it looks like:
<tr>
<td style="font-family:Arial;font-size:11px;"></td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;"> </td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">PING ds-any-fp3-real.wa1.b.yahoo.com (98.138.253.109) 56(84) bytes of data.</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=1 ttl=53 time=81.9 ms</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=2 ttl=53 time=148 ms</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=4 ttl=53 time=143 ms</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;"></td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">--- ds-any-fp3-real.wa1.b.yahoo.com ping statistics ---</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">5 packets transmitted, 3 received, 40% packet loss, time 4012ms</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;">rtt min/avg/max/mdev = 81.917/124.763/148.373/30.349 ms</td>
</tr>
<tr>
<td style="font-family:Arial;font-size:11px;"></td>
</tr>
</tbody>
And here is what it looks like on the page:
PING ds-any-fp3-real.wa1.b.yahoo.com (98.138.253.109) 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=1 ttl=53 time=81.9 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=2 ttl=53 time=148 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=4 ttl=53 time=143 ms
--- ds-any-fp3-real.wa1.b.yahoo.com ping statistics ---
5 packets transmitted, 3 received, 40% packet loss, time 4012ms
rtt min/avg/max/mdev = 81.917/124.763/148.373/30.349 ms
I need to parse this text using Selenium WebDriver and pass the JUnit test if the ping was successful (doesn't matter if the packets have been lost), I need to extract an IP address as well.
Is there any way I can extract the particular part of the page source (maybe, using driver.getPageSource() in some sophisticated way or finding this piece by xpath and then calling getText()?) and then parse it to get IP out? The way I tried it is as folows:
String IP = "";
String textToParse = //Here, we should have a way to get the string that would contain IP.
String tokenSeparators = "()"; // since our IP is enclosed by brackets
String tokens[] = textToParse.split(tokenSeparators);
for(int i = 0; i<tokens.length; i++){
if(tokens[i].matches("^[1-9]?[1-9]?[1-9]?\\.[1-9]?[1-9]?[1-9]?\\.[1-9]?[1-9]?[1-9]?\\.[1-9]?[1-9]?[1-9]?$")){ // IP regexp
IP = tokens[i]
}
}
Let me know how to extract the text that I need to parse and whether there are errors in my code (for example, if my regexp is right)
Will appreciate any help!
List<WebElement> allTds=driver.findElements(By.cssSelector("td[style*='font-family:Arial;font-size:11px;']");
String allTdText[]=new String[allTds.size()];
int i=0;
for(WebElement eachTd:allTds)
{
allTdText[i++]=eachTd.getText();
}
By using above logic you will get all td tags data in String array. after that parse each individual arraye element as your requirement.
Example :
String a="64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_req=1 ttl=53 time=81.9 ms";
For getting IP address alone
System.out.println(a.substring(a.indexOf("(")+1,a.indexOf(")")));
it will return 98.138.253.109

selecting option from hidden drop down menu

<table id="rusTable" class="groupTable" cellspacing="0" cellpadding="0">
<tbody class="ui-sortable" style="">
<tr class="groupTop ruBorder" style="display: table-row;">
<tr id="ru0" class="siru">
<tr class="ruOp off">
<td class="first"></td>
<td colspan="3">
<select class="ruOpSelect">
<option></option>
<option value="AND">AND</option>
<option>AND NOT</option>
<option>OR</option>
</select>
</td>
<td class="last"></td>
</tr>
<tr id="ru1" class="siru">
<tr class="ruOp off">
<td class="first"></td>
<td colspan="3">
<td class="last"></td>
</tr>
<tr id="ru2" class="siru">
<tr class="groupBtm ruBorder" style="display: table-row;">
</tbody>
<tfoot>
</table>
I want to select the AND option
Selenium webdriver code
actions.moveToElement(driver.findElement(By.xpath("//*#id='ruTable']/tbody/tr[3]/td[2]"))).build().perform();
waitForElement(By.xpath("(//*[#id='ruTable']//*[contains(#class,'ruOpSelect')])[1]"),30);
new Select(driver.findElement(By.xpath("(//*[#id='ruTable']//*[contains(#class,'ruOpSelect')])[1]"))).selectByVisibleText("AND");
It does hover action but does not select anything from drop down menu
ERROR - Timed out after 30 seconds waiting for visibility of element located by By.xpath:
(//*[#id='ruTable']//*[contains(#class,'ruOpSelect')])[1]
Try using this xpath, just call click on this:
"//select[#class='ruOpSelect']/option[text()='AND']"
Any drop downs I generally start with the "select" in my xpath and next level should be option.
I use
Thread.sleep(3000);
after the moveToElement action. Works for me. Then I suppose you need to click the element to select it.
You can use this code to select the particular option
IdentifyBy By;
waitForDropDownEnable(By.xpath, "xpath");
WebElement element = findElement(BY.xpath("xpath for the element"));
Select select = new Select(element);
List<WebElement> options = select.getOptions();
String values = "";
for(int index=0; index<options.size(); index++) {
if(!values.equals("")) {
values += ", ";
}
values += options.get(index).getText();
}
select.selectByVisibleText(value);
public void waitForDropDownEnable(final IdentifyBy idBy, final String controlDesc) {
int timeout =30 * 1000;
final long MAX_TIME_OUT = 300000;
final long DELAY = 250;
final long DEAD_LINE = System.currentTimeMillis() + MAX_TIME_OUT;
boolean isEnabled = false;
try {
while(System.currentTimeMillis() <= DEAD_LINE) {
getWebDriver().manage().timeouts().implicitlyWait(0,TimeUnit.SECONDS);
if(findElement(By.xpath("")).isEnabled()) {
isEnabled = true;
break;
}
Thread.sleep(DELAY);
}
} catch (WebDriverException wdex) {
;;
} catch(Exception ex) {
;;
}
}
}
selecting option from hidden drop down menu
in such case i use jsExecutor. Always works for me:
String cssLocator = "tbody.ui-sortable tr.ruOp off td select.ruOpSelect option[value="AND"]";
//find css locator of the needed AND element in dropdown. I use firepath (addon to firebug).
JavascriptExecutor js = (JavascriptExecutor) driver;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("var x = $(\'"+cssLocator+"\');");
stringBuilder.append("x.click();");
js.executeScript(stringBuilder.toString());
Hope this works for you