Qooxdoo reuse cookies between sessions? - cookies

Recently I have create some UI tests for a qooxdoo application with the built-in simulator ( I am using qooxdoo 3.0.1, selenium-server-standalone-2.35.0 and firefox23)
and I need to store a cookie in the browser and save that for the next time that it open.
code that stores the cookie:
if(!this.getQxSelenium().isCookiePresent(debugVariable))
this.getQxSelenium().createCookie("debugVariable=0","path=/, max_age=350000, domain=subdomain.foo.com");
console.log(this.getQxSelenium().getCookieByName("debugVariable"));
I have find that there is an argument in the server the -profilesLocation that specifies the directory that holds the Firefox profiles that java clients can use to start up the Firefox
I even try to use -browserSessionReuse but it does not working either for me.
I see this is not enough what other solution I could try to make the Firefox to remember the cookies?

This is not a qooxdoo-specific issue. I tried it with a plain HTML+JS page and Selenium's -firefoxProfileTemplate option and it didn't keep the cookie either.
You could try using an older version of Selenium (and perhaps also Firefox). -firefoxProfileTemplate is specific to Selenium RC, which is deprecated and gets more broken with every new release.

Related

Spartacus integration with CDS, profile.consent.given cookie not being set after clearing site data

We're integrating SAP Commerce 2005 and Spartacus 2.0.3 with CDS (Context-Driven Services). We followed the instructions from https://sap.github.io/spartacus-docs/cds-integration/ and we got it work right.
Nevertheless, we've noticed one issue.
When we clear the site data (either from Chrome DevTool or via browser Settings), the cookie named profile.consent.given is not being set anew while refreshing the page - even though the PROFILE consent has consentState "GIVEN" in local storage in spartacus-local-data > anonymous-consents > consents.
Initially I thought that it's just not visible in DevTools, but when I've added the url parameter ?profileTagDebug=true, in the console there is a log saying:
"[Profile Tag] No cookie found with name profile.consent.given".
When I set this cookie manually with value true, everything starts to work just fine, all other needed cookies and local storage data responsible for tracking users behavior is being set properly.
Do you see any place where we could have done something wrong, which may have caused this cookie to work improperly? Which module or component of Spartacus library would be of any clue in resolving this issue?
Edit: the reason of this strange behavior was in profile tag created by our team in CDS. It contained:
"consentListener": "type":"cookie","cookieName":"profile.consent.given","cookieValue":"true"},
which made the cookie profile.consent.given necessary while it shouldn't be. Using profile tag without this part made all work just fine.
With Spartacus, this cookie doesn’t make sense anymore. It is created by the Commerce backend and works best in combination with an accelerator frontend. Cds-spartacus in combination with ProfileTag relies on the anonymous consents or the user consents (depending on the user being logged in or not) loaded by Spartacus. More information about anonymous consents can be found here: https://sap.github.io/spartacus-docs/anonymous-consent/.
Just a quick FYI about the CDS-Spartacus integration: the profile tag script is pulled from the configured URL by Spartacus, and the script is doing all the event and data "scraping". The cookie is also being placed in the browser by the script.
Your question and this comment lead me to think that the script is not handling this case.
I'm not even sure if it should handle it, so it might be a better idea to contact CDS team directly about this one.

Coded UI Test and Firefox 35.0.1 Issue

I'm trying to use microsoft coded ui tests with firefox. This was NOT an issue until Firefox 35.0.1 came out.
Skip to the bottom if you want to know the issue more than the why am I doing it this way:
Why I'm not using Selenium:
With Selenium, when Firefox launches a web driver, it loses it's previous states/cookie settings. I could of course import a cookie. The problem is that if I have multiple users running the test, they'd either have to set up individual lines of code to import their own specific cookie from their own path. This could become a dangerous game if a user decides to use someone elses cookie.
Why I'm using Coded UI Tests:
Certain applications I am running work exclusively with IE and others work exclusively with Firefox. Since I can't record the instances in IE with selenium, I have to should utilize a coded ui test anyway. I could of course also use watin. But at some point, why run Selenium, and watin when I can instead JUST use a coded ui test. Additionally, when going to the url for login with a coded ui test, FF is setup to save my password and cookie. therefore, the user can save their own password/cookie on each machine and just change the input for username which comes via excel spreadsheet. Everyone gets their own test, and no security issues.
The issue:
Since Coded UI tests don't recognize Firefox as a browser, it recognizes Firefox as a windows application. Therefore, edits and buttons in firefox are considered WinEdit and WinButton for firefox while internet explorer uses HtmlEdit and HtmlButton.
When Firefox put out an update, the coded ui test stopped recognizing certain objects in the firefox window. When trying to manually highlight objects/words with the test builder, it puts the blue box at the head of the web page instead of over what I'm clicking selecting. When hardcoding things to select, it doesn't recognize them. Is anyone aware of a workaround for this issue?
Recording on Firefox/Chrome is not supported by Coded UI. You can record your test in IE and Play it across Firefox/Chrome using Selenium components for Coded UI Cross Browser Testing which can be found here https://visualstudiogallery.msdn.microsoft.com/11cfc881-f8c9-4f96-b303-a2780156628d

Disable session id based on cookies in RAP to use multiple browsers and tabbed browsing

I tried to prevent cookies for identifying the session in RAP. There are a lot of sources.
The most important are obviously this and that one. It seems the jettycustomizer disappeared. Which JVM parameter would I have now to supply to force Jetty out of Eclipse not to use cookies.
The given option
-Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.rap.jettycustomizer.internal.SessionCookieCustomizer
doesn't work for me.
AFAIK, you can't disable session cookies in Jetty by means of declaration, you need to do it programmatically. According to this post, the following code does the trick:
((HashSessionManager)context.getSessionHandler().getSessionManager())
.setUsingCookies(false);
The RAP project used to provide a fragment bundle for jetty that contains a customizer class which disables sessions using this method. This customizer has to be enabled with the system property you referred to, but this only works when the fragment is present in your environment.
This “jettycustomizer” bundle has been dropped when RAP enabled support for multi-tab browsing, but you can still get it from the 2.1 branch.

howto hide firefox add-on popup initiate by selenium rc?

everytime i test my selenium test, the instant of firefox will popup and show page of selenium rc. It's ok and cool. But i have problem. For every test i also have to see a firefox's page pop up and shown selenium plugin have been add to firefox.
is there any way to configure selenium so it initiate firefox without a popup page cause after a hundred test, it start to irritate me ;D
I'm sure this is a duplicate of another SO question, as I feel like I've answered it before, but I can't find it. If I do subsequently find it then I will update my answer.
You need to set the extensions.lastAppVersion preference to match the version of Firefox that you're launching. Otherwise you will generally have an additional tab in Firefox and the Addons manager popup.
You may need to configure Selenium to use a custom Firefox profile in order to make this change.
Removing the extensions.rdf file from profile directory will fix this issue . I have created a separate profile for Selenium tests, which is only used for Selenium Tests. I would love to hear if there is other way around . My "extensions.lastAppVersion" is updated and reflects the current browser version therefore the above trick does not work for me .
Remember, invoking selenium by user will re-create extensions.rdf file, therefore I prefer to keep separate profile for Selenium
Having found this answer and had a go, I found that merging the Extensions.rdf and extensions.ini file from the temporary profile created in a Selenium session and putting that into your Custom Profile directory solves this problem.
When merging extensions.ini, be careful to avoid getting the pathnames wrong.
Use this -
From the address bar type “about:config” and add/update the following:
- extensions.update.notifyUser (type=boolean; value=false)
- extensions.newAddons (type=boolean; value=false)
It worked for me.

Iphone and php application

I created php pages.. those php pages are registration form.with the fields.FirstName,LastName and CompanyName...If I fill the information in that form and hit submit the data will store it on the mysql database.And I created one page...that displays the data which I have added through register form...I have a button on this page which displays the data...my question is when I click that button...my display data must store on the Iphone ...is that possible to do.....or any other solution.....and how to use php on Xcode....?
You appear to be confusing server and client-side programming.
If you want to run stuff on a website on the iPhone to save locally, you will have to use HTML5 and Javascript, and HTML5's feature for local databases (if the iPhone doesn't support this currently, it certainly will soon).
PHP will run on the server, if you want to save the data on the server-side.
If you want to run stuff only locally on the iPhone, then you'll want to look into XCode and Objective-C. The iPhone uses SQLite as a local database for applications to use.
Are you opening your webpage in Safari on the iPhone, or are you planning on having an application running?
If you have a server with a PHP application, why would you want to store the "display data" on the iPhone? Is this for offline use?
Users can copy/paste info to notes on their iPhone, though this is not a very handy solution.
If you want the phone to remember the data locally, you can set the expire header of your application to a date in the far future, but be careful as this has risks if you change data and the client doesn't learn about it because it thinks it has a valid local copy.
Also, read this (short) article about caching data with HTML on the iPhone: http://ajaxian.com/archives/html5-features-in-latest-iphone-application-cache-and-database
That suggests it is supported. But, I wouldn't know how. I'm sure google can help you there.
You could just capture the user's information in standard UITextField's and then submit the form programmatically using ASIFormDataRequest from the ASIHTTPRequest library. It's made specifically for posting data to a form.