So i'm trying to run a simple test with Taurus and selenium with chrome driver.
ubuntuXXXXXX$ chromedriver --version
ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72)
ubuntuXXXXXX$ google-chrome --version && which google-chrome
Google Chrome 73.0.3683.103
/usr/bin/google-chrome
error logs:
INFO: Create JUnit 4 request with following arguments: [aws.BookAFlightNew]
Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 28517
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1555756176.632][INFO]: [44084fb1ebc5abbc49f588f6d30790a8] COMMAND InitSession {
"capabilities": {
"alwaysMatch": {
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"firstMatch": [ {
"browserName": "chrome"
} ],
"requiredCapabilities": {
}
},
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [ ],
"extensions": [ ]
}
},
"requiredCapabilities": {
}
}
[1555756176.632][INFO]: Populating Preferences file: {
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"check_default_browser": false
},
"distribution": {
"import_bookmarks": false,
"import_history": false,
"import_search_engine": false,
"make_chrome_default_for_user": false,
"skip_first_run_ui": true
},
"dns_prefetching": {
"enabled": false
},
"profile": {
"content_settings": {
"pattern_pairs": {
"https://*,*": {
"media-stream": {
"audio": "Default",
"video": "Default"
}
}
}
},
"default_content_setting_values": {
"geolocation": 1
},
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
},
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"translate": {
"enabled": false
}
}
[1555756176.632][INFO]: Populating Local State file: {
"background_mode": {
"enabled": false
},
"ssl": {
"rev_checking": {
"enabled": false
}
}
}
[1555756176.632][INFO]: Launching chrome: /usr/bin/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension=/tmp/.com.google.Chrome.gVwWj6/internal --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.S44UB0 data:,
[1555756176.734][INFO]: [44084fb1ebc5abbc49f588f6d30790a8] RESPONSE InitSession ERROR unknown error: Chrome failed to start: exited abnormally
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
[1555756176.734][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1555756176.734][DEBUG]: Log type 'browser' lost 0 entries on destruction
when adding to the config file headless chrome view, test is passed.
What do i miss?
Related
I use NX Workspace with NestJS, and my issue is that every time I save something in the project, the entire program restarts without shutting down the previous app.
How could I restart the server?
This is the project.json file (inside the NestApp)
{
...
},
"configurations": {
"development": {
"optimization": true,
"extractLicenses": false,
"inspect": false
}
}
},
"serve": {
"executor": "#nrwl/js:node",
"options": {
"buildTarget": "server:build"
},
"configurations": {
"development": {
"buildTarget": "server:build:development"
},
}
},
},
"tags": []
}
I currently have a set of nodejs modules (containers) that connect to a local mongodb (also a container).
All modules works perfectly but with one of the I have the following problem:
https://i.stack.imgur.com/xuFqw.png
The connection seems to be accepted by mongo but the client doesn't receive the response and keeps waiting until it times out after 30 second (watch timestamps in the log)
The code of the client is the following:
async function connectToMongo() {
try {
const mongoUrl = 'mongodb://mongo:27017/LocalDB'
let result = await MongoClient.connect(mongoUrl, { useUnifiedTopology: true })
logger.info("Connected to Mongo DB")
return result
} catch (err) {
logger.error("Cannot connect to Mongo - " + err)
throw err
}
}
And is exactly the same as the other modules (that works).
Mongo is started without any settings or authentication.
I have tried using the following hostnames:
mongo : name of the container in which mongo is running
host.docker.internal : to address the host since the 27017 port of the container is binded to the host port
I honestly don't know what to try anymore...does anybody have an idea about what could be the problem?
UPDATE: as requested i'm adding info about how i'm starting the containers. Anyway I have omitted this part because they are started as Azure IoT Edge Modules. Anyway here is the infos from the deployment template:
"modules": {
"mongo": {
"settings": {
"image": "mongodb:0.0.1-replset-noauth",
"createOptions": "{\"HostConfig\":
{\"PortBindings\":{\"27017/tcp\":[{\"HostPort\":\"27017\"}]}}}"
},
"type": "docker",
"version": "1.0",
"status": "running",
"restartPolicy": "always"
},
"healthcheck": {
"settings": {
"image": "${MODULES.HealthCheck.debug}",
"createOptions": {
"HostConfig": {
"PortBindings": {
"9229/tcp": [
{
"HostPort": "9233"
}
]
}
}
}
},
"type": "docker",
"version": "1.0",
"env": {
"MONGO_CONTAINER_NAME": {
"value": "mongo"
},
"MONGO_SERVER_PORT": {
"value": "27017"
},
"DB_NAME": {
"value": "LocalDB"
}
},
"status": "running",
"restartPolicy": "always"
}
},
While this is the configuration of another module that perfectly works:
"shovel": {
"settings": {
"image": "${MODULES.Shovel.debug}",
"createOptions": {
"HostConfig": {
"PortBindings": {
"9229/tcp": [
{
"HostPort": "9229"
}
]
}
}
}
},
"type": "docker",
"version": "1.0",
"env": {
"MONGO_CONTAINER_NAME": {
"value": "mongo"
},
"MONGO_SERVER_PORT": {
"value": "27017"
},
"DB_NAME": {
"value": "LocalDB"
}
},
"status": "running",
"restartPolicy": "always"
},
(it's basically the same)
The modules are currently being launched using the IoT Simulator or on an IoT Edge device as Single Device deployments.
Installed LSP server on Sublime Text 3, then enabled gopls from the LSP: Enable Language Server Globally > selected gopls.
Also executed below command on terminal.
GO111MODULE=on go get golang.org/x/tools/gopls#latest
Error shown:
LSP.sublime-settings
{
"clients":
{
"gopls":
{
"enabled": true
}
}
}
gopls command
❯ which gopls
/home/user/go/bin/gopls
I am using MX Linux. Please help !
Source
This solved the problem.
## LSP.sublime-settings -- User
{
"clients":
{
"gopls":
{
"command": [
"/home/rahulbali/go/bin/gopls",
"-v",
"-rpc.trace",
"-logfile=/home/rahulbali/gopls.log"
],
"enabled": true,
"env": {
"PATH": "home/rahulbali/go/bin:/usr/local/go/bin"
},
"scopes":["source.go"],
"syntaxes": [
"Packages/Go/Go.sublime-syntax",
"Packages/GoSublime/syntax/GoSublime-Go-Recommended.sublime-syntax",
],
"settings": {
"gopls.usePlaceholders": true,
"gopls.completeUnimported": true,
},
"languageId": "go"
}
}
}
Source: https://github.com/golang/go/issues/43746#issuecomment-761760279
Edit: Make 'gopls' is in your shell path.
What sublime text quotes is:
{
"clients": {
"gopls": {
"enabled": true,
"command": ["gopls"],
"selector": "source.go",
"initializationOptions": {
"experimentalWorkspaceModule": false
}
}
}
}
Giving the absolute path (which gopls) to gopls binary should solve the 'not found' problem.
{
"clients": {
"gopls": {
"enabled": true,
"command": ["/Users/xxx/go/bin/gopls"],
"selector": "source.go",
"initializationOptions": {
"experimentalWorkspaceModule": false
}
}
}
}
I have a project in Visual Studio that is using typescript and requirejs, and that is running QUnit tests with the help of Chutzpah.
Folderstructure in my project looks basically like this:
- chutzpah.json
- app/
- index.html
- js/
- config.js
- main.ts
- Module.ts
- tests/
- Test1.ts
up until now, I had requirejs configured so that in all my imports, I had to use
app/js/Module, for example, to load that one.
Tests were also running just fine.
Now, I have changed my requirejs config to use baseUrl of js inside the app folder, so I can use just "Module" for the import. application itself is running fine, but I cannot get the tests to work.
With my current chutzpah.json, it seems that it wants to load the test files from ../tests/, so for the Test1 example, it would want to load ../tests/Test1.js
This is my config.js:
require.config({
baseUrl: 'js',
paths: {
'swfJQ': '../libs/js/swfJQ'
},
shim: {
'swfJQ': {
"exports": "swfJQ"
}
}
});
This is my chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBaseUrl": "js",
"AMDAppDirectory": "app",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/config.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}
This is one of the test files:
import Replay = require('../app/js/Module');
QUnit.module("Module tests");
test("Module.constructor", function (assert: QUnitAssert) { /* stuff */ }
I think the require('../app/js/Module') is more or less the culprit and will set the scope to ../, but if I write the code otherwise, the typescript compiler won't compile.
I guess this is probably something very easy I am missing, but I just can't pin it.
Maybe it is not a chutzpah problem I have, but my general Typescript setup should be different (so I don't have to use require('../app ... ') in my test files)?
Turned out this should have been quite easy:
I had to set the AMDBaseUrl in the Chutzpah config to "app/js", and removing the AMDAppDirectory property.
Can't believe I didn't try that before.
My chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBasePath": "app/js",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/kendo.ui.core.min.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/mediaelement-and-player.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/SCORM_API_wrapper.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}
I have jasmine tests that run through the Chutzpah context menu extension (Run JS tests). However they do not get discovered by the Test Explorer and when I right-click and select Run Tests, the output from "Tests" gives me this:
System.ArgumentException: The directory name is invalid.
at System.IO.FileSystemWatcher..ctor(String path, String filter)
at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.
Here's my chutzpah.json file also:
{
"Framework": "jasmine",
"FrameworkVersion": "2",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"References": [
{ "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
{ "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
{ "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
{ "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
{ "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
{ "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/core.js" },
{ "Path": "prepare.js" },
{ "Path": "engine.js" }
],
"Tests": [
{ "Path": "tests" }
],
"CodeCoverageIncludes": [],
"CodeCoverageExcludes": []
}
Solution structure:
DIB.MemberCatalog
-Testing
- DIB.MemberCatalog.Tests.JS
- data
- lib
- jasmine-2.0.0
- (jasmine files, boot, console, jasmine)
- tests
- testfiles.js
- chutzpah.json
-DIB.MemberCatalog
- (more...)
I've scoured the internet and can't find a solution.
Solved by changing my test project name from DIB.MemberCatalog.Tests.JS to DIB.MemberCatalog.Tests.Client. Confusion happens when the project has the javascript file extension at the end of the project name.