Unable to Open new browser after each scenario in Cucumber-Protractor - protractor

I had automated all my scenarios using cucumber-protractor framework. All this scenarios run fine when executed individually i.e. closes the browser once scenario is complete but when ran together I am unable to open new browser window after each scenario. It just continues in same browser. Due to SSO login, I have to restart browser after each scenario.
I tried using maxSession, maxInstance in protractor but of no help. Though maxIntance opens new browser, it doesn't close old one and neither passes control to new one. I tried using getWindowHandler as well but that also didn't worked.
Any help is greatly appreciated as I am stuck on this for long time.

It seems juliemr answers your question:
tests are sharded by file, not by scenario, so you'll need to split the scenarios into separate files.
https://github.com/angular/protractor/issues/864#issuecomment-45571006
So you'll need to split the scenarios into separate feature files and, if desired, set maxInstances to however many you want to run at once. For example:
capabilities: {
'browserName': 'chrome',
'shardTestFiles': true,
'maxInstances': 10
}

Add a hook after each scenario to close the browser:
this.After(function(scenario, done) {
this.quit(done);
});

Related

Do VSCode webviews support Web Workers?

I'm in the middle of making a vscode extension, noticed some strange interactions when I tried to implement a Dedicated Worker to my extensions webview.
I'm already using the vscode API to pass messages around the extension, however when using a dedicated worker(in the webview) & passing messages around else where in the extension, the web worker somehow gets called.
If I let my web worker send a call back an infinite loop occurs and VSCode crashes. This leaves me to believe that VSCode is actually utilising web workers already? But shouldn't a new dedicated worker be spawned when using new Worker(), regardless of VSCode?
I tried implementing a shared worker, but didn't have any success (no response at all from the SharedWorker), which leaves me to believe that webviews don't support this? Am I right in saying that? Has anyone implemented this before?
I tried finding more information online and on their GitHub issues, but wasn't able to :/
TLDR: Do Webviews in VSCode support web workers?
Yes, you can. I don't know about seperate files, but you can use URL.createObjectUrl() to create a worker. Here is some code that worked for me (inside the webview html).
const blob = new Blob(['self.postMessage("Message from worker")'])
const uri = URL.createObjectURL(blob)
new Worker(uri).addEventListener('message', e => {
console.log(e)
})

Does Katalon support opening webUI and mobile driver in same script

We want to execute a automation test case wherein first operations will happen on WebUI and then it will switch to Mobile execution. The process will be done sequentially. I want to write all script in one testcase itself. First script will execute on Chrome browser then in connected mobile device.I am looking for someone who has achieved this in katalon. I need a solution other than test suite collection.
This can be done by using profiles in katalon :
https://docs.katalon.com/katalon-studio/docs/execution-profile-v54.html
Please also remeber that this is not only profilesbut also enviroment (chrome or mobile). You can use this Execution window as example what eviroment i am talking about.

Get WebdriverIO multi-remote to work with Cucumber BDD

I am able to start multiple browser sessions in a single test using WebDriverIO's multiremote with mocha.
Next I'm trying to get WebDriverIO multiremote work with Cucumber BDD. My feature definition is simply to open a browser session and navigate to a url.
Here's my simple WDIO
Problem - the browser opens up but navigation does not occur. I have tried to enable the debugger and observe node-inspector but hasn't helped. What am I missing? Thanks for all the help.
My goal was to conduct multi-user scenario based testing through BDD. Although I haven't been able to resolve this directly via WebDriverIO I found Chimp (which uses WebDriverIO underneath) has its own flavour of session based automation.
Chimp's multi-browser testing does exactly what I wanted. Problem solved!
I'm able to write scenarios such as this without explicitly switching the user context.
Scenario: Able to browse independently
Given Alice goes to "/features"
And Bob go to "/bugs"
Then Alice sees "10" features
And Bob sees "1" bugs

Zend framework 1 login slow

Generally my application response times are good and pages load quickly. However login, using Zend_Auth with mysql db, takes an age compared to other tasks. I'm wondering has anyone else encountered this?
If not can anyone suggest a good way to debug and find the cause of the slow down?
FYI most pages are rendered under a second after their link is clicked whereas login takes around 7 seconds.
First you need to figure out what is causing slowdown. Add this to your application.ini:
resources.db.setDefaultTableAdapter = 1
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
Then use Firefox+Firebug+FirePHP to see (in Firebug Console) list of all queries. Maybe one of them is really slow? Or maybe you make a lot of them?
Other thing to do is to check Net tab (Firebug) with 'keep changes' turned on to see if you don't make too many redirects or maybe some JS files are slowing down downloading page?
Last step is to install XDebug and run your login with XDEBUG_PROFILE parameter and then use KCacheGrind tool to see what is happening during login and what takes most time.
(Check manual)

How do you set up an Optimizely test for a single-page app?

I have a single-page web app that presents a multi-step photo management "wizard", split up across several discrete steps (photo upload, styling, annotation, publishing) via a tab strip. On switching steps I set the URL hash to #publishing-step (or whichever step was activated).
How do I set up Optimizely tests to run on the various discrete steps of the wizard?
The browser never leaves the page, so it only gets a single window.load event. Its DOM isn't getting scrapped or regenerated, but just switches what page elements are visible at any one time via display: none or block, so the part I am trying to figure out is really mostly about in what way I go about the Optimizely test setup itself - it's fine (and likely necessary) if all edits get applied at once.
This thing unfortunately has to work in IE9, so I can't use history.pushState to get pretty discrete urls for each step.
There's actually several ways you could go about doing this, and which option you choose will largely depend on what's easiest for you AND how you plan to analyze the data.
If you want to use Optimizely's analytics dashboard:
I would recommend creating one experiment which will activate a bunch of other experiments at different times. The activation experiment will be targeted to everyone and run immediately when they get to your wizard. The other experiments will be set up with manual activation and triggered by this experiment.
The activation experiment would have code like:
window.optimizely = window.optimizely || [];
function hashChanged() {
if(location.hash === 'publishing-step') {
window.optimizely.push(['activate', 0000000000]);
}
if(location.hash === 'checkout-step') {
window.optimizely.push(['activate', 1111111111]);
}
}
window.addEventListener('hashchange', hashChanged, false);
Or you could call window.optimizely.push(['activate', xxxxxxxxx]); directly from your site's code instead of creating an activation experiment and listening for hashchange.
If you want to use a 3rd party analytics tool like Google Analytics:
You could do this all in one experiment with code similar to above, but in each "if" section instead of activating an experiment, you could run your variation code that makes changes to the wizard and sends special tracking information to your analytics sweet for later reporting. You'll have to do your own statistical significance calculation for this method (as Optimizely's data won't be "clean"), but this method actually works out better usually if properly configured.
Alternatively you could use the method outlined above but still try to use the Optimizely analytics dashboard by creating custom events on your experiment and sending data to them using calls like window.optimizely.push(["trackEvent", "eventName"]);
This article may also be helpful to you.
You'll probably need to do this yourself, using Optimizely's JS API to trigger actions on their end and tell it what your users did: https://www.optimizely.com/docs/api