4 ms·
> So much so, I started looking at Javascript testing frameworks like Chai, Mocha, Cypress etc. The problem I found is that they require a completely different
by MetaWhirledPeas 4y ago
> So much so, I started looking at Javascript testing frameworks like Chai, Mocha, Cypress etc. The problem I found is that they require a completely different setup, and aren't easy to get started for someone from a Python background.
A shame to see Cypress lumped in and dismissed like that. It really is a fantastic way to test.
> The killer feature of Playwright is: You can automatically generate tests by opening a web browser and manually running through the steps you want. It saves the hassle I faced with Selenium, where you were opening developer tools and finding the Xpath or similar. Yuck
This is absolutely not the primary hassle with testing. Recording steps can help kick start your testing, sure. But very quickly you start to realize that it's only saving you from the easiest work at best, and is creating flaky tests at worst.
- salawat 4y agoIndeed. You need: loggers, data generators, integrations with state probe points, data/result aggregators, etc, etc. For massive numbers of tests, now it's time to look into parallelism. Really hope you're not sharing your test data between test cases! Or holding open a single db session to your write instance! How about multimedia artifacts management? Point being, test automators do a shit ton of work nobody ever wants to dig into. Tests are not there to only be written. They must be read.
- sdfhbdf 4y ago> Cypress lumped in and dismissed like that I think Cypress is really cool when you're on their happy path - testing on Chromium browsers and in JavaScript. I tried it some time ago so maybe this might be outdated, but they had little support for browsers other than Chromium or even rather Electron based and also it was a little difficult to wire up with Gherkin scenarios. Keep in mind that the OP refers to Python tools, AFAIK Cypress does not offer Python bindings while both Selenium and Playwright do.
- jjzhiyuan 4y agoWe have used Cypress for 3 years to test our oss project: https://apisix.apache.org/blog/2021/02/08/stable-product-delivery-with-cypress/ https://apisix.apache.org/blog/2021/02/08/stable-product-del...
- easton 4y agoCypress has good support for Firefox now and they are working on WebKit (in fact, I think they’re using playwright-webkit). Not as mature as Playwright, but it’s getting there.
- lmiller1990 4y agoWe added experimental support for WebKit [0]. It uses PW WebKit under the hood (as mentioned in the blog post). Disclosure: I work on Cypress (but I did not work on the WebKit feature). Firefox works great with Cypress. Cypress definitely has some limitations, like any other tool, such as only supporting JS-based test. Playwright is definitely a great tool, too. I like them both for different reasons :) [0] https://www.cypress.io/blog/2022/09/13/cypress-10-8-experimental-run-tests-in-webkit/ https://www.cypress.io/blog/2022/09/13/cypress-10-8-experime...
- brightball 4y agoHow easy is it to use one of these to do actual automation (not testing)? Say I wanted to login to an SPA, navigate to a page and download a file? Asking mainly because there’s a tool I have use without an API and if I could script something like that it would make my life a lot easier. Just never tried that type of thing before.
- chrismarlow9 4y agoSounds like you can use a macro on the OS level or a plugin like greasemonkey/tampermonkey.
- brightball 4y agoNever tried that. I’m basically trying to setup a cron to login to this site every day and download a CSV.
- squeaky-clean 4y agoAny of these would work fine for your idea and not be very difficult to do. (Assuming the site doesn't have any anti-bot measures). You'll need to create a cron that runs the automation script or opens a browser with your greasemonkey script installed. Sometimes you can even do these with pure curl. POST the login form, get back the necessary cookie or token, then request the download URL, if it's easily predictable.
- dotancohen 4y agoIn my worst case scenario doing something similar, I had to go through the login process via Selenium, then download the file (it actually was a CSV for me too) in Python, by grepping the source code (Xpath and CSS selectors were useless) with a regex. There are ways to share cookies between Firefox and Python, and you could probably save a step by running Selenium from Python. Then make an HTTP request with the proper cookies, UA, and accept-* headers.
- serpix 4y agoNordpool energy prices perhaps?
- deleted 4y ago[deleted]
- epolanski 4y agoCypress doesn't support webkit.
- TheFattestNinja 4y ago99% sure record tab is available in selenium as well
- deleted 4y ago[deleted]