In Appium on Mac, how to clear cookies for a native mobile app, programatically? - cookies

I just build Login Test case for a native mobile app on iOS using Appium.
On first run, when test cases logs in the user. it does not clear the cookies.
when I re-run the test, it installs the app but keeps the user logged in. I need to clear cookies after all tests run. I kept below in after class but:
driver.manage().deleteAllCookies() is not supported
how should I clear all cookies?

If you need to reset the application to it's base state, consider resetting the app at the each session start.
capabilities.setCapability("fullReset","true");
More information on fullReset can be found in https://appium.io/docs/en/writing-running-appium/other/reset-strategies/index.html

Related

How to avoid writing browser cookies when running testcafe tests?

I am running the testcafe tests for a website. I want to avoid writing any browser cookies while running my testcafe tests. My website writes cookies but while running tests I want to avoid this. Is there any way to achieve this in testcafe?
To disable cookies in the Google Chrome browser, follow these steps:
Find the 'Preferences' file in the Google Chrome profile and specify 2 as the profile.default_content_settings.cookies key value.   
Specify the :userProfile flag after the browser alias.
testcafe 'chrome:userProfile' /tests
If you want to have no cookies at the start of a test, note that TestCafe automatically clears cookies before each test is started.
You can use Role if you want to clear cookies at some point of your test scenario, for example, if you want to authenticate as a different user.
If your scenario is more complex, take a look at RequestMock and RequestHook - they allow you to control any aspect of all requests and responses during a test session.

SQL Server Agent Cannot Access Website Cookies in IE

We have a .NET console application which has a class which inherits from System.Windows.Forms.WebBrowser. The program is designed to navigate to a certain URL programmatically (in a headless fashion). It works without issue when the program is invoked from the command line. However, when the program is run from a SQL Server job, while the web page itself is reachable, the site's HTML returns, "Please Enable Cookies to Continue". Why would cookies not be enabled when being called from a SQL job but work fine otherwise? Both runs are done under the same user account (which happens to have local Admin rights). Furthermore, if cookies are in fact disabled, how can I enable them?
Thanks,

Using qunit with web app in iframe

I'm attempting to use qUnit to perform some unit testing that requires the screens generated by my web app to run. My idea is to put my application into an iframe embedded in my qUnit test page. However this does not seem to work (in chrome) I don't seem to be able to access the web app's iframe. If I do this in chrome's console I get undefined:
frames['myApp'].document
I think this is to do with some kind of cross domain scripting security but, both my web app and my test page are being served from localhost so I don't see why this is occurring, also I have started Chrome with the --disable-web-security parameter but this has not fixed.
Is there a better way to do unit testing that requires output from my application?
You can try publish these tests on localhost by any simple http server, for example if you have a node you can use https://github.com/nodeapps/http-server.
I have a similar situation tests are running in iframe and this work without problems.

Dojo DOH, unit tests with robot actions wont run

When try to run dijit tests from 1.7 version, popup window shows up and test will not progress any further.
Popup says:
DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page
Clicking OK or Cancel doesn't do anything.
Whats going on a how to fix this?
Browser is Firefox 9, java is working (at least test page say so).
It's slightly hard to tell what the problem is, as you've not said whether you're running this from a local filesystem or under a web server, or which URL you're using.
I've had various problems trying to get DOH Robot running from the local filesystem, but good success running them under a web server.
Try it under a web server (any type will do), and try visiting the URL
http://server:port/ROOTDIR/util/doh/runner.html?testModule=dijit.tests.form.module
(where http://server:port/ROOTDIR/ points to the top of your Dojo SDK directory)
That works fine for me with Dojo SDK 1.7.2; sometimes I then get the same prompt you get, but OK enables the test to continue happily.
If that doesn't work, see if you can run a test page directly without the DOH browser runner wrapped around it, e.g.
http://server:port/ROOTDIR/dijit/tests/form/robot/Button_mouse.html
That might prove easier to diagnose.

Testing a Django driven web app

I have a web app that opens and closes background process on the server. I want to simulate multiple users logging in and out of the site as well as pressing all the buttons (general interaction). I am testing the app in general as well as how well the background process are juggled.
Are there specific libraries that i should look at that would simulate a web client? This is system level testing as opposed to unit testing..i think.
Try Selenium or Watir.