I was trying to run a test that had worked the day before and got an error message saying
- Error: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"
I added a console.log("hi") in one of my beforeAll() calls and there was no output in the console, so I suspect the error is that beforeAll() is not invoked for some reason.
I'm using the latest jasmine framework in my conf file and some of my tests run when I don't include the beforeAll(), but not all of them. This test was working fine yesterday and I ran it again today without any changes, so I'm not sure what the problem might be. Does anyone else know?
I'll include my conf.js file and part of the test I'm running.
My conf.js file
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
framework: 'jasmine',
directConnect: true,
allScriptsTimeout: 50000,
rootElement: 'html',
untrackOutstandingTimeouts: true,
// suites: {
//HealthCheck: './specs/Health Check/**.js',
//ContectCheck: './specs/Content Check/**.js',
// },
specs: [
// 'specs/submitFeedback.js',
'specs/createTeacherAndStudentOld.js',
// 'specs/temp.js',
// 'specs/manipTeste.js',
],
capabilities: {
browserName: 'chrome'
},
params: {
screenWidth: 1920,
screenHeight: 1080,
siteURL: 'https://alpha.khmath.com',
marketingSiteURL: 'https://knowledgehook.com',
portalUsername: '',
portalPassword: '',
classRedemptionCode: 'testcode1',
contentCheckCourse: 'Grade 9 Academic',
homeWorkCourse: 'Grade 9 Applied',
gameShowCourse: 'Grade 9 Applied',
term: '2016-2017 Full Year',
gameShowSiteUrl: 'https://alpha.khmath.com/play'
},
jasmineNodeOpts: {
defaultTimeoutInterval: 7200000,
print: function() {}
},
onPrepare: function () {
global.helper = require('./helper.js');
global.completeQuestionHelper = require('./pages/student/completeQuestionHelper.js');
global.fs = require('fs');
global.https = require('https');
global.LoginPage = require('./pages/loginPage.js');
global.RegistrationPage = require('./pages/registrationPage.js');
global.TeacherGameShowPage = require('./pages/teacher/teacherGameShowPage.js');
global.TeacherHomePage = require('./pages/teacher/teacherHomePage.js');
global.TeacherMissionPage = require('./pages/teacher/teacherMissionPage.js');
global.TeacherPurchasePage = require('./pages/teacher/teacherPurchasePage.js');
global.TeacherStudentsPage = require('./pages/teacher/teacherStudentsPage.js');
global.TeacherStudentSummaryPage = require('./pages/teacher/teacherStudentSummaryPage.js');
global.TeacherReportPage = require('./pages/teacher/teacherReportPage.js');
global.StudentHomePage = require('./pages/student/studentHomePage.js');
global.StudentAllSkillsPage = require('./pages/student/studentAllSkillsPage.js');
global.StudentSkillPage = require('./pages/student/studentSkillPage.js');
global.StudentGameplayPage = require('./pages/student/studentGameplayPage.js');
global.StudentMissionPage = require('./pages/student/studentMissionPage.js');
global.StudentPortfolioPage = require('./pages/student/StudentPortfolioPage.js');
global.GameShowStudentGameplayPage = require('./pages/gameshow/gameShowStudentGameplayPage.js');
global.GameShowStudentRegistrationPage = require('./pages/gameshow/gameShowStudentRegistrationPage.js');
global.GameShowTeacherGameplayPage = require('./pages/gameshow/gameShowTeacherGameplayPage.js');
global.loginPage = new LoginPage(browser);
global.registrationPage = new RegistrationPage(browser);
global.teacherGameShowPage = new TeacherGameShowPage(browser);
global.teacherHomePage = new TeacherHomePage(browser);
global.teacherMissionPage = new TeacherMissionPage(browser);
global.teacherPurchasePage = new TeacherPurchasePage(browser);
global.teacherStudentsPage = new TeacherStudentsPage(browser);
global.teacherStudentSummaryPage = new TeacherStudentSummaryPage(browser);
global.teacherReportPage = new TeacherReportPage(browser);
global.studentHomePage = new StudentHomePage(browser);
global.studentAllSkillsPage = new StudentAllSkillsPage(browser);
global.studentSkillPage = new StudentSkillPage(browser);
global.studentGameplayPage = new StudentGameplayPage(browser);
global.studentMissionPage = new StudentMissionPage(browser);
global.studentPortfolioPage = new StudentPortfolioPage(browser);
global.gameShowStudentGameplayPage = new GameShowStudentGameplayPage(browser);
global.gameShowStudentRegistrationPage = new GameShowStudentRegistrationPage(browser);
global.gameShowTeacherGameplayPage = new GameShowTeacherGameplayPage(browser);
global.EC = protractor.ExpectedConditions;
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: true
},
colors: {
enabled: false,
},
prefixes: {
successful: "O ",
failed: "X ",
},
}));
},
};
My spec file
beforeAll(function () {
console.log('hi');
helper.setBrowserParams(browser);
browser.get(browser.params.siteURL);
});
it('should register a teacher and create a premium class', function () {
//Click Register
loginPage.registerBtn.click();
...
`
Related
I have some problem in updating Metaplex NFT Metadata.
I used #metaplex/js and this is my code.
import { programs } from '#metaplex/js';
export const updateMetadataV1 = async () => {
let { metadata : {Metadata, UpdateMetadata, MetadataDataData, Creator} } = programs;
let signer = loadWalletKey(keyfile);
let nftMintAccount = new PublicKey("EC8gGdtVFDoTf3vEGbLvPp7SVWta2xQrs99iWMbaFrdE");
let metadataAccount = await Metadata.getPDA(nftMintAccount);
const metadat = await Metadata.load(solConnection, metadataAccount);
let newUri = "https://arweave.net/my arweave address";
if (metadat.data.data.creators != null) {
const creators = metadat.data.data.creators.map(
(el) =>
new Creator({
...el,
}),
);
let newMetadataData = new MetadataDataData({
name: metadat.data.data.name,
symbol: metadat.data.data.symbol,
uri: newUri,
creators: [...creators],
sellerFeeBasisPoints: metadat.data.data.sellerFeeBasisPoints,
})
const updateTx = new UpdateMetadata(
{ feePayer: signer.publicKey },
{
metadata: metadataAccount,
updateAuthority: signer.publicKey,
metadataData: newMetadataData,
newUpdateAuthority: signer.publicKey,
primarySaleHappened: metadat.data.primarySaleHappened,
},
);
let result = await sendAndConfirmTransaction(solConnection, updateTx, [signer]);
console.log("result =", result);
}
}
The transaction result has no error, it means transaction success.
I checked it on Solana Explorer.
But the metadata doesn't change. What's the matter?
To Solve this issue this code can be used, This is a low-level code that uses the mpl-token-metadata npm package to call the on-chain updateMetadata Function.
import { Wallet } from "#project-serum/anchor";
import * as anchor from "#project-serum/anchor";
import {createUpdateMetadataAccountV2Instruction,DataV2,UpdateMetadataAccountV2InstructionArgs,UpdateMetadataAccountV2InstructionAccounts} from "#metaplex-foundation/mpl-token-metadata"
const fs = require("fs");
(async() => {
// This is the Update Authority Secret Key
const secretKey = fs.readFileSync(
"/Users/pratiksaria/.config/solana/id.json",
"utf8"
);
const keypair = anchor.web3.Keypair.fromSecretKey(
Buffer.from(JSON.parse(secretKey))
);
const endpoint = "https://metaplex.devnet.rpcpool.com/";
const connection = new anchor.web3.Connection(endpoint);
const wallet = new Wallet(keypair);
console.log("Connected Wallet", wallet.publicKey.toString());
const TOKEN_METADATA_PROGRAM_ID = new anchor.web3.PublicKey(
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
);
// You have to enter your NFT Mint address Over Here
const mintKey = new anchor.web3.PublicKey("5iSxT33FyHWsnb8NYSytY17TTXfkFn62FiCyFVFxYhqY");
const [metadatakey] = await anchor.web3.PublicKey.findProgramAddress(
[
Buffer.from("metadata"),
TOKEN_METADATA_PROGRAM_ID.toBuffer(),
mintKey.toBuffer(),
],
TOKEN_METADATA_PROGRAM_ID
);
// BTW DeGods is my FAV collection although i cant afford one 🥲
const updated_data: DataV2 = {
name: "DeGods",
symbol: "DG",
uri: "https://metadata.degods.com/g/4924.json",
sellerFeeBasisPoints: 1000,
creators: [
{
address: new anchor.web3.PublicKey(
"CsEYyFxVtXxezfLTUWYwpj4ia5oCAsBKznJBWiNKLyxK"
),
verified: false,
share: 0,
},
{
address: wallet.publicKey,
verified: false,
share: 100,
},
],
collection: null,
uses: null,
};
const accounts:UpdateMetadataAccountV2InstructionAccounts = {
metadata: metadatakey,
updateAuthority: wallet.publicKey,
}
const args:UpdateMetadataAccountV2InstructionArgs = {
updateMetadataAccountArgsV2: {
data: updated_data,
updateAuthority: wallet.publicKey,
primarySaleHappened: true,
isMutable: true,
}
}
const updateMetadataAccount = createUpdateMetadataAccountV2Instruction(
accounts,
args
);
const transaction = new anchor.web3.Transaction()
transaction.add(updateMetadataAccount);
const {blockhash} = await connection.getLatestBlockhash();
transaction.recentBlockhash = blockhash;
transaction.feePayer = wallet.publicKey;
const signedTx = await wallet.signTransaction(transaction);
const txid = await connection.sendRawTransaction(signedTx.serialize());
console.log("Transaction ID --",txid);
})()
let blockhashObj = await solConnection.getLatestBlockhash();
updateTx.recentBlockhash = blockhashObj.blockhash;
updateTx.sign(alice);
let endocdeTransction = updateTx.serialize({
requireAllSignatures: false,
verifySignatures: false,
});
var signature = await solConnection.sendRawTransaction(endocdeTransction, {
skipPreflight: false,
});
I am using EXCELJS to read data from Excel file . Created a function,allinExcel which returns the column values in promise . As I need 2 columns , I have chained the similar promise functions - allinExcel . In this context , yet times , I get the expected results and yet times I don't ,which is ambiguous . The ProExcel file consists of 2 columns .The expected result from the below code is 2 arrays which includes each of the column contents . Any help in this is very much useful.
The expected result is [ <1 empty item>, 'GEL', 'BEL', 'HEL', 'SEL' ] [ <1 empty item>, 55, 555, 66, 666 ]
But if I get a column value using a single promise , I get the result every time without any ambiguity .
describe("Excel Read ",function(){
function allinExcel(colNum){
var Excel = require('exceljs');
var workbook = new Excel.Workbook();
var excelFilePath = "ExcelData/ProExcel.xlsx"
return workbook.xlsx.readFile(excelFilePath).then(function() {
var worksheet=workbook.getWorksheet('Sheet1');
return worksheet.getColumn(colNum+1).values
},function(error){
console.log(error)
return fail
})
}
it("Excel Operation",function(){
allinExcel(0).then(function(col0){
allinExcel(1).then(function(col1){
console.log(col1,col0)
})
})
})
The following is the conf.js file
// conf.js
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
getPageTimeout:20000, // browser.get timeout
allScriptsTimeout: 360000, // Time to load the DOM
jasmineNodeOpts: {defaultTimeoutInterval: 50000}, //For individual it
framework: 'jasmine',
capabilities: {
'browserName': 'chrome',
chromeOptions: {
args: [
'--start-maximized','disable-infobars'//,'--headless'
]
}
},
onPrepare: function() {
global.EC = protractor.ExpectedConditions,
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
savePath: 'target/reports',
screenshotsFolder: 'images',
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true,
fixedScreenshotName: false,
fileName: 'currentRun',
cleanDestination: true
})
);
},
jasmineNodeOpts: {
showColors: true, // Use colors in the command line report.
},
specs: ['specs/WebTables.js'],
};
Please try your function and code in a javascript file without using protractor to see your code can work well or not.
Create a temp folder
New a file with name: test.js in the temp folder, and copy following code into the file.
Copy the excel ProExcel.xlsx into the temp folder
Open an cmd window and enter the temp folder
Run node test.js in cmd window
// test.js
function allinExcel(colNum) {
var Excel = require('exceljs');
var workbook = new Excel.Workbook();
var excelFilePath = "ProExcel.xlsx"
return workbook.xlsx.readFile(excelFilePath).then(function () {
var worksheet = workbook.getWorksheet('Sheet1');
return worksheet.getColumn(colNum + 1).values
}, function (error) {
console.log(error)
return fail
})
}
[1, 2, 3, 4, 5, 6, 7].forEach(function (it, index) {
allinExcel(0).then(function (col0) {
allinExcel(1).then(function (col1) {
console.log('\n#### ' + index)
console.log(col0, col1)
})
})
})
If you can't get same result in each loop, change your nodejs version(I used v10.9.0).
If you can get same result in each loop, the problem comes from Protractor side.
Add return for each nested function for then(), run again.
it("Excel Operation",function(){
allinExcel(0).then(function(col0){
return allinExcel(1).then(function(col1){
return console.log(col1,col0)
})
})
})
I'm new in Seneca. I have been trying to make two microservices to communicate each other but I keep failing and get this errors:
Error: Response Error: 404 Not Found
at module.exports.internals.Utils.internals.Utils.handle_response (c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\seneca-transport\lib\transport-utils.js:71:11)
at c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\seneca-transport\lib\http.js:154:25
at read (c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\wreck\lib\index.js:590:24)
at finish (c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\wreck\lib\index.js:398:20)
at wrapped (c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\hoek\lib\index.js:879:20)
at module.exports.internals.Recorder.onReaderFinish (c:\Users\Actiview\Desktop\microservices\orderManager\node_modules\wreck\lib\index.js:449:16)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at module.exports.internals.Recorder.emit (events.js:208:7)
at finishMaybe (_stream_writable.js:614:14)
=== SENECA FATAL ERROR === MESSAGE: ::: seneca: Action failed: Response Error: 404 Not Found. CODE: ::: act_execute INSTANCE :::
Seneca/pcbyi7v5c76v/1534346071465/6536/3.7.0/- DETAILS ::: {
message: 'Response Error: 404 Not Found',
pattern: '',
fn: { [Function: transport_client] id: 'host:127.0.0.2,pg:,port:8080' },
callback:
{ [Function: bound action_reply]
seneca:
Seneca {
'private$':
{ act:
{ parent:
{ start: 1534346071559,
end: 1534346071561, and more...
this is my code:
orderIndex.ts
{
const orderPlugin = require('./orderManagerPlugin');
const express = require('express');
const SenecaWeb = require('seneca-web');
const seneca = require("seneca")();
let bodyParser = require('body-parser');
var Routes = [{
prefix: '/orders',
pin: 'area:order,action:*',
map: {
fetch: { GET: true },
create: { GET: false, POST: true },
delete: { GET: false, DELETE: true },
}
}]
var config = {
routes: Routes,
adapter: require('seneca-web-adapter-express'),
context: express().use(bodyParser.urlencoded({ 'extended': 'true' })).use(bodyParser.json()),
options: {parseBody: false}
}
seneca.use(SenecaWeb,config);
seneca.use( orderPlugin );
seneca.ready(function (err) {
const app = seneca.export('web/context')();
app.listen({ host: "127.0.0.4", port: 8081 });
});
}
orderPlugin.ts
{
var plugin = function orderPlugin(options) {
var seneca = this;
var senecaEmailer;
seneca.add({ area: "order", action: "fetch" }, function (args,
done) {
var orders = this.make("orders");
orders.list$({ id: args.id }, done);
});
seneca.add({ area: "order", action: "delete" }, function (args,
done) {
var orders = this.make("orders");
orders.remove$({ id: args.id }, function (err) {
done(err, null);
});
});
seneca.add({ area: "order", action: "create" }, function (args,
done) {
console.log('create order');
senecaEmailer.act( 'role:web', {area: 'email', action:'send'} , done);
});
this.add( { init: "orderPlugin" }, function (args, done) {
senecaEmailer = require("seneca")().client({ host: "127.0.0.2", port: 8080 });
done();
});
}
module.exports = plugin;
}
emailIndex.ts
{
const mailPlugin = require('./emailingPlugin');
const express = require('express');
const SenecaWeb = require('seneca-web');
const seneca = require("seneca")();
let bodyParser = require('body-parser');
var Routes = [{
prefix: '/emails',
pin: 'area:email, action:*',
map: {
send: { GET: true },
}
}]
var config = {
routes: Routes,
adapter: require('seneca-web-adapter-express'),
context: express().use(bodyParser.urlencoded({ 'extended': 'true' })).use(bodyParser.json()),
options: {parseBody: false}
}
seneca.use(SenecaWeb,config);
seneca.use( mailPlugin );
seneca.ready(function (err) {
const app = seneca.export('web/context')();
app.listen({ host: "127.0.0.2", port: 8080 } );
});
}
emailPlugin.ts
{
import {EmailService} from './emailService';
var plugin = function emailPlugin(options) {
var seneca = this;
let mailer :EmailService ;
seneca.add({area: "email", action: "send"}, function(args, done) {
mailer.sendMail('guzon56#gmail.com', done);
});
this.add( { init: "emailPlugin" }, function (args, done) {
console.log('before init');
mailer = require('./emailService')();
console.log('after init');
done();
});
};
module.exports = plugin;
}
please help me.
Tnx.
Seneca is explained by Richard Rodger in this post. The chapter "Service Discovery" talks about meshing the microservices in a network.
For my applications I use the seneca-mesh plugin. This plugin README says:
To join the network, all a service has to do is contact one other
service already in the network. The network then shares information
about which services respond to which patterns. There is no need to
configure the location of individual services anywhere.
Reading Richard's post and the plugin documentation could be a good starting point for your project. Hope it helps!
I am trying to get Nightwatch's inbuilt parallel test_workers working with browserstack-local for local url testing.
When running tests without browserstack local, Nightwatch test_workers seem to work just fine. The same is true for running local tests without test_workers enabled.
I have tried the examples found here https://github.com/browserstack/nightwatch-browserstack but none of these uses browserstack-local in combination with Nightwatch test_workers.
When running locally with test_workers I get the following output.
Connecting local
Connected. Now testing...
Process terminated with code 0.
Has anyone else encountered similar issues?
EDIT: I have since resolved this issue and have posted an answer below
I have dumped the relevant configuration files below.
My local.conf.js
nightwatch_config = {
globals_path: 'globals.js',
output_folder: false,
src_folders: ['tests'],
selenium: {
'start_process': false,
'host': 'hub-cloud.browserstack.com',
'port': 80
},
test_workers: {
"enabled": true,
"workers":2
},
test_settings: {
default: {
desiredCapabilities: {
'browserstack.user': process.env.BROWSERSTACK_USER,
'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY,
'browserstack.local': true,
'browserstack.debug': false,
}
}
}
};
// Code to copy seleniumhost/port into test settings
for (let i in nightwatch_config.test_settings) {
if (nightwatch_config.test_settings.hasOwnProperty(i)) {
let config = nightwatch_config.test_settings[i];
config['selenium_host'] = nightwatch_config.selenium.host;
config['selenium_port'] = nightwatch_config.selenium.port;
}
}
module.exports = nightwatch_config;
local.runner.js
#!/usr/bin/env node
var Nightwatch = require('nightwatch');
var browserstack = require('browserstack-local');
var bs_local;
process.env.BROWSERSTACK_ID = new Date().getTime();
try {
process.mainModule.filename = "./node_modules/.bin/nightwatch";
// Code to start browserstack local before start of test
console.log("Connecting local");
Nightwatch.bs_local = bs_local = new browserstack.Local();
bs_local.start({ 'key': process.env.BROWSERSTACK_ACCESS_KEY }, function (error) {
if (error) throw error;
console.log('Connected. Now testing...');
Nightwatch.cli(function (argv) {
Nightwatch.CliRunner(argv)
.setup(null, function () {
// Code to stop browserstack local after end of parallel test
bs_local.stop(function () { });
})
.runTests(function () {
// Code to stop browserstack local after end of single test
bs_local.stop(function () { });
});
});
});
} catch (ex) {
console.log('There was an error while starting the test runner:\n\n');
process.stderr.write(ex.stack + '\n');
process.exit(2);
}
and my package.json script
node ./local.runner.js -c ./local.conf.js
The issue here was due to the module filename being incorrectly defined in the local.runner.js
process.mainModule.filename = "./node_modules/.bin/nightwatch";
should be pointed directly at the Nightwatch file in its directory.
process.mainModule.filename = "./node_modules/nightwatch/bin/nightwatch";
The difference in these files and the exact reason for this solution working are beyond me.
The answer was derived from the "suite" runner in https://github.com/browserstack/nightwatch-browserstack
It seems you are not specifying browsers. Modify your configuration file to be inline with the following configuration file:
var browserstack = require('browserstack-local');
nightwatch_config = {
src_folders : [ "local" ],
selenium : {
"start_process" : false,
"host" : "hub-cloud.browserstack.com",
"port" : 80
},
test_workers: {
"enabled": true,
"workers":2
},
common_capabilities: {
'browserstack.user': process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
'browserstack.key': process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
'browserstack.debug': true,
'browserstack.local': true
},
test_settings: {
default: {},
chrome: {
desiredCapabilities: {
browser: "chrome"
}
},
firefox: {
desiredCapabilities: {
browser: "firefox"
}
},
safari: {
desiredCapabilities: {
browser: "safari"
}
}
}
};
// Code to support common capabilites
for(var i in nightwatch_config.test_settings){
var config = nightwatch_config.test_settings[i];
config['selenium_host'] = nightwatch_config.selenium.host;
config['selenium_port'] = nightwatch_config.selenium.port;
config['desiredCapabilities'] = config['desiredCapabilities'] || {};
for(var j in nightwatch_config.common_capabilities){
config['desiredCapabilities'][j] = config['desiredCapabilities'][j] || nightwatch_config.common_capabilities[j];
}
}
module.exports = nightwatch_config;
Im using Protractor for E2E testing. During automation, I need to download files to C:\Automation folder in my system. But below code is not working.
Note:During automation execution,The Save as popup opens(but i have to disable that in future) and I manually click "Save" option. It saves in default location ie Downloads folder.How do I make it save in my given path.
let profile = require('firefox-profile');
let firefoxProfile = new profile();
//_browser = 'chrome';
_browser = 'firefox';
// _browser = 'internet explorer';
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference('browser.download.dir', "C:\\Automation");
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
'browserName': _browser,
'shardTestFiles': false,
'maxInstances': 1,
'acceptInsecureCerts': true,
'moz:firefoxOptions': {
'profile': firefoxProfile
}},
beforeLaunch: function () {...}
}
It looks like you may just be missing a couple of preferences for it to work with firefox. Try adding these and see if that helps.
profile.setPreference( "browser.download.manager.showWhenStarting", false );
profile.setPreference( "browser.helperApps.neverAsk.saveToDisk",
/* A comma-separated list of MIME types to save to disk without asking goes here */ );
this will save to downloads folder inside your project. You can try to tweak it to save to desired folder. You have to specify which types of files are suppose to be downloaded without prompt. JSON and csv are already there.
var q = require('q');
var path = require('path');
var sh = require("shelljs");
var cwd = sh.pwd().toString();
var FirefoxProfile = require('selenium-webdriver/firefox').Profile;
var makeFirefoxProfile = function(preferenceMap) {
var profile = new FirefoxProfile();
for (var key in preferenceMap) {
profile.setPreference(key, preferenceMap[key]);
}
return q.resolve({
browserName: 'firefox',
marionette: true,
firefox_profile: profile
});
};
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'jasmine2',
getMultiCapabilities: function() {
return q.all([
makeFirefoxProfile(
{
'browser.download.folderList': 2,
'browser.download.dir': (path.join(cwd, 'downloads')).toString(),
'browser.download.manager.showWhenStarting': false,
'browser.helperApps.alwaysAsk.force': false,
'browser.download.manager.useWindow': false,
'browser.helperApps.neverAsk.saveToDisk': 'application/octet-stream, application/json, text/comma-separated-values, text/csv, application/csv, application/excel, application/vnd.ms-excel, application/vnd.msexcel, text/anytext, text/plaintext'
}
)
]);
},
allScriptsTimeout: 1000000,
specs: ['./tmp/**/*.spec.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 1000000,
showColors: true
},
onPrepare: function() {
browser.driver.getCapabilities().then(function(caps) {
browser.browserName = caps.get('browserName');
});
setTimeout(function() {
browser.driver.executeScript(function() {
return {
width: window.screen.availWidth,
height: window.screen.availHeight
};
}).then(function(result) {
browser.driver.manage().window().setPosition(0,0);
browser.driver.manage().window().setSize(result.width, result.height);
});
});
}
};