Nightwatch XML output file is empty - nightwatch.js

When I run my test, I get all the output I would expect from the test such as
✔ Element <body> was visible after 12 milliseconds.
✔ Testing if element <input[id="usernameID"]> is visible.
✔ Testing if element <#usernameID> is visible.
✔ Testing if element <#passwordID> is visible.
✔ Testing if value of <#usernameID> contains: "".
But when I open the XML file that is generated there is nothing there, just the header, footer and a bunch of blank lines.
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites errors="0"
failures="0"
tests="2">
<testsuite name="loginTests"
errors="0" failures="0" hostname="" id="" package="login" skipped="0"
tests="2" time="15.87" timestamp="Mon, 08 Feb 2016 21:01:16 GMT">
<testcase name="Login Page Load Test" time="10.68" assertions="1">
</testcase>
<testcase name="Login/Logout Test" time="5.195" assertions="23">
</testcase>
</testsuite>
</testsuites>
Here is a snippet of the code.
'Login/Logout Test' : function(client) {
client
.waitForElementVisible("body", client.globals.waitForConditionTimeout)
.assert.visible('input[id="usernameID"]')
.assert.visible('#usernameID')
.assert.visible('#passwordID')
.end
I must be missing something simple.

Apparently this is the way it is... does not make a lot of sense but...
To get this information out of the test run a custom reporter is used.
I have done this, now I can write the information anywhere I want I chose to write it to a DB table.

Related

How can I skip a laravel dusk test case [duplicate]

I am using phpunit in connection with jenkins, and I want to skip certain tests by setting the configuration in the XML file phpunit.xml
I know that I can use on the command line:
phpunit --filter testStuffThatBrokeAndIOnlyWantToRunThatOneSingleTest
how do I translate that to the XML file since the <filters> tag is only for code-coverage?
I would like to run all tests apart from testStuffThatAlwaysBreaks
The fastest and easiest way to skip tests that are either broken or you need to continue working on later is to just add the following to the top of your individual unit test:
$this->markTestSkipped('must be revisited.');
If you can deal with ignoring the whole file then
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
<testsuites>
<testsuite name="foo">
<directory>./tests/</directory>
<exclude>./tests/path/to/excluded/test.php</exclude>
^-------------
</testsuite>
</testsuites>
</phpunit>
Sometimes it's useful to skip all tests from particular file based on custom condition(s) defined as php code. You can easily do that using setUp function in which makeTestSkipped works as well.
protected function setUp()
{
if (your_custom_condition) {
$this->markTestSkipped('all tests in this file are invactive for this server configuration!');
}
}
your_custom_condition can be passed via some static class method/property, a constant defined in phpunit bootstrap file or even a global variable.

How to turn a file into a Nokogiri::XML object?

I have a sample XML file (let's call it example.xml for the sake of this question) and want to turn it into a Nokogiri object.
According to documentation and lots of other online sources, this should work:
xml = Nokogiri::XML(File.read("example.txt"))
But the value of xml.to_xml is only:
"<?xml version=\"1.0\"?>\n"
In other words, it's ignoring the rest of the file. There are many tags afterwards and none of them are in the xml object.
How do I get Nokogiri to get all the tags?
Here's the XML I'm using:
<? xml version="1.0" encoding="UTF-8" ?>
<Document>
<Test>Test</Test>
</Document>
It looks like you are trying to parse an invalid XML doc.
This can be fixed by removing the spaces in the XML declaration:
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<Test>Test</Test>
</Document>
How I figured this out
By default, when Nokogiri has errors parsing a document it populates an errors array.
xml = Nokogiri::XML(File.read("example.txt"))
p xml.errors
# => [#<Nokogiri::XML::SyntaxError: xmlParsePI : no target name>, #<Nokogiri::XML::SyntaxError: Start tag expected, '<' not found>]
You can also configure Nokogiri to raise an exception of it has parsing errors:
xml = Nokogiri::XML(File.read("example.txt")) do |config|
config.strict
end
Both of these cases show that there were issues parsing the document

Preference windows addons firefox

I have the beginning of this code to create a preference window for an addon:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<!DOCTYPE korpuslex SYSTEM "chrome://korpuslex/locale/korpuslex.dtd">
<prefwindow type="prefwindow"
id="korpuslex-prefs"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 42em; min-height: 37.5em;"
title="&korpuslex.PrefsTitle;">
<script src="options.js" />
...
I got an "error analysis XML" if I call a parameter from the *.dtd file as in "title="&korpuslex.PrefsTitle;">"but everything is OK if no parameters are used.
I tried to match my code with other addons but can't find why it doesn't work.
The document type declaration must name the document's root element type, in your case prefwindow.
Change it to
<!DOCTYPE prefwindow SYSTEM "chrome://korpuslex/locale/korpuslex.dtd">

MAGENTO: How to display waringns like errors?

My errors/local.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<skin>default</skin>
<report>
<action>print</action>
<subject>Store Debug Information</subject>
<email_address></email_address>
<trash>trash</trash>
</report>
</config>
Is it possible to display warning in browser?
PS:
I can see errors in browser when they are.
But I would like to see warnings also, not just in log file.
Enable developer mode. In Magento > 1.3 you need only set an environment variable (MAGE_IS_DEVELOPER_MODE) as this is evaluated in index.php.
You can uncomment errors settings in index.php

Is it possible to pass variable to WIX localization file?

I need to use variable in WIX localization file WIXUI_en-us.wxl.
I tried use it like this:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product $(var.InstallationVersionForGUI) is already installed</String>
But it doesn't work. And when I declared property and used it this way:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product [InstallationVersionForGUI] is already installed</String>
doesn't work either.
Where was I wrong?
Thanks for help and your time.
Localization strings are processed at link time, so you can't use $(var) preprocessor variables. Using a [property] reference is supported, as long as the place where the localization string is used supports run-time formatting (e.g., using the Formatted field type).
Your second method should work just fine. This is the same method used by the default .wxl files.
For example, in your .wxl file you would declare your string:
<String Id="Message_Foo">Foo blah blah [Property1]</String>
And in your .wxs file, you declare the property. If you wish, you can declare the property to match a WiX variable (which it sounds like you're trying to do)
<Property Id="Property1">$(var.Property1)</Property>
I was trying to get localization file to use variables. Came across this post:
There are different layers of variables in WiX (candle's preprocessor
variables, Light's WixVariables/localization variables/binder
variables, and MSI's properties). Each have different syntax and are
evaluated at different times:
Candle's preprocessor variables "$(var.VariableName)" are evaluated
when candle runs, and can be set from candle's commandline and from
"" statements. Buildtime environment
properties as well as custom variables can also be accessed similarly
(changing the "var." prefix with other values).
Light's variables accessible from the command-line are the
WixVariables, and accessing them is via the "!(wix.VariableName)"
syntax. To access your variable from your commandline, you would need
to change your String to: This build was prepared on
!(wix.BuildMachine)
If you instead need to have the BuildMachine value exist as an MSI
property at installation time (which is the "[VariableName]" syntax)
you would need to add the following to one of your wxs files in a
fragment that is already linked in:
Now, the environment variable COMPUTERNAME always has held the name of
my build machines in the past, and you can access that this way:
$(env.COMPUTERNAME). So, you can get rid of the commandline addition
to light.exe and change your wxs file like this:
<WixProperty Id="BuildMachine" Value="$(env.COMPUTERNAME)"/>
Preprocessor variables $(var.VariableName) are are processed at link time, so ideally you would use [PropertyName] which would be defined on the main Product element.
The issue sometimes is that property is not yet defined, for instance using the product name on the localization file seems not posible.
This solution was done aiming to only type the product name once given "Super product" as product name:
In case of running through visual studio extension:
Project properties -> Build -> Define variables -> "MyProductName=Super product" (No quotes)
In case of runing from cmd or some other place:
On Light.exe, add -d"MyProductName=Super product"
Into the localization .wxl file:
<String Id="Description" Overridable="yes">Description of !(wix.MyProductName)
to make it more interesting</String>
I have an aditional config file .wxi I include on other files to have some vars, for instance, here i had hardcoded the value but now it's harcoded on the variable definition and I use the given value:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<!-- Define the product name preprocesor variable -->
<?define ProductName="!(wix.ProductNameDefVar)" ?>
<!-- From this point, can use the preprocesor var -->
<?define ProductName_x64="$(var.ProductName) (64bit)" ?>
<?define ProductName_x32="$(var.ProductName) (32bit)" ?>
<?define CompanyDirName = "My company name" ?>
</Include>
Finally, the place where the localization value where the localization text was not interpolating, is like this:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Include the config file with the preprocesor var -->
<?include $(sys.CURRENTDIR)\Config.wxi?>
<!-- Main product definition -->
<Product Id="$(var.ProductCode)"
Name="$(var.ProductName)"
Language="!(loc.Language)"
Version="$(var.BuildVersion)"
Manufacturer="!(loc.Company)"
UpgradeCode="$(var.UpgradeCode)">
<!-- Package details -->
<!-- Here, Description was not interpolating -->
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Platform="$(var.Platform)"
Manufacturer="!(loc.Company)"
Description="!(loc.Description)"
Keywords="!(loc.Keywords)"
Comments="!(loc.Comments)"
Languages="!(loc.Language)"
/>
[...]

Resources