How do you set edge.options in serenity.config file? - automated-tests

I am using serneity bdd (cucumber). In the serenity.config file I am able to set chrome settings like
chrome.switches = """--headless;"""
I can also pass them in through mvn like
-Dheadless.mode=true
But I cannot set any edge options. I think the correct way is to use
edge.options = """ """
But I cannot find what are valid inputs, and I cannot pass anything (that works) into the mvn command.
I can't seem to find answer online, anyone know?

Related

How to scroll up in Vim buffer with R (using Nvim-R)

I'm a happy user of the Nvim-R plugin, but I cannot find out how to scroll up in the buffer window that the plugin opens with R. Say for instance that I have a large output in console, but I cannot see the top of it - how do I scroll up to see this? In tmux for instance there's a copy mode that quite handily lets you do this, but how is this done in the R buffer?
An example below where I'm very curious to see what's on the line above the one begining with "is.na(a)...". How can this be achieved?
I have scoured the documentation found here, but without luck.
The answer is apparently to use Ctrl+\ Ctrl+n according to this answer on the bugreports for NVim-R.
Here's what my output looks like when I output mtcars:
When I hit Ctrl+\ Ctrl+n, I can move the cursor and I get line numbers:
To get back to interactive, I just use i, the same way I normally would.
Apparently, if you are using neovim, then you can add let R_esc_term = 0 in your ~/.vimrc file and you can then use the escape key, but if you don't use neovim, you are stuck using the two ctrl commands ¯\_(ツ)_/¯.
As pointed out by ZNK, it is about switching to normal mode in Vim's terminal. This, however, can easily fail due to cumbersome keybinding. If such is the case, remap the default keybinding to something reasonable, say, by putting this in your .vimrc:
tnoremap jk <C-\><C-n>
This works for me in Linux running Vim 8.0 in terminal (e.g. does not require Neovim). As you can see, I use 'jk' to switch from insert to normal mode. One can use Esc instead of jk, however, this makes me unable to use up arrow to retrieve command line history as been reported elsewhere.

CMake COMPILE_DEFINITIONS triggering incorrect number of arguments

I'm having problem understanding how to correctly set the COMPILE_DEFINITIONS target properti in CMake.
my target is add_library(modelutilities STATIC ${modelutilities_SRCS})
I if use
set(modelutilities_COMPILE_DEFINE ${modelutilities_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS})
set_target_properties(modelutilities PROPERTIES
VERSION "0.0.1"
SOVERSION 0
EXPORT_NAME "ModelUtilities"
ARCHIVE_OUTPUT_DIRECTORY "${modelutilities_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${modelutilities_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${modelutilities_PlatformDir}/bin"
COMPILE_DEFINITIONS ${modelutilities_COMPILE_DEFINE}
)
everything works fine, but if I add another line between them with set(modelutilities_COMPILE_DEFINE ${modelutilities_COMPILE_DEFINE} MODELUTILITIES_LIB) it stops working complaining that set_target_properties was called with the wrong number of arguments.
Anyone can spot what I'm doing wrong?
P.S.
I already tried using doublequotes: set(modelutilities_COMPILE_DEFINE ${modelutilities_COMPILE_DEFINE} "MODELUTILITIES_LIB"). It did not change anything
P.P.S.
If I message(STATUS ${modelutilities_COMPILE_DEFINE}) QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB in the first case and QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;MODELUTILITIES_LIB in the second
With newer version of CMake, what is being preached is the idea of targets. So, for example, instead of include_directories() it's now preferred to use target_include_directories().
That being the case I think you'd be better served using the preferred target_compile_definitions() to set compile definitions for your utilities library.
One advantage you get is that your can scope your compile definitions using the PUBLIC or PRIVATE keywords.

Watir webdriver - Passing variable to multiple tests?

I have 50+ Watir test scripts which currently just check a specific URL which is defined inside each of them.
Now we are launching 4 more sites and would like to run these tests on all 5 sites. To maintain 5 packs of 50+ tests would be a nightmare in the future.
Is there a way I can pass a variable to all of the individual tests with the URL to visit.
For example
url = "http://site1.com"
That way if we want to then test site 2 we just need to change the url variable and not every single script.
url = "http://site2.com"
Example test:
require "watir-webdriver"
browser = Watir::Browser.new :chrome
browser.goto "http://url.com/"
browser.text_field(:id, "edit-search").set("Accounting")
browser.button(:value,"Search").click
browser.link(:text, "Accounting Manager with a leading US MNC").click
browser.link(:text, "Apply").click
browser.text_field(:id, "edit-firstname").set("hi2")
browser.text_field(:id, "edit-lastname").set("hi")
browser.text_field(:id, "edit-email").set("t#t.com")
browser.text_field(:id, "edit-current-job").set("Test")
browser.radio(:id, "edit-use-stored").click
browser.radio(:id, "edit-existing-cv-319706").click
browser.text_field(:id, "edit-message").set("Testing")
browser.checkbox(:id, "edit-create-alert").click
browser.button(:value,"Apply").click
browser.screenshot.save '..\screenshots\ApplyWithAlertNonRegistered.png'
browser.link(:text, "Home").click
browser.close
While I would recommend moving to an actual test framework, I think the following approaches would work for your situation.
Solution 1 - Pass Value From Batch to Test
In a test script, you can get the parameters passed in from the batch file using the ARGV array.
In your batch file, you could define the URL and then pass to the test script as a parameter.
SET URL="http://site2.com"
ruby test_example1.rb %URL%
ruby test_example2.rb %URL%
Your tests would get the ARGV[0] value and go to it:
browser.goto ARGV[0]
For each test run, you would need to update the batch for the correct url.
Solution 2 - Specify URL in a Helper File
An alternative solution would be to specify the url in a variable that is included by each test. This is probably a better approach, especially if there are multiple variables.
Create a test_helper.rb file with:
url = "http://site1.com"
For each of your test scripts, require this test_helper file and use the url variable:
require "watir-webdriver"
require "test_helper" #(Change path if not in the same folder)
browser = Watir::Browser.new :chrome
browser.goto url
Before each test run, update the test_helper.rb file to point to the correct url.
I like Justin's answer, but another option is Fig Newton. It allows you to change multiple variables depending on the system that you are running on (localhost, on jenkins, UAT, whatever).
Justin - in the test_helper file, would it be possible to set the browser type (chrome, ie, or ff) and pass that variable into each test script; so, if I wanted to change the browser, I would only have to change it in the test_helper file rather than having to go into each test script to change?
If possible, how would this look in the test_helper file and test scripts?
test_helper: type = ff
test script: browser = Watir::Browser.new :type
Thanks!

Silencing ChromeDriver.exe logging

I am running ruby unit tests against Chrome using watir-webdriver. Whenever a test is run and chromedriver.exe is launched output similar to below appears:
Started ChromeDriver
port=9515
version=26.0.1383.0
log=C:\Home\Server\Test\Watir\web\chromedriver.log
[5468:8796:0404/150755:ERROR:accelerated_surface_win.cc(208)] Reseting D3D device
[5468:8996:0404/150758:ERROR:textfield.h(156)] NOT IMPLEMENTED
[WARNING:..\..\..\..\flash\platform\pepper\pep_module.cpp(63)] SANDBOXED
None of this impacts the correct functioning of the tests, but as one might imagine the appearance of "ERROR" and "WARNING" might be rather confusing to, for example, parsing rules in Jenkins looking for failures. Sure I can get really fancy with regular expression in the parsing rules, but it would be really nice to turn off this verbose and unnecessary logging on the part of chromedriver.exe. I have seen many mentions of this searching for an answer. No one has come up with a solution. Yes, chromedriver possibly has a "--silent" option, but there seems to be no way to pass that to the executable. Code similar to below is supposed to work, but has zero effect as far as I can see. Any ideas?
profile = Selenium::WebDriver::Chrome::Profile.new
profile['--cant-make-any-switches-work-here-how-about-you'] = true
browser = Watir::Browser.new :chrome, :profile => profile, :switches => %w[--ignore-certificate-errors --disable-extensions --disable-popup-blocking --disable-translate--allow-file-access]
Here's help for anyone else searching
Find ...selenium\webdriver\chrome\service.rb
Path start may differ on your system
And I added "-silent" to the passed parameters .... However, this silenced everything but the error/warning messages.
def initialize(executable_path, port)
#uri = URI.parse "http://#{Platform.localhost}:#{port}"
server_command = [executable_path, " -silent", "--port=#{port}"]
#process = ChildProcess.build(*server_command)
#socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT
#process.io.inherit! if $DEBUG == true
end
set chromeOptions with key --log-level=3 this should shut it up
I was able to divert the hundreds, yes hundreds, of chrome driver log messages that were showing up in cucumber stdout by using the :service_log_path argument.
#browser = Watir::Browser.new :chrome, :service_log_path => 'chromedriver.out'
the '-silent', or '--silent', or ' -silent', or ' --silent' parameter suggested above did nothing when I added it to ...selenium\webdriver\chrome\service.rb. And having to tweak the gem itself is not a particularly viable solution.
I couldn't find a place to capture the chromedriver stderr and divert it to null (not to mention having to handle doing that in windows and in *nix/osx)
The driver should default to something way less verbose. In this case INFO is way too verbose as hundreds of log entries pop out as INFO, 90%+ of them identical.
At least the :service_log_path argument works most of them.
You can try -Dwebdriver.chrome.logfile="/dev/null" and/or -Dwebdriver.chrome.args="--disable-logging" to the options of java that runs selenium-server-standalone-what.ever.jar

$ sign after each line in files(UNIX OS)

I am new to vim editor and based on general reading from different forums, I was trying to customize vim by updating the .vimrc file to look something like this:
syntax on
set incsearch
set ignorecase
set smartcase
set wildmode = list
that gives me a whole set of functionality I need. However, after having saved this content to .vimrc, suddenly all my files started to show $ as the ending character after each line.
i.e. Now even the .vimrc file looks like:
syntax on$
set incsearch$
set ignorecase$
set smartcase$
set wildmode = list$
and unfortunately I am not able to delete them in the editor. Are there any comments on how to get rid of these '$' signs? Has anyone else encountered this problem before?
Thanks in advance!
The line set wildmode = list is wrong, it should be set wildmode=list no spaces.
The line as it is queries the wildmode option and sets the boolean list option
It’s because you said set list.
Go check for init.vim file.
For me that file was at /home/user/.config/nvim/init.vim
And it was turn on "See invisible characters":
set list listchars=tab:>\ ,trial:+,eol:&
Delete or comment the line.

Resources