How do I output calabash query results to a textFile - calabash

ok, I've read all the calabsh query docs on xamarin for android and iOS and the Ruby file class and still can't find the answer, so if anyone can help then that would be great.
What I trying to do is run querys in the calabash-android console window and write those results to a file on the fly.
so for instance : query("this is my query", :type (class etc..)
I can also do query("*") - I will then take the text output and collate the information I require to build up an elements 'dictionary'
Ive tried query("*") f.write("C:\myFileName.txt",'w') and the console complains.. I've also tried multiple operators on the query (f.write, f.open).
thanks guys in advance.

The calabash console is just ruby's irb console with the calabash modules loaded. As such you can use any ruby commands to get things done. This answer should cover you - How to write to file in Ruby?
e.g.
open('out.txt', 'a') { |f| f.puts query('*')}
will append the query results to out.txt.
or
outputs = []
outputs << query('*')
outputs << query("* text:'OK'")
open('out.txt', 'a') { |f| f.puts output}

Related

Read-in df from csv before launching main app | Dash

I am trying to get my first dashboard with python dash running.
The whole thing is very similar to this https://github.com/dkrizman/dash-manufacture-spc-dashboard.
At the beginning a Dataframe is read in from a csv. My problem seems to be quite easy to solve but somehow I am not succeeding:
I want to create a initial window that allows the user to select (from e.g. dropdown) the csv file (or accordingly the path) that is read in. All the .csv files look the same but just have different values.
When using the modal components I get problems with the install of bootstrap and I thought there must be an easier way?
Thanks for your help!
Best,
Nik

rmarkdown when I print table in a loop adds "Loading [MathJax]/extensions/MathZoom.js" to my pdf

I am trying to make a pdf with tables using a loop in rmarkdown.
But I get this "Loading [MathJax]/extensions/MathZoom.js" added to the bottom of the pdf.
How do I get rid of this message?
Here is my rmd code
title: "Some tables"
output: html_document
for(i in 1:2){
mytable = kbl(head(mtcars))
cat( print(mytable))
}
I make the pdf by typing the following in the console (typically I run this from another R program).
library(kableExtra)
rmarkdown::render("tables_in_loop.rmd")
pagedown::chrome_print("tables_in_loop.html")
How do I get rid of the loading message?
When I just use
kbl(head(mtcars))
I don't get the message but I want to print out lots of tables with a loop.
I know Rmd can do pdfs, but I get an error about running pdflatex.exe from
C:\AppData\Roaming\TinyTeX\bin\win32
I don't have administrative rights to execute this. If you have suggestions about this they are much appreciated.
Also I have a 64 bit windows 10 computer and I'm running R in 64.
Thank you so much,
Jennifer
I figured it out, I need to just use cat(mytable) not cat(print(mytable))

Exporting with SAP using Python

I am trying to automate some steps in SAP with Python. I am able to do it for other type of SAP codes except for one where the Excel Export is only chosen through the menu bar "list", then "export", then "spreadsheet". Then a dialog box pops up with the request of the location and name of the file.
The issue I ran into with this case is that the Python code does not bring up steps above like it does with other SAP portion. I use the record Macro of SAP to save it in VBscript and put that into the python code.
session.findById("wnd[0]").maximize
session.findById("wnd[0]/mbar/menu[0]/menu[4]/menu[1]").select
session.findById("wnd[1]/usr/ctxtDY_PATH").text = "directory"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "filename"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 8
session.findById("wnd[1]/tbar[0]/btn[0]").press
The second line of this code results in nothing. Even though it should activate the menu bar, etc.
Your help in resolving this is appreciated.

jaggery command line script does not execute the jaggery script in the argument

I tried writting some jaggery expressions in a separate .jag file and tried executing it as follows
./jaggery.sh file.jag
The output is just the content in the file. Whatever i have in the file is printed to the console.
i.e if i have
print("hello"); in file.jag
the output is print("hello"); whereas my expected output is hello
Try like following
<%
print('hello');
%>
And, It's mentioned that,
Jaggery CMD is still experimental, and is for developer preview. You
are welcome to play with it and please do provide us your
feedback

Jenkins Groovy to extract Regex from the Current build log and call REST API?

I would like to add a build step that summarizes my build, using Groovy to read the build log that was generated to date.
I've seen several other questions on SO about related topics but not all of them run, I'm a bit confused on the API docs, and overall I can't seem to get this exact thing running.
Below is the code/resultant failure I have currently.
I have a few questions, if it is ok to put them all together here;
1.Is it safe to test things in the console window? Or, stated differently, when can it be that something works in the /script Groovy console editor window, but it will fail as a Groovy build step? (I think the API differs for the two but I'm not clear how.)
2.Is there a repo anywhere of Groovy Jenkins script examples?
3.How can I do the following?
Read the console log.
Parse it with regex for words of interest, eg "step#2 success".
Rearrange those words into a nice string with some newlines.
Call our internal REST API to submit the results.
thank you so much!
Anne
//Groovy command from SO Post#23139654
def log = manager.build.logFile.text
def summary = log =~ /(?ms)(TEST SUMMARY.*?failures)/
//From there you can extract the matches or as in my case further parse the match:
def total = summary[0] =~ /\d+ tests/
Result includes;
ERROR: Build step failed with exception
groovy.lang.MissingPropertyException: No such property: manager for class: Script1
Here are my answers.
1.Groovy console vs Groovy build step differ as per Jenkins Packages on Groovy Classpath?
2.Examples are available from a user in 2011 and unidentified dates on the wiki: "Jenkins, Groovy System scripts (and Maven) | Code Snippets" https://mriet.wordpress.com/2011/06/23/groovy-jenkins-system-script/
and https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
3.To parse the console log and grep outputs , simply input into the web box provided as input for the Editable Email plugin [4] post-build step.
Do NOT use dollar-curlyBrace syntax: use simple dollar-variable or dollar-paren syntax as shown here which is my first crack at the 'Default Content'.
STATUS=$BUILD_STATUS
$DEFAULT_CONTENT
GIT Changelog , Revision = $GIT_REVISION
$CHANGES
LOG-SNIPPETS: Regex Hits/Rules for words that give Unit Test Summaries, Error, Failure, etc =
$BUILD_LOG_REGEX( regex="^.*?BUILD FAILED.*?$", linesBefore=0, linesAfter=10, maxMatches=5, showTruncatedLines=false, escapeHtml=true)
3B.To call the REST plugin, that would need to be done in a separate step, so for now I did not do that.
I had not properly understood the Email-Ext (aka "Editable Email Notification") plugin - that is why I was trying to do this directly in Groovy.
4.[] Email-ext plugin - Jenkins - Jenkins Wiki ; ; https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin