I am just wondering if it is possible to run two different specs at the same time using protractor.
My protractor.config.js is below:
var browserCapabilities = [
{
browserName: 'chrome',
maxInstances: 2,
seleniumAddress: seleniumServer,
platform: 'ANY',
version: 'ANY',
chromeOptions: {
args: ['--no-sandbox', '--test-type=browser', '--lang=en', '--window-size=1680,1050'],
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
},
download: {
prompt_for_download: false,
directory_upgrade: true,
default_directory: 'C:\\downloads\\'
},
},
},
loggingPrefs: { browser: 'SEVERE' }
},
];
// Protractor config
exports.config = {
baseUrl: baseUrl,
directConnect: false,
allScriptsTimeout: 25 * 1000,
jasmineNodeOpts: {
defaultTimeoutInterval: 90 * 1000
},
getPageTimeout: 120 * 1000,
suites: {
adminRoles: 'compiled/artemis/settings/adminAppRoles.scenario.js',
adminUsers: 'compiled/artemis/settings/adminUsers.scenario.js',
benchmarks: 'compiled/artemis/benchmarks/benchmark.scenario.js',
claims: 'compiled/artemis/claims/claims.scenario.js',
cohorts: 'compiled/artemis/cohorts/cohort.scenario.js',
customBD: 'compiled/artemis/dimensions/*.scenario.js',
exploreCreate: 'compiled/artemis/explorations/create.scenario.js',
exploreInMeasureFilters: 'compiled/artemis/explorations/inMeasureFilters.scenario.js',
exploreRead: 'compiled/artemis/explorations/read.scenario.js',
exploreRegFilters: 'compiled/artemis/explorations/regularFilters.scenario.js',
exploreUpdate: 'compiled/artemis/explorations/update.scenario.js',
home: 'compiled/artemis/home/home.scenario.js',
login: 'compiled/artemis/login/*.scenario.js',
mgmtConsole: 'compiled/artemis/settings/mgmtConsoleSysDef.scenario.js',
navigation: 'compiled/artemis/navigation/navigation.scenario.js',
sharing: 'compiled/artemis/sharing/sharingTests.scenario.js',
smoke: 'compiled/artemis/smokeTests/smokeTests.scenario.js',
stories: 'compiled/artemis/story/story.scenario.js',
visualizeCreate: 'compiled/artemis/visualize/visualizeCreate.scenario.js',
visualizeRead: 'compiled/artemis/visualize/visualizeRead.scenario.js',
visualizeUpdate: 'compiled/artemis/visualize/visualizeUpdate.scenario.js',
vizInMeasureFilters: 'compiled/artemis/visualize/vizInMeasureFilters.scenario.js',
vizRegFilters: 'compiled/artemis/visualize/vizRegularFilters.scenario.js',
tritonLogin: 'compiled/triton/login/*.scenario.js',
tritonCustomers: 'compiled/triton/customers/*.scenario.js',
tritonDashboard: 'compiled/triton/dashboard/*.scenario.js'
},
multiCapabilities: browserCapabilities,
framework: 'jasmine2',
onPrepare: function() {
//Set Up a JUnit XML Reporter - Makes a nice test results area and trend graph in Jenkins
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
savePath: 'report',
filePrefix: 'xmloutput'
}));
const JasmineConsoleReporter = require('jasmine-console-reporter');
const consoleReporter = new JasmineConsoleReporter({
colors: 1,
cleanStack: 1,
verbosity: 4,
listStyle: 'indent',
activity: true,
emoji: true,
beep: true
});
//Setup screenshots
jasmine.getEnv().addReporter(screenShotReporter);
jasmine.getEnv().addReporter(consoleReporter);
browser.get(browser.baseUrl);
},
// Setup the report before any tests start
beforeLaunch: function() {
return new Promise(function(resolve) {
screenShotReporter.beforeLaunch(resolve);
});
},
// Close the report after all tests finish
afterLaunch: function(exitCode) {
return new Promise(function(resolve) {
screenShotReporter.afterLaunch(resolve.bind(this, exitCode));
});
},
};
I launch my tests with a command like this:
gulp e2e --suite suiteName --baseUrl http://myurl.com/
I would like to be able to for example launch my login suite and my navigation suite at the same time.
I have tried the maxInstances: 2 in the browserCapabilities variable, but that only launched the login suite.
I have tried doing two instances of the chrome object and then doing maxSessions: 2 but that only launched the login test twice.
I am envisioning a command like this: gulp e2e --suite login --suite navigation --baseUrl http://myurl.com and having it launch both suites simultaneously.
U can use shardTestFiles: true
// ...
capabilities: {
shardTestFiles: true,
maxInstances: 2,
// ...
Related
I am following https://docs.aws.amazon.com/lambda/latest/dg/images-create.html and created an image from an AWS base image for Lambda and tested it locally first before pushing it to ECR. On invoking function locally, I get expected results i.e. Error Code 0. But after pushing image on ECR and invoking it from AWS lambda console, I get following issue.
START RequestId: 55930a26-5d88-4d1f-9a5b-14599b369585 Version: $LATEST
[04:46:19] I/launcher - Running 1 instances of WebDriver
[04:46:19] I/direct - Using ChromeDriver directly...
[04:46:22] E/runner - Unable to start a WebDriver session.
[04:46:22] E/launcher - Error: NoSuchSessionError: invalid session id
at Object.throwDecodedError (/var/task/node_modules/selenium-webdriver/lib/error.js:514:15)
at parseHttpResponse (/var/task/node_modules/selenium-webdriver/lib/http.js:519:13)
at /var/task/node_modules/selenium-webdriver/lib/http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
[04:46:22] E/launcher - Process exited with error code 100
2021-08-11T04:46:22.089Z 55930a26-5d88-4d1f-9a5b-14599b369585 INFO error code: 100
END RequestId: 55930a26-5d88-4d1f-9a5b-14599b369585
REPORT RequestId: 55930a26-5d88-4d1f-9a5b-14599b369585 Duration: 9465.93 ms Billed Duration: 10270 ms Memory Size: 10000 MB Max Memory Used: 314 MB Init Duration: 803.88 ms
My conf.js
exports.config = {
directConnect: true,
ignoreUncaughtExceptions: true,
SELENIUM_PROMISE_MANAGER: false,
'specs': ['index.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 1000 * 6,
realtimeFailure: true,
showColors: true,
isVerbose: true,
includeStackTrace: true,
displaySpecDuration: true,
print: function () {},
},
'capabilities': {
'browserName': 'chrome',
acceptInsecureCerts: true,
acceptSslCerts: true,
chromeOptions: {
binary: "/usr/bin/google-chrome",
"excludeSwitches": [ "enable-automation" ],
"useAutomationExtension": false,
args: ["--no-sandbox","--disable-web-security","--headless","--disable-dev-shm-usage","--disable-extensions", "--disable-gpu", "--start-maximized", "--disable-infobars"]
}
},
framework: "jasmine"
};
My package.json
{
"name": "protractor",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/protractor conf.js",
"runlocal": "node_modules/.bin/sls invoke local --function protractor",
"deploy": "node_modules/.bin/sls deploy"
},
"author": "",
"license": "ISC",
"dependencies": {
"jasmine": "^3.8.0",
"npm": "^6.14.14",
"protractor": "^7.0.0",
"protractor-beautiful-reporter": "^1.3.6"
}
}
My dockerfile
FROM amazon/aws-lambda-nodejs:12
COPY index.js conf.js handler.js package*.json screenshots ./
ADD install-google-chrome.sh .
RUN chmod +x install-google-chrome.sh
RUN curl https://intoli.com/install-google-chrome.sh | bash
ADD gtk-firefox.sh .
RUN chmod 755 gtk-firefox.sh
RUN ./gtk-firefox.sh
RUN npm install
RUN node ./node_modules/protractor/bin/webdriver-manager clean
RUN node ./node_modules/protractor/bin/webdriver-manager update
CMD [ "handler.runtest" ]
handler.js
'use strict';
module.exports.runtest = (event, context, callback) => {
var npm = require('npm');
var path = require('path');
var childProcess = require('child_process');
var args = ['conf.js'];
npm.load(function() {
var child = childProcess
.fork(path.join(npm.root, 'protractor/bin/protractor'), args)
.on('close', function(errorCode) {
console.log('error code: ', errorCode);
// Use this block to have Lambda respond when the tests are done.
const response = {
statusCode: 200,
body: JSON.stringify({
message: `Selenium Test executed on Chrome ! Child process Error Code: ${errorCode}`,
}),
};
callback(null, response);
});
process.on('SIGINT', child.kill);
});
};
index.js
const {by} = require("protractor");
const {protractor} = require("protractor");
const {browser} = require("protractor");
describe('Google\'s Search Functionality', function() {
it('can find search results', async function() {
const signin = "Sign in"
await browser.waitForAngularEnabled(false);
await browser.get('https://google.com/ncr');
await browser.findElement(by.name('q')).sendKeys('BrowserStack', protractor.Key.ENTER);
const texti = browser.findElement(by.xpath('//a[contains(#href,"sign_in")]'));
expect(await texti.getText()).toEqual(signin);
});
});
Al these files are at same level in root project directory.
I googled a lot but not able to find proper resolution. Is it some permission issue?
As I don't understand what makes the same lambda container image fail in lambda console and not in local.
We have written a bunch of e2e tests for an angular4 app, that we are developing. The problem is that I am getting random ECONNREFUSED message from webdriver / chrome, when running automated tests with protractor.
- Failed: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:54657
Protractor is running with shardedtestfiles turned on, and running with 12 browsers in parallel, in order to speed up testing.
I can't pinpoint an exact pattern to the errors that we get, so I am a bit lost here.. Below is a copy of the protractor config file, that we are using.
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
//*global jasmine */
"use strict";
var SpecReporter = require("jasmine-spec-reporter").SpecReporter;
var timeoutSettings = require('./dist/out-tsc/e2e/protractor.config').timeoutSettings
exports.config = {
allScriptsTimeout: 99999,
suites: {
spec: [
"./dist/out-tsc/e2e/spec/**/*spec.js"
]
},
capabilities: {
browserName: "chrome",
maxInstances: 12,
chromeOptions: {
args: ["--no-sandbox", "--disable-infobars", "--start-maximized", "--lang=DA-dk"],
prefs: {
download: {
promt_for_download: false,
default_directory: "spec/downloads" // To Do: Make sure this dir is correct!
},
"profile.password_manager_enabled": false,
credentials_enable_service: false,
password_manager_enabled: false
}
}
},
directConnect: true,
framework: "jasmine",
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 120000,
print: function () {}
},
SELENIUM_PROMISE_MANAGER: false,
useAllAngular2AppRoots: true,
beforeLaunch: function () {
require("ts-node").register({
project: "./e2e/tsconfig.json"
});
},
onPrepare: function () {
browser.manage().timeouts().implicitlyWait(timeoutSettings.implicitWaitNormal);
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
var trx = require("jasmine-trx-reporter");
return browser.getCapabilities().then(function (caps) {
var browserName = caps.get("browserName").toUpperCase();
var jasmineTrxConfig = {
reportName: "Protractor Test Results",
folder: "reports",
outputFile: "",
browser: "GANDALF_" + browserName,
groupSuitesIntoSingleFile: false,
takeScreenshotsOnlyOnFailures: false
};
jasmine.getEnv().addReporter(new trx(jasmineTrxConfig));
});
}
};
It seems that this is actually a problem in the version of selenium webdriver, that is pulled in, when using protractor
There is a discussion in an issue with protractor on github
https://github.com/angular/protractor/issues/4792
I am trying to make task for creating favicon images in GULP like this
var realFavicon = require ('gulp-real-favicon');
var fs = require('fs');
// File where the favicon markups are stored
var FAVICON_DATA_FILE = 'faviconData.json';
// Generate the icons. This task takes a few seconds to complete.
// You should run it at least once to create the icons. Then,
// you should run it whenever RealFaviconGenerator updates its
// package (see the check-for-favicon-update task below).
gulp.task('generate-favicon', function(done) {
realFavicon.generateFavicon({
masterPicture: 'TODO: Path to your master picture',
dest: 'TODO: Path to the directory where to store the icons',
iconsPath: '/',
design: {
ios: {
pictureAspect: 'noChange'
},
desktopBrowser: {},
windows: {
pictureAspect: 'noChange',
backgroundColor: '#da532c',
onConflict: 'override'
},
androidChrome: {
pictureAspect: 'shadow',
themeColor: '#ffffff',
manifest: {
name: 'MyApp',
display: 'browser',
orientation: 'notSet',
onConflict: 'override'
}
},
safariPinnedTab: {
pictureAspect: 'silhouette',
themeColor: '#5bbad5'
}
},
settings: {
scalingAlgorithm: 'Mitchell',
errorOnImageTooSmall: false
},
markupFile: FAVICON_DATA_FILE
}, function() {
done();
});
});
// Inject the favicon markups in your HTML pages. You should run
// this task whenever you modify a page. You can keep this task
// as is or refactor your existing HTML pipeline.
gulp.task('inject-favicon-markups', function() {
gulp.src([ 'TODO: List of the HTML files where to inject favicon markups' ])
.pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
.pipe(gulp.dest('TODO: Path to the directory where to store the HTML files'));
});
// Check for updates on RealFaviconGenerator (think: Apple has just
// released a new Touch icon along with the latest version of iOS).
// Run this task from time to time. Ideally, make it part of your
// continuous integration system.
gulp.task('check-for-favicon-update', function(done) {
var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
realFavicon.checkForUpdates(currentVersion, function(err) {
if (err) {
throw err;
}
});
});
Only problem I have is that i dont have faviconData.json can somebody share his, txanks
You should go back to Real Favicon Generator and follow the installation steps. Basically:
Replace the "TODO" in the generated code with actual paths.
Run gulp generate-favicon. This once-in-a-while task generates your icons and also the faviconData.json file you miss. For example this file contains the HTML markups that declare the icons.
Now you are ready to run gulp inject-favicon-markups whenever you deploy your site, update one of your pages, etc.
"favicons": {
"files": {
"src": "./dist/img/logo/favicon.png",
"dest": "./dist/img/favicons/",
"html": "./templates/misc/favicons.tpl.php",
"iconsPath": "./dist/img/favicons/",
"androidManifest": null,
"browserConfig": null,
"firefoxManifest": null,
"yandexManifest": null
},
"icons": {
"android": true,
"appleIcon": true,
"appleStartup": true,
"coast": true,
"favicons": true,
"firefox": true,
"opengraph": true,
"windows": true,
"yandex": true
},
"settings": {
"appName": "name",
"appDescription": "This is the app description",
"developer": null,
"developerURL": null,
"version": 1.0,
"background": null,
"index": null,
"url": null,
"silhouette": false,
"logging": true
},
"favicon_generation": null
},
maybe you can use this, you should change the settings of course :)
I need to reload my chart's json store automatically on interval of 2 minutes.
This is my code:
tab = new Ext.Panel({
id: "id-" + node.id,
closable: true,
title: node.attributes.text,
layoutConfig: {
columns: 3
},
defaults: {
frame: true,
height: 230,
border: true
},
items: [
new Ext.chart.LineChart({
store: new Ext.data.JsonStore({
url: 'dashboard/CantServicios',
root: 'cantservicio',
autoLoad: true,
ields: ['NOMBRE_SERVICIO', 'CANT']
}),
xField: 'NOMBRE_SERVICIO',
yField: 'CANT',
width: 840
})
]
});
How can I do that ?
You can do this using Ext.util.TaskRunner
http://docs.sencha.com/extjs/3.4.0/?mobile=/api/Ext.util.TaskRunner
So if you look at the sample in the docs link above you should see that you can easily define a function that just performs a load on your store and then it's just a matter of using that in as the run config option.
i am not able to figure out the problem in the following sencha-touch code i have written.
it shows no errors but still when i run it, it doesn't work. are there any more files or classes that the application requires? i am running it on chrome using a linux machine.
var App = new Ext.application({
requires: [
'Ext.tab.Panel' ,'Ext.List', 'Ext.data.Store', 'Ext.data.Model'
],
name : 'notesapp',
useLoadMask : true,
launch : function () {
Ext.regModel('note',{
idProperty:'id',
fields:[{name :'id', type:'int'},
{name : 'date', type: 'date', dateFormat:'c'},
{name : 'title', type: 'string'},
{name : 'narrative' , type:'string'}],
validations:[{type: 'presence', field: 'id'},
{type: 'presence', field: 'title'} ]
});
Ext.regStore('notestore', {
model:'note',
sorters:[{
property:'date',
direction:'DESC'
}],
proxy:[{
type:'localstorage',
id:'notes-app-local-store'
}],
data: [
{ id: 1, date: new Date(), title: 'Test Note', narrative: 'This is simply a test note' }
]
}
);
var notelist= new Ext.List({
id:'notelist',
store:'notestore',
itemTpl:
'<div class= "list-item-title">{title}</div>'
+ '<div class="list-item-narrative">{narrative}</div>'
});
var noteslisttoolbar = new Ext.Toolbar({
id:'noteslisttoolbar',
title:'MyNotes'
});
var noteslistcontainer= new Ext.Panel({
id:'noteslistcontainer',
layout:'fit',
dockedItems:[noteslisttoolbar],
items:[notelist]
});
this.viewport = new Ext.Panel({
fullscreen: true,
layout:'card',
cardAnimation:'slide',
items:[noteslistcontainer]
});
}
})
your getting an error at
proxy:[{
type:'localstorage',
id:'notes-app-local-store'
}],
please check there..
with out that code sencha app running fine
see http://www.senchafiddle.com/#j2f0i