I have config and specs files at shared folder of remote server. I run tests from local machine via console:
C:\Users\User>protractor \remoteServer\AutoSPA\config\protractor.conf.js
With jasmine framework all works good, but if I set framework: 'jasmine2' in protractor.conf.js tests don`t run:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://10.17.175.168:50910/wd/hub
Started
No specs found
Finished in 0.001 seconds
Uncaught exception: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
[launcher] Process exited with error code 1
EXAMPLE:
conf.js:
exports.config = {
specs: ['./test.js'],
capabilities : {'browserName' : 'chrome'},
framework: 'jasmine2',
jasmineNodeOpts: {showColors: true}
};
test.js in the same folder:
describe("test", function(){
it("navigate", function(){
browser.get("https://angularjs.org/")
})
});
if it's local folder it works correctly, but if it's remote folder it doesn't find spec test.js.
I investigated and debug a little bit more and found out that Jasmine 1.3 used FS and Path for specs search, but Jasmine 2 used GLOB. Glob doesn't work with remote paths.
Related
I used Cypress 10 for a while with Cucumber preprocessor. Everything worked without issues. Today I updated Cypress to the latest version 10.7.0 and also #badeball/cypress-cucumber-preprocessor to 12.2.0. I have there also #bahmutov/cypress-esbuild-preprocessor 2.1.3
In my cypress.config.js file I have:
e2e: {
baseUrl: 'http://localhost:4200',
specPattern: 'cypress/e2e/features',
setupNodeEvents(on, config) {
const createEsbuildPlugin =
require('#badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin
const createBundler = require('#bahmutov/cypress-esbuild-preprocessor')
require('#badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin
on('file:preprocessor', createBundler({
plugins: [createEsbuildPlugin(config)],
}));
}
},
But now, when I start Cypress test runner, all the test are still there (all feature files), but after I click on ANY test case, I have this error:
Error: Build failed with 1 error:
node_modules/common-ancestor-path/index.js:17:37: ERROR: [plugin: feature] Reduce of empty array with no initial value
at failureErrorWithLog (C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:1605:15)
at C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:1251:28
at runOnEndCallbacks (C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:1034:63)
at buildResponseToResult (C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:1249:7)
at C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:1358:14
at C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:666:9
at handleIncomingPacket (C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:763:9)
at Socket.readFromStdout (C:\Users\JS\Desktop\test\node_modules\esbuild\lib\main.js:632:7)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
And also Cypress says: No tests found. Cypress could not detect tests in this file.
Seems the issue is with esbuild, but not sure. I tried to downgrade the cucumber preprocessor, then it is working again.
Seems it is a compatibility problem between cucumber and esbuild.
Each library is managed by someone else, they do not cooperate, so I am really thinking to stop using Cucumber, but only pure Cypress.
I'm using webdriverIO for some automation testing and have recently migrated from 'selenium-standalone' service to default wdio devtools protocol.
wdio v.7.16.12
firefox v.95.0.2
From that point I can't start testing with firefox browser:
INFO #wdio/cli:launcher: Run onPrepare hook
INFO #wdio/cli:launcher: Run onWorkerStart hook
INFO #wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.js
INFO #wdio/local-runner: Run worker command: run
...
INFO devtools:puppeteer: Initiate new session using the DevTools protocol
ERROR #wdio/runner: Error: Couldn't find executable for browser
...
INFO #wdio/cli:launcher: Run onComplete hook
I've tried different combinations of options with 'wdio:devtoolsOptions' and 'moz:firefoxOptions'.
Plus checked whether could help dumpio: true, and 'moz:debuggerAddress': true options.
Also I've tried substitution browserName with product and adding binary and executablePath to capabilities.
When passing binary: 'path.to.firefox' to 'moz:firefoxOptions' options, the error message changes to:
ERROR #wdio/runner: Error: Only Nightly release channel is supported in Devtools/Puppeteer for Firefox. Refer to the following issue:
...
Any ideas how it could be fixed in webdriverIO (without installing separately puppeteer or puppeteer-firefox)?
Thanks!
Seems that I took desired for real.
wdio + devtools:puppeteer still work with Firefox Nightly only – https://github.com/webdriverio/webdriverio/discussions/7916
I am using firefox v 48.0.2 and am trying to get my selenium (selenium-server v2.53) remotedriver automated tests to run on firefox, I have geckodriver 0.9.0 installed and when i go through the documentation on the github readme and run this command: (on mac osx 10.11.3)
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
i get this error message:
thread '< main >' panicked at 'called Result::unwrap() on an Err value: Io(Error { repr: Os { code: 48, message: "Address already in use" } })', ../src/libcore/result.rs:746
note: Run with RUST_BACKTRACE=1 for a backtrace.
ive tried ignoring this step but when i run my tests firefox does not launch, i have ensured that my webdriver capabilities include marrionette: true
WebDriver:
browser: 'firefox'
clear_cookies: false
restart: false
window_size: 414x736
marionette: true
other than that i can not find any documentation to lead me in the correct direction, did i perhaps over look something? any help is greatly appreciated!
I am also using codeception to handle my tests (php)
EDIT
I was able to get this command to work after killing the process that was listening on port 4444:
geckodriver -b /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
But even with that running Firefox is still not launching
I'm using the gulp-jasmine-node plugin to run my Jasmine/Frisby.js tests like so:
gulp.task('runJasmine', function() {
return gulp.src(['test/*spec.js'])
.pipe(jasmineNode({
timeout: 10000
}));
});
gulp.task('test', ['runJasmine']);
Running gulp test locally I get the following (snippet only):
2) Frisby Test: Get API root
[ GET http://localhost:8080/api ]
Message:
Error: Header 'content-type' not present in HTTP response
Stacktrace:
Error: Header 'content-type' not present in HTTP response
at null.<anonymous>
...
Finished in 0.042 seconds
1 test, 2 assertions, 2 failures, 0 skipped
My .travis.yml:
language: node_js
node_js:
- "0.12"
- "4.2.4"
- "5.3.0"
before_script:
- npm install -g gulp
script: gulp test
And the corresponding raw CI output on Travis (end snippet only):
Finished in 0.054 seconds
[31m1 test, 2 assertions, 2 failures, 0 skipped
[0m travis_time:end:00bb9734:start=1455472901504935117,finish=1455472903105906383,duration=1600971266
[0K [32;1mThe command "gulp test" exited with 0.[0m
Done. Your build exited with 0.
I'm not sure why the build is passing despite failures - is there a certain configuration in Travis when using gulp, depending on test tool used? Is it due to the process exiting with code 0, and if so, do I need to modify my gulp command to exit the process on failure (not ideal as would interrupt other tasks in the runner).
Can't seem to find this problem or identical setup pre-addressed. Please help! Also, this is my first Stack Overflow Q, so hopefully I've provided all info needed. Thanks :)
This answer is not related to jasmin/frisby. But still might help other people looking on the gulp exiting with 0 on failing tests and having travis ci pass.
Here's my gulp test
gulp.task('test', function () {
mochify('./src/js/__tests__/**/*.js', {
extension: ['.jsx', '.js'],
node: true,
path: ['./src/js/'],
watch: false,
})
.transform(babelify)
.transform(envify({
_: 'purge',
NODE_ENV: 'production',
}))
.on('error', function(){
// Exits gulp with error
process.exit(1);
}).bundle()
});
The part which I figured out was that you can manually exit gulp with an exit code non 0 via process.exit(1); and then travis will fail.
Travis installs Firefox 31.0esr by default, but we want to always use the latest version. The reference here says it should be pretty straight forward, but it doesn't seem to actually install, rather it just seems to download the tar file. Protractor still uses Firefox version 31.0esr when it runs.
travis.yml
addons:
firefox: "latest"
protractor.conf.js
capabilities: {
'browserName': 'firefox'
}
Logs:
Initial Firefox install still happens:
[34m[1mInstalled Firefox version[0m
firefox 31.0esr
... the addon section kicks in and downloads the file fine, before the before_install section as expected:
[0Ktravis_fold:start:install_firefox
[0K$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64'
[33;1mInstalling Firefox latest[0m
travis_time:start:0dff0345
[0K$ wget -O /tmp/firefox-latest.tar.bz2 $FIREFOX_SOURCE_URL
--2016-01-04 23:29:18-- https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64
Resolving download.mozilla.org (download.mozilla.org)... 52.20.26.65
Connecting to download.mozilla.org (download.mozilla.org)|52.20.26.65|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2 [following]
--2016-01-04 23:29:18-- http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 23.0.160.35, 23.0.160.65
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|23.0.160.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 52525181 (50M) [application/x-bzip2]
Saving to: `/tmp/firefox-latest.tar.bz2'
0% [ ] 0 --.-K/s
33% [============> ] 17,618,150 84.0M/s
67% [=========================> ] 35,556,926 84.7M/s
100%[======================================>] 52,525,181 83.6M/s in 0.6s
2016-01-04 23:29:18 (83.6 MB/s) - `/tmp/firefox-latest.tar.bz2' saved [52525181/52525181]
travis_time:end:0dff0345:start=1451950158289192377,finish=1451950158979104185,duration=689911808
[0Ktravis_fold:end:install_firefox
... then when protractor starts:
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.17.1.120:39697/wd/hub
Browser details:
Platform: LINUX
Browser Name: firefox
Browser Version: 31.0
I have a sneaking suspicion that even though the Travis docs says the addon section installs the file too, there is no indication this actually happens so I don't think it does.
For interests sake, this is how we print out the system information when protractor starts:
this.getBrowserCapabilities = function() {
return browser.getCapabilities().then(function (s) {
var browserCapabilities = {
browserName: '',
browserVersion: '',
platform: ''
};
browserCapabilities.platform = s.caps_.platform;
browserCapabilities.browserName = s.caps_.browserName;
browserCapabilities.browserVersion = s.caps_.version;
return browserCapabilities;
});
};
I stumbled over the same issue myself and I can confirm that Travis only downloads the specified firefox version.
This is what I did in my build script to use the downloaded version (in my example 43.0).
First, configure the addon in your .travis.yml file:
addons:
firefox: "43.0"
Now before runing your tests execute these steps:
echo "Extracting firefox and setting PATH variable..."
tar -xjf /tmp/firefox-43.0.tar.bz2 --directory /tmp
export PATH="/tmp/firefox:$PATH"
echo "Using firefox version `firefox --version`"
For a working example see also:
https://github.com/astehlik/typo3-extension-news_richteaser/blob/master/.travis.yml
I'm using Selenium in my case but I guess it should work no different with protractor.