In my react project I am using nightwatch for testing. After nightwatch version upgrade from 1.7 -> 2.0 everything is working fine locally(As a side comment everything was working fine on previous 1.7 version as well and had same config I wrote below), but once I push my changes I see that tests are failing in circleci and main reason is that chromdriver can't start. Those are errors I see:
Failed to connect to ChromeDriver on localhost with port 9515
WebDriverError: An error occurred while creating a new ChromeDriver session: [WebDriverError] unknown error: Chrome failed to start: exited abnormally
This is my nightwatch config:
const chrome = require('chromedriver');
module.exports = {
src_folders: ['./tests/e2e/specs'],
test_settings: {
default: {
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--no-sandbox',
'--headless',
],
mobileEmulation: {
'deviceName': 'iPhone 6/7/8',
},
},
},
filter: '**/*.spec.js',
},
},
webdriver: {
port: 9515,
server_path: chrome.path,
start_process: true,
},
};
Any thoughts?
Thank you!
Related
I'm having a problem when running next build on my local machine (Windows 10) the command builds the app successfully
But when doing so on my server (running on linux 4.18.0-372.9.1.1.lve.el8.x86_64 the build hangs indefinitely, this was tested on my current project, I've also tried testing on a new project created on the linux server and got the same issue
I tried skipping linting and type checks from next.config.js but it still hangs
I noticed this process running while the app is "building", might be the source of the issue but I'm not sure
I might also be missing some dependencies that I am not aware of, any ideas?
Edit (1)
// next.config.js
/** #type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
distDir: "./build",
images: {
remotePatterns: [
{
protocol: "http",
hostname: "localhost",
port: "1337",
pathname: "/uploads/**",
},
{
protocol: "http",
hostname: "127.0.0.1",
port: "1337",
pathname: "/uploads/**",
},
],
},
async redirects() {
return [
{
source: "/news",
destination: "/",
permanent: false,
},
];
},
};
const withBundleAnalyzer = require("#next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer(nextConfig);
Edit (2)
While the app is building, the cpu usage shoots between 92% and 100%, without building it rests at 14%
Is there a way to bypass running tests with jest while building?
We are making a desktop app with Electron using AngularJS, we want to make end-to-end tests using Protractor, the problem is that we got issues on running it, we don't really know what is the problem but looks like there is some synchronization problems, like it's not waiting for the page to load, not closing the app after the test is finished.
Here is the protractor configuration file:
const ELECTRON_PATH = '/usr/bin/electron';
const APP_PATH = '/home/me/project/myapp';
exports.config = {
directConnect: true,
framework: 'mocha',
specs: [
'test.js'
],
capabilities: {
browserName: 'chrome',
platform: 'LINUX',
chromeOptions: {
binary: ELECTRON_PATH,
args: ['app=' + APP_PATH, '--e2e-testing']
}
},
onPrepare: function() {
browser.ignoreSynchronization = true;
browser.resetUrl = 'file://';
}
};
We are getting a timeout error after our protractor tests have completed.
Error updating Sauce pass/fail status: 'Could not send request: connect ETIMEDOUT
We have tried adding these to the onComplete function in our conf.js:
browser.driver.quit(), browser.driver.stop(), and different forms like this. None seem to be stopping the web driver. for the stop() function we are obviously receiving the error that the function DNE. For the browser.driver.quit(), we are receiving the timeout still. How do we stop the webdriver?
My protractor version: Version 3.3.0
My Complete conf.js:
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
tunnelIdentifier: process.env.SAUCE_TUNNELL_IDENTIFIER,
webDriverProxy: 'my-companies-proxy',
specs: ['e2e/*spec.js'],
framework: 'jasmine2',
onPrepare: function(){
var caps = browser.getCapabilities()
},
multiCapabilities: [{
browserName: 'chrome',
version: '41',
platform: 'Windows 7',
name: "chrome-tests",
shardTestFiles: true,
maxInstances: 25
}],
onComplete: function() {
var printSessionId = function(jobName){
browser.getSession().then(function(session) {
console.log('SauceOnDemandSessionID=' + session.getId() + ' job-name=' + jobName);
});
}
printSessionId("Protractor Tests");
browser.driver.quit();
}
}
I am trying to setup intern testing for my angularjs app that has ngTable dependency.
So my test file for AccountController:
define([
'intern/chai!expect',
'intern!bdd',
'intern/order!nonNgDependencies/non-angular-dependencies.min.js',
'intern/order!angular/angular',
'intern/order!angular-mocks/angular-mocks',
'intern/order!ui.router/release/angular-ui-router',
'intern/order!ngResource/angular-resource',
'intern/order!bower_components/ng-table/dist/ng-table.js',
'intern/order!im/app',
'intern/order!im/account/AccountService',
'intern/order!im/account/AccountController'
], function (expect, bdd) {
function inject (fn) {
return function () {
angular.injector(['ng', 'ngMock', 'ui.router', 'ngTable', 'IntegrationManager']).invoke(fn);
}
}
bdd.describe('AccountController', function () {
var ctrl, scope;
bdd.beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
ctrl = $controller('AccountController', { $scope: scope });
}));
bdd.it('should return true', function () {
expect(scope.isTrue()).to.true;
});
bdd.it('should not have Accounts to start', function () {
expect(scope.accounts).to.be.undefined;
});
});
});
My internjs config file:
// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
define({
// The port on which the instrumenting proxy will listen
proxyPort: 9000,
// A fully qualified URL to the Intern proxy
proxyUrl: 'http://localhost:9000/',
// Default desired capabilities for all environments. Individual capabilities can be overridden by any of the
// specified browser environments in the `environments` array below as well. See
// https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and
// https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities.
// Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment
// automatically
capabilities: {
'selenium-version': '2.41.0'
},
// Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
// OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
// capabilities options specified for an environment will be copied as-is
environments: [
// { browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' },
// { browserName: 'internet explorer', version: '10', platform: 'Windows 8' },
// { browserName: 'internet explorer', version: '9', platform: 'Windows 7' },
// { browserName: 'firefox', version: '28', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] },
{ browserName: 'chrome', version: '34', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] },
// { browserName: 'safari', version: '6', platform: 'OS X 10.8' },
// { browserName: 'safari', version: '7', platform: 'OS X 10.9' }
],
// Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
maxConcurrency: 3,
// Name of the tunnel class to use for WebDriver tests
tunnel: 'SauceLabsTunnel',
tunnelOptions: {
'username': '*****',
'accessKey': '**********************'
},
// The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo
// loader
useLoader: {
'host-node': 'dojo/dojo',
'host-browser': 'node_modules/dojo/dojo.js'
},
// Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader
// can be used here
loader: {
// Packages that should be registered with the loader in each testing environment
packages: [
{ name: 'im', location: 'js/src' },
{ name: 'angular', location: 'bower_components/angular' },
{ name: 'angular-mocks', location: 'bower_components/angular-mocks' },
{ name: 'ui.router', location: 'bower_components/angular-ui-router' },
{ name: 'ngTable', location: 'bower_components/ng-table/dist' },
{ name: 'ngResource', location: 'bower_components/angular-resource' },
{ name: 'nonNgDependencies', location: 'tests'}
]
},
// Non-functional test suite(s) to run in each browser
suites: [ 'tests/all' ],
// Functional test suite(s) to run in each browser once non-functional tests are completed
functionalSuites: [ /* 'myPackage/tests/functional' */ ],
// A regular expression matching URLs to files that should not be included in code coverage analysis
excludeInstrumentation: /^(?:tests|bower_components|node_modules)\//
});
The error I get when trying to run intern is:
undefined: Failed to load module angular/main from /bower_components/angular/main.js (parent: bower_components/ng-table/dist/ng-table)
Error: Failed to load module angular/main from /bower_components/angular/main.js (parent: bower_components/ng-table/dist/ng-table)
at HTMLScriptElement.handler <__intern/node_modules/dojo/dojo.js:731:13>
No unit test coverage for chrome 34.0.1847.116 on Windows NT
From the error, my guess is that it isn't able to load ngTable, however I am not sure where to start.
Any advice on how to troubleshoot this?
I'm writing an app using Ionic/Angular and testing it with Protractor. I'd like to test it using Sauselabs Appium so I can test the app running natively on the various target platforms. I'm launching Protractor with:
SAUCE_USERNAME=$(SAUCE_USERNAME) SAUCE_ACCESS_KEY=$(SAUCE_ACCESS_KEY) ./node_modules/.bin/protractor protractorConfig.js
But I get this error message:
[launcher] Running 1 instances of WebDriver
[launcher] Error: TypeError: Target browser must be a string, but is <object>; did you forget to call forBrowser()?
My protractorConfig.js looks like:
/* global exports */
/* global process */
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
capabilities: {
appiumVersion: "1.0",
app: "sauce-storage:app.zip",
platformName: "iOS",
platformVersion: "7.1",
deviceName: "iPhone Simulator"
},
allScriptsTimeout: 30000,
specs: [
"spec/feature/*.js"
]
};
I should have read the docs more carefully. Appium's documentation for Desired Capabilities says that 'browserName' should be an empty string if you're not targeting a browser.
Updating my protractorConfig accordingly fixes the issue.
/* global exports */
/* global process */
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
capabilities: {
appiumVersion: "1.0",
app: "sauce-storage:app.zip",
platformName: "iOS",
platformVersion: "7.1",
deviceName: "iPhone Simulator",
browserName: ""
},
allScriptsTimeout: 30000,
specs: [
"spec/feature/*.js"
]
};
Try adding of 'browserName': 'chrome' into your capabilities.