I want to run tests without the browser pop-up.Installed wct-headless and configured wct.config.json as shown
{
"plugins": {
"local": {
"disabled": true
},
"headless": {
"browsers": [
"chrome",
"firefox"
],
"browsersOptions": {
"chrome": [
"headless",
"disable-gpu",
"no-sandbox"
],
"firefox": [
"--headless"
]
}
},
"sauce": false,
"xunit-reporter": {
"output": "testfile.xml"
}
}
}
While executing polymer test, it gives following error
Could not find WCT plugin named "headless"
package.json
"dependencies": {
"#polymer/polymer": "^3.0.0"
},
"devDependencies": {
"#polymer/iron-demo-helpers": "^3.0.0-pre.19",
"#webcomponents/webcomponentsjs": "^2.0.0",
"wct-browser-legacy": "^1.0.0",
"wct-headless": "^2.2.2",
"web-component-tester": "^6.8.0",
"wct-xunit-reporter": "1.0.2"
}
How should i configure wct.conf.json ??
No need to install wct-headless. Just create file wct.conf.json with the following content:
{
"plugins": {
"local": {
"browsers": [
"chrome",
"canary",
"firefox"
],
"browserOptions": {
"chrome": [
"headless",
"disable-gpu",
"start-maximized",
"user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3239.108 Safari/537.36'"
],
"canary": [
"headless",
"disable-gpu",
"start-maximized",
"user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3239.108 Safari/537.36'"
],
"firefox": [
"-headless"
]
} // browserOptions
} // local
} // plugins
}
Related
I have an application in Angular with PWA configured, besides caching assets/images I would also like to cache the images that are in Firebase Storage once they are loaded when I am Online.
My application makes use of the Cloud Firestore database with data persistence enabled. When I need to load the avatar of the authenticated user on the system in offline mode, it tries to load through the photoURL field, but since it is offline I can not load the image so the image is not displayed and this is not legal for the user.
In my code I load the image as follows:
<img class="avatar mr-0 mr-sm-16" src="{{ (user$ | async)?.photoURL || 'assets/images/avatars/profile.svg' }}">
I would like it when it was offline, it would search somewhere in the cache for the image that was uploaded.
It would be very annoying every time I load the images to call some method to store the cached image or something, I know it is possible but I do not know how to do that.
Is it possible to do this through the ngsw-config.json configuration file?
ngsw-config.json:
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
],
"urls": [
"https://fonts.googleapis.com/css?family=Muli:300,400,600,700"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}
Yes, it's possible, I tried and works for me, I have a pwa with ionic and angular 7, in my 'ngsw-config.json' I used this config:
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}],
"dataGroups": [{
"name": "api-freshness",
"urls": [
"https://firebasestorage.googleapis.com/v0/b/mysuperrpwapp.appspot.com/"
],
"cacheConfig": {
"maxSize": 100,
"maxAge": "180d",
"timeout": "10s",
"strategy": "freshness"
}
}]
}
In this article is well explained how works and what strategies you can use.
https://medium.com/progressive-web-apps/a-new-angular-service-worker-creating-automatic-progressive-web-apps-part-1-theory-37d7d7647cc7
It was very important in testing to have a valid https connection for the 'service_worker' starts. Once get offline, you can see that the file comes from "service_worker"
Test img _ from service_worker
just do
storage.ref("pics/yourimage.jpg").updateMetatdata({ 'cacheControl': 'private, max-age=15552000' }).subscribe(e=>{ });
and in your ngsw-config.json
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
],
"url":[
"https://firebasestorage.googleapis.com/v0/b/*"
]
}
}
I'm trying to compile c++ inside VS Code.
I have MinGW installed.
I've followed the steps in this video: https://www.youtube.com/watch?v=rFdJ68WbkdQ
And the steps at the "getting started" docs https://code.visualstudio.com/docs/languages/cpp
Actually, my config shows like this:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/include/*",
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/atlmfc/include/*",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared",
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt",
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}",
"C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include\\c++",
"C:\\MinGW\\bin"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
And the "tasks.json" file has the following:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": [
"-g", "Calculator.cpp", "-o","Calculator"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher":"$gcc"
}
]
}
But when I hit "run main task" it prompts:
"> Executing task: g++ -g Calculator.cpp -o Calculator <
'g++' is not recognized as an internal or external command,
operable program or batch file.
The terminal process terminated with exit code: 1"
How can I get gcc detected?
I'm using VS Code with Windows 10 machine BTW.
If you have not added the folder path to windows, try that first.
If that still does not work try adding the full path in "task.json" instead of just g++.
Something like this:
C:/MinGW/bin/g++
I'm trying to create node with following configurations:
java -Dwebdriver.chrome.driver=/randomfolder/chromedriver -jar selenium-server-standalone-3.4.0.jar -role node -nodeConfig node-conf.json
As you see I'm passing config in a json file. It sets the configurations correctly, except the chromeOptions. I need chrome to be opened headless. This is a part of my .json file, which sets the capabilities.
"capabilities": [
{
"browserName":"chrome",
"maxInstances":3,
"version":"ServerLinux",
"platform":"LINUX",
"chromeOptions": {
"args": ["--headless", "--disable-gpu" , "--window-size=1920x1080", "--no-sandbox"]
}
}
]
I've tried different ways of writing the chromeOptions, but node keeps constantly ignoring them. Am I just blind and don't see my mistake?
Thanks in advance!
I am also facing this issue, but in my case, I want to modify the user agent, and on Linux, chromeOptions just seems to be ignored. This is working for me locally on Mac/Chrome.
//wdio.conf.js
capabilities: [{
browserName: "chrome",
chromeOptions : {
args : ['--user-agent=THIS_IS_A_TEST']
}
}],
//Jenkins job on Linux RHEA
13:42:33 [11/10/2018 13:42:33.049] [LOG] browser.desiredCapabilities = {
13:42:33 "javascriptEnabled": true,
13:42:33 "locationContextEnabled": true,
13:42:33 "handlesAlerts": true,
13:42:33 "rotatable": true,
13:42:33 "browserName": "chrome",
13:42:33 "acceptInsecureCerts": true,
13:42:33 "chromeOptions": {
13:42:33 "args": [
13:42:33 "--user-agent=THIS_IS_A_TEST",
13:42:33 "window-size=1600,1200"
13:42:33 ]
13:42:33 },
13:42:33 "loggingPrefs": {
13:42:33 "browser": "ALL",
13:42:33 "driver": "ALL"
13:42:33 }
13:42:33 }
13:42:33 [11/10/2018 13:42:33.072] [LOG] printNavigatorUserAgent() navigator.userAgent = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36
Expected: printNavigatorUserAgent() navigator.userAgent = THIS_IS_A_TEST
printNavigatorUserAgent(){
let result = browser.execute(function() {
return navigator.userAgent;
},);
console.log(`printNavigatorUserAgent() navigator.userAgent = ${result.value}`);
}
Update: The following syntax is currently working for me on Linux/chrome.
//wdio.conf.js
capabilities: [{
browserName: "chrome",
"goog:chromeOptions" : {
"args" : ['user-agent=THIS_IS_A_TEST']
}
}],
A "try and guess" for the right JSON syntax is time consuming, and the schema might change anyway. The safest option is to pick the API for your language of choice, then assemble and generate the JSON yourself. Make sure to pick the version matching the Selenium site and stack you are targeting.
Example with Python:
from selenium.webdriver.chrome.options import Options as ChromeOptions
options = ChromeOptions()
options.add_argument('--incognito')
options.to_capabilities()
and that will look like:
{
'browserName': 'chrome',
'version': '',
'platform': 'ANY',
'goog:chromeOptions': {
'extensions': [],
'args': ['--incognito']
}
}
As a final note, if your site is bringing in a capabilities list of its own, this override and that one might get merged, so bring in your deltas only to avoid surprises.
Delivery method is Post with a secret;
Delivery url: www.domain2.com/wc_back.php.
The data is json:
{
"order":{
"id":623,
"order_number":623,
"order_key":"wc_order_57224dc67c4ec",
"created_at":"2016-04-28T17:52:06Z",
"updated_at":"2016-04-28T17:52:06Z",
"completed_at":"2016-04-28T17:52:06Z",
"status":"on-hold",
"currency":"USD",
"total":"23.00",
"subtotal":"23.00",
"total_line_items_quantity":1,
"total_tax":"0.00",
"total_shipping":"0.00",
"cart_tax":"0.00",
"shipping_tax":"0.00",
"total_discount":"0.00",
"shipping_methods":"",
"payment_details":{
"method_id":"bacs",
"method_title":"u4ebau6c11u5e01u4ed8u6b3euff08u5faeu4fe1/u652fu4ed8u5b9duff09",
"paid":false
},
"billing_address":{
"first_name":"test",
"last_name":"test",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"US",
"email":"test#163.com",
"phone":""
},
"shipping_address":{
"first_name":"test",
"last_name":"test",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"US"
},
"note":"",
"customer_ip":"192.200.194.126",
"customer_user_agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36",
"customer_id":0,
"view_order_url":"http://www.domain.com/my-account/view-order/623",
"line_items":[
{
"id":151,
"subtotal":"23.00",
"subtotal_tax":"0.00",
"total":"23.00",
"total_tax":"0.00",
"price":"23.00",
"quantity":1,
"tax_class":null,
"name":"u5251u7075u7f8eu670du91d1u5e01100G",
"product_id":26,
"sku":"bnsus100g",
"meta":[
]
}
],
"shipping_lines":[
],
"tax_lines":[
],
"fee_lines":[
],
"coupon_lines":[
],
"customer":{
"id":0,
"email":"test#163.com",
"first_name":"test",
"last_name":"test",
"billing_address":{
"first_name":"test",
"last_name":"test",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"US",
"email":"test#163.com",
"phone":""
},
"shipping_address":{
"first_name":"test",
"last_name":"test",
"company":"",
"address_1":"",
"address_2":"",
"city":"",
"state":"",
"postcode":"",
"country":"US"
}
}
}
}
I receive the data on another website www.domain2.com/wc_back.php.
I don't know how, and I need someone help me to make it.
I want to receive the data stored into a txt file as formatted json variables.
If you need a recompense, we can negotiate it.
manifest:
{
"name": "jQuery DOM",
"version": "1",
"manifest_version": 2,
"description": "Manipulate the DOM when the page is done loading",
"background_page": "background.html",
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
"content_scripts": [ {
"js": [ "jquery.min.js", "background.js" ],
"matches": [ "http://*/*", "https://*/*"]
}]
}
background.js:
var time = new Date().getTime();
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","https://api.twitter.com/oauth/request_token",true);
xmlhttp.setRequestHeader("oauth_callback","http://127.0.0.1:81");
xmlhttp.setRequestHeader("oauth_consumer_key","1xFLKhdwNEz3xfXXXXXXXXXXX");
xmlhttp.setRequestHeader("oauth_nonce",time);
xmlhttp.setRequestHeader("oauth_signature_method","HMAC-SHA1");
xmlhttp.setRequestHeader("oauth_timestamp",time);
xmlhttp.setRequestHeader("oauth_version","1.0");
xmlhttp.send();
request header:
:host:api.twitter.com :method:POST :path:/oauth/request_token
:scheme:https :version:HTTP/1.1 accept:/ accept-encoding:gzip,
deflate accept-language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
content-length:0 cookie:pid="v3:14..........
oauth_callback:http://127.0.0.1:81
oauth_consumer_key:1xFLKhdwNEz3xfXXXXXXXXXXX oauth_nonce:1424942962828
oauth_signature_method:HMAC-SHA1 oauth_timestamp:1424942962828
oauth_version:1.0 origin:http://127.0.0.1:81
referer:http://127.0.0.1:81/ user-agent:Mozilla/5.0 (Windows NT 6.1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115
Safari/537.36
Any solution??? or I just fill in the parameter with wrong value
or wrong parameter
or wrong request method
or chrome extension issues???
My suggestion would be to add permissions for certain website in your manifest.json. This worked for me for a similar issue.
For example:
"permissions": [
["<all_urls>"]
],