For TestCafe, is it possible to get a hook before the browser is launched? - testing

Is it possible to get a hook on e.g. fixture before the browser is launched? The hooks on fixture (e.g. before) and test all happen after the browser is launched.
The only thing I can see to use is the --app switch but I'm not sure that's enough for me. Any help appreciated.
m

Could you please describe why you need this usage scenario?
Currently, there is no way to run the fixture hooks before the browser is launched. As a workaround, you can use the `createTestCafe function to run TestCafe tests from script. In this script, you can run any JS code you want before the tests start.
Please refer to the following article for details:
https://testcafe.io/documentation/402662/reference/testcafe-api/global/createtestcafe

Related

Testing frontend webpages solve selenium-ide issues or change to so?

i'm using selenium ide to test webapp frontend webpages.
I'd like to test via cli AND via gui having to mantain one scripts only.
When automating tests via selenium-side-runner it does not handle alert/confirm command if i don't change any "choose ok on next confirmation" with "webdriver choose ok on visible confirmation", but after change it side gui does not handle it.
Even exporting to python has some incokmpatiblity with gui.
Anyone knows the proper way to record a side.script with gui and run with cli without having to modify it and letting run the tests with the gui again?
I've see many complaining about this without solution, do you advise to use another fronted tester in the place of side? Why?
Thanks.
Just reporting what said on github's bug tracker issue 1270 by toddtarsi.
There's no way to have one script only to handle gui and cli tests. We have to wait for selenium-ide v4 (not SELENIUM).
The correct way is webdriver one.

Why might my Vue.js project not show up during a CircleCI test using Cypress?

My project is built using Vue.js, powered by Nuxt
I’m using Cypress to write/run tests
I’m using CircleCI (v2) to run the tests
Locally, using Cypress’s instance of the Electron browser on macOS, the tests run correctly.
On CircleCI, the tests display a blank screen.
I’ve SSHed into CircleCI after the tests have failed, and if I make a curl request to the local server at that address, the correct HTML is returned to me.
My hypothesis is that the browser is not able to run Vue.js, but without a console log it’s hard to tell.
Any ideas as either how to continue debugging, or even better, fix it?
Edit: I’ve written an extra test to use another site, and it loaded correctly, so I can confirm that everything else is working.
Edit: It’s in my Nuxt config, just going through it now to pull out the line causing the problem.
So, of course this was super annoying. I’m not sure what the chances are of this happening to somebody else, but here’s the answer to my problem:
Google Analytics
On my CI I don’t have a GA code, and it was falling back to empty string, so it wasn’t able to load the page. It didn’t show up on the sever logs as it was an issue on the client side, and it’s not yet possible to easily get client logs using Cypress (coming soon).
Interesting, Thomas,
Could you open a GitHub issue with a link to a small repo that we can try ourselves? I do not see any factors that might affect running Cypress tests against Nuxt app on Circle

UI Tests passing in XCode, Failing in Jenkins

Whenever I run UI Tests locally, they pass, and I can watch the simulator do exactly what it's supposed to.
Then, when the tests run on Jenkins, they fail on the first line.
If it matters, this is the failure:
UI Testing Failure - No matches found for Table
The above error never happens when the tests are running locally.
I appreciate all of the help, and also want to help others with the same issue as much as possible. It's tough, because I can't post code or give too much information, since the code I'm working on is proprietary.
Here was the issue:
I didn't realize that Jenkins just ran the tests on a simulator, on a computer, just like I would do on mine. I had to handle logging into the app in Jenkins' simulator, so that all of the XCUIElements were accessible.
The tests weren't passing the first line, because I wanted to tap a "Settings" button, and a user wasn't even logged in.
Please comment if I can clarify or explain further.

Do we have interactive mode in selenium webdriver?

I am a newbie to Selenium.I want to know do we have any interactive mode to automate Selenium webdriver.Because i want to test each and every line is correct or not while automating.I have Automated Watir earlier,i have used "irb" to interact with.Please help me do we have any similar kind of mode in Selenium webdriver.
IRB is nothing Watir specific it is just an interactive ruby shell (IRB = Interactive Ruby Shell) and thus you can also use it to work with Selenium. You only need the selenium-webdriver gem and then you can start.
You can also find a good getting started tutorial here: http://aspyct.org/blog/2012/09/09/functional-web-testing-with-selenium-and-ruby/
I'm sorry if this topic may feel so old, but I have an idea for this.
You can use the python interpreter in the terminal and type each line:
from selenium import webdriver
b = webdriver.Firefox()
b.get('https://www.google.com')
And so on :)
I use a debugger (byebug gem) to stop tests at the point where I need to continue the automation interactively. I prefer to have all gems, modules, and classes available when I hit the breakpoint.
I also wrote a couple methods that will reload page object classes from the commandline/breakpoint. I can add a new method, reload, and verify it works, and move on to the next action; all without restarting the test.

Run a function whenever Karma tests fail

I have been asked to have Karma run on our live server so that whenever a unit test fails an email is dispatched, and I haven't been able to find any answers related to this.
Do any of you know of a way to run a function when Karma tests fail? I am running with Jasmine, specifically. Are there any other parts to the public API outside of just the ways to start the Karma server (http://karma-runner.github.io/0.8/dev/public-api.html)? Maybe something like a require('karma').server.onTestFail?
Any help with this would be much appreciated!
Typically this would be done by the Continuous Integration server, for instance Jenkins. If you don't use it, I would recommend so.
If you really want to implement this in Karma, you can write a custom reporter, there is a method onSpecComplete.