Selenium Test Execution in Docker with UI - node.js

I tried running selenium test (Node Js) on docker machine but it says "TypeError: module.exports.browser.isElementPresent is not a function".
Note:
I can successfully run this same selenium test on my local machine
I tried running the same test on docker then i encountered the error above
root#6cd7ab2eb6f7:/usr/src# npm run kongaezv2
npm info it worked if it ends with ok
npm info using npm#4.1.2
npm info using node#v7.6.0
npm info lifecycle cerebro#0.0.1~prekongaezv2: cerebro#0.0.1
npm info lifecycle cerebro#0.0.1~kongaezv2: cerebro#0.0.1
> cerebro#0.0.1 kongaezv2 /usr/src
> mocha --recursive tests/kongaezv2 -t 9000000 --reporter mochawesome
execFile: tests/kongaezv2
execFilename: tests/kongaezv2.json
Konga EZ V2 Sanity Test
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
1) Log in with Email and Password
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
2) Serach for an item
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
3) Add an item to cart
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
4) Checkout with POD
ready to close browser
0 passing (48s)
4 failing
1) Konga EZ V2 Sanity Test Log in with Email and Password:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.clickbutton (actions.js:74:13)
at frameworks/kongaezv2.js:67:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.login_with_email (frameworks/kongaezv2.js:65:15)
at Context.<anonymous> (tests/kongaezv2/kongaezv2.js:20:19)
at runTest (node_modules/selenium-webdriver/testing/index.js:164:22)
at node_modules/selenium-webdriver/testing/index.js:185:16
at new ManagedPromise (node_modules/selenium-webdriver/lib/promise.js:1085
:7)
at controlFlowExecute (node_modules/selenium-webdriver/testing/index.js:18
4:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Konga EZ V2 Sanity Test Log in with Email and Password
at Context.ret (node_modules/selenium-webdriver/testing/index.js:183:10)
at node_modules/selenium-webdriver/testing/index.js:102:5
at ManagedPromise.invokeCallback_ (node_modules/selenium-webdriver/lib/pro
mise.js:1384:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2935:27)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
2) Konga EZ V2 Sanity Test Serach for an item:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.sendkeys (actions.js:116:13)
at frameworks/kongaezv2.js:104:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.search (frameworks/kongaezv2.js:98:15)

You should install Xvfb more info available here here

Thanks #nick_gabpe installing xvfb worked for me. I used Chromium in Docker via Xvfb

Related

Pushing Results to KiwiTCMS using RobotFramework Ride Issue

I am trying to get Robotframework(Ride) work with KiwiTCMS.
I am making the connection to the KIWI server (local) but I am getting these errors that I am not sure where(In RIDE? or the .conf file?) to fix:
[ ERROR ] Calling method 'start_suite' of listener 'zealand.listener.KiwiTCMS' failed: ENVIRONFILE Version value not defined, missing one of TCMS_PRODUCT_VERSION, TRAVIS_COMMIT, TRAVIS_PULL_REQUEST_SHA or GIT_COMMIT
[ ERROR ] Calling method 'end_test' of listener 'zealand.listener.KiwiTCMS' failed: TypeError: 'NoneType' object is not subscriptable
TestKiwiRide | PASS |
------------------------------------------------------------------------------
KiwiTest.TestKiwi | PASS |
1 test, 1 passed, 0 failed
==============================================================================
KiwiTest | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: C:\Users\hendri\Documents\KiwiTest\output.xml
Log: C:\Users\hendri\Documents\KiwiTest\log.html
Report: C:\Users\hendri\Documents\KiwiTest\report.html
(kiwi-env) C:\Users\hendri\Documents\KiwiTest>
Please assit?
Details goes into the bat file you use to call the test cases
check here : https://kiwitcms.readthedocs.io/en/stable/plugins/automation-frameworks.html
In plugin configuration section, you have to passe configuration as environment variables. e.g.
export TCMS_PLAN_ID=*PLAN_ID*

How to install npm packages in BigQuery?

I unfortunately can not any reliable documentation on how to use an npm package in BigQuery. I want to use the package isitblocked in BigQuery and parse the URLs in my tables through the library.
I only found this blog, but I can't re-procedure the steps there and get the following error while using webpack:
`assets by status 390 bytes [cached] 1 asset
./index.ts 2.43 KiB [built] [code generated] [1 error]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to > 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable > defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in ./index.ts 1:16
Module parse failed: Unexpected token (1:16)
You may need an appropriate loader to handle this file type, > currently no loaders are configured to process this file. See > > https://webpack.js.org/concepts#loaders
import envPaths = require("env-paths");
| import Listr = require("listr");
| import fs = require("fs-extra");
\
The package I try to install is isitblocked.
I did it step by step in the google Shell and it prompted to install the webpack. Please include the mode none or production
npx webpack --config webpack.config.js --mode none
Then upload the file under dist and edit the BigQuery query to:
CREATE TEMP FUNCTION get_rand_card_number()
RETURNS STRING
LANGUAGE js
OPTIONS (
library=["gs://***your*bucket*name***/creditcard-generator.js"]
)
AS r"""
return webpackNumbers.GenCC("Amex"); # Still wrong function name
""";
CREATE TEMP FUNCTION get_rand_id()
RETURNS STRING
LANGUAGE js
AS r"""
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 4 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(4);
});
""";
SELECT
x,
get_rand_id() as unique_id,
get_rand_card_number() as credit_card_number
FROM
unnest(generate_array(1,100,1)) x

Minting token in cardano mainnet --tx-out error

I am trying to mint a token in cardano mainnet. I have built a block and staking pool. I am working to mint a token and i am running into an error "unexpected '2', expecting space, "+" or end of input.
Here is the linux code I'm running:
cardano-cli transaction build-raw --shelley-era --fee $fee --tx-in $txhash#$txix --tx-out $address+$output+"$tokenamount $policyid.$tokenname1" --mint="$tokenamount $policyid.$tokenname1" --minting-script-file policy/policy.script --out-file matx.raw
Here is the error:
option --tx-out:
unexpected '2'
expecting space, "+" or end of input
Inputs:
I have tried different outputs of 10000000, 5000000, and 0.
$tokenamount="10000000"
$address=$(cat payment.addr)
$tokenname1="CpoolTest"
https://developers.cardano.org/docs/native-tokens/minting/
Please help
I guess i found the error.
Check $policyid whats inside. It should contain only 1x adress.
Try echo $policyid. It should only display 1 address
If its not the case, yo can try:
to delete your policyID:
rm -rf policy/policyID
After deleting create a brand new one:
cardano-cli transaction policyid --scriptfile ./policy/policy.script >> policy/policyID
Now set the variable:
policyid=$(cat policy/policyID)
Echo it
echo $policyid
There should be exactly 1 address displayed. Your code should work now

How to prevent jest to show fail test details on summary

When I run my tests with jest and some of them fails for each item failed I get a list like this:
FAIL src/app/models/item.model.spec.ts
● Item› #getItem › do stuff
expect(received).toBeFalsy()
Received: true
293 |
294 | test('do stuff', () => {
> 295 | expect(true).toBeFalsy();
| ^
296 | });
297 | });
298 | });
at src/app/models/item.model.spec.ts:295:20
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:391:26)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:129:39)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:390:52)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:150:43)
at Object.testBody.length (node_modules/jest-preset-angular/zone-patch/index.js:52:27)
which is the same info that I get above when the test first failed. In the case when a suite is really big and something breaks all their tests (or in more than one file) is really impossible to read that list because the details are always between the FAIL title and test names.
Is there a way to do jest to print a compact Failed Tests summary like this?
FAIL src/app/models/item.model.spec.ts
● Item› #getItem › do stuff
● Item› #getItem › do another Stuff
FAIL src/app/models/loader.model.spec.ts
● Loader> #loadSomething › be cool
● Loader› #loadAnything › be cooler
So if I want to read the fail details I can just scroll up or filter the failed test in my next run.

closing browser error - change behavior

I'm experiencing some strange behavior with Watir when I want to close the browser.
brs = Watir::Browser.new
=> #<Watir::Browser:0x1035fc1f8 url="about:blank" title="">
brs.close
=> true
brs
NoMethodError: undefined method `closed?' for nil:NilClass
The browser is closed properly (as expected) but after that I'm unable to operate with the class / instance.
Why is that happening?
I am not getting the error message:
$ irb
1.9.3-p125 :001 > require "watir-webdriver"
=> true
1.9.3-p125 :002 > b = Watir::Browser.new
=> #<Watir::Browser:0x7e1df9f913a40838 url="about:blank" title="">
1.9.3-p125 :003 > b.close
=> true
1.9.3-p125 :004 > b
=> #<Watir::Browser:0x7e1df9f913a40838 closed=true>
Environment:
- Mac OS X 10.7.3
- Firefox 12.0
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
$ gem -v
1.8.23
$ gem list *webdriver
...
selenium-webdriver (2.21.2)
watir-webdriver (0.5.5)
...

Resources