cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.01k stars 3.18k forks source link

Safari (WebKit) Support #6422

Closed amirrustam closed 2 years ago

amirrustam commented 4 years ago

Current Status - last updated August 4, 2022

✅ Prioritized and on the roadmap ✅ Doing exploratory work to assess requirements and timelines ✅ Under active development ℹ️ Cypress currently supports Firefox and Chrome-family browsers (including Edge and Electron).

Objective

Add support for running Cypress tests within WebKit, which is the engine used by the Safari web browser.

Task List

foolip commented 4 years ago

I've done a fair bit of work on getting Safari working well with web-platform-tests (a conformance test suite for browsers with a dashboard) and know a little bit about what kinds of problems you might run into.

I know that Cypress doesn't use WebDriver but rather CDP (at least for Chrome) but can someone sketch roughly what the requirements of the protocol are? I've had a look at CONTRIBUTING.md and browser support docs but couldn't find any high-level information about Cypress internals.

I ask because I'd like to understand if it would be at all feasible to communicate with Safari using safaridriver, or what the basic "API" or protocol between Cypress and a browser needs to be.

kuceb commented 4 years ago

hi @foolip we would need the following from either extension/devtools APIs:

in addition, we would also need:

everything else is done via JavaScript

foolip commented 4 years ago

Thanks @Bkucera, that's a great list!

get/set/clear cookies by domain

It sounds like you need to get/set/clear cookies for domains other than the one currently loaded, is that right? It looks like the only way of doing that using WebDriver/safaridriver would be to load a page from that domain and then use the endpoints with an implicit domain, but that's not great.

record video of page

I don't think this is possible, but I did have fun recording the whole macOS VM in Azure Pipelines using screencapture once. One can also record a specific window, but I presume you want the content area without decorations.

a way to set a proxy server for all network traffic

I'm pretty sure this is not possible yet.

a way to bypass the invalid ssl cert screen/prompt

I wouldn't be surprised if this is already possible with some setting or command line argument, but I don't know what it is. Our setup for web-platform-tests is a bit special, we update /etc/hosts and add a certificate to the system certificate store. It's a bit much, and also requires that you know what the domains under test are before you start the tests, which is probably not the case for Cypress.

kaushalyap commented 4 years ago

@amirrustam We got Firefox and Edge support recently, love to see, Safari support soon since Safari have

So please support Safari too.

kelly-tock commented 4 years ago

Yes for a lot of responsive sites mobile safari is a must have and can be the majority of the users.

clockelliptic commented 4 years ago

i want so badly to use Cypress, but I simply must use WebDriver because Safari support is a requirement over here

lughino commented 4 years ago

I’d love to see a quick decision around this topic, especially now that playwright is gaining a lot of popularity.

Cypress team, please prioritise this compatibility.

it-sha commented 4 years ago

I would suggest to my company and all clients to use Cypress if Safari support is implemented

lkoorsse-tails commented 4 years ago

Starting using cypress instead of selenium, great advantages over selenium, however Safari browser is a major requirement, would love to see cypress support for this soon to continue using cypress

AlexanderTsipin commented 4 years ago

same, using Wdio just because safari support, management requirements. Please implement even a basic safari runner.

flenerob commented 4 years ago

Please add support to Safari !!!

jhuesos commented 4 years ago

Could this issue to be locked for comments. Adding the "I really need this message" does not really help and it creates a new push notification that everyone subscribed receives and it is annoying. Do you want to reflect that you need this? Click 👍 on the issue.

mydiemho commented 4 years ago

In the meantime, could we update the error to show that Safari is not supported in Cypress rather than the current misleading error that Safari isn't installed on the system? I wasted a few hours trying to debug my CI because I thought Safari was not installed.

Here's the current error message

> npx cypress run --browser  "safari"

Can't run because you've entered an invalid browser name.

Browser: 'safari' was not found on your system.

Available browsers found are: chrome, firefox, electron
estefafdez commented 4 years ago

I would love to have that!

AlexanderTsipin commented 4 years ago

Found Solution: TestCafe supports Safari and iphone, real devices and emulators

wojciech-sygier commented 4 years ago

I'm gonna add +1 to people requiring Safari support in Cypress. We're currently experimenting with different frameworks and we narrowed down our selection to TestCafe and Cypress. While most of us want Cypress, we also need the ability to test on Safari (due to ~30% of our users using it, 77% of which are using mobile version) along with other (currently supported) browsers.

Can we have at least some rough estimate for when any work would start? SoonTM is too broad and we can't really risk rewriting our tests if we don't get it in, let's say, a year or so.

0xc0d3r commented 4 years ago

@wojciech-sygier We too have the similar user segment and we took a call to proceed with TestCafe and it is working for us. We are using BrowserStack to run the tests on real devices and it is super cool.

galeza commented 4 years ago

Please, Add suport for Safari!!!

jennifer-shehane commented 4 years ago

We evaluate current feature work on a number of factors and have to make tough decisions on which to currently work on. This is not part of our current feature work. This is not to say that it will never be delivered. We will comment in this issue when that decision changes. We do not have a rough estimate on when this will be delivered.

We are always re-evaluating what to work on next and feedback from people using Cypress is a big part of that evaluation. We welcome comments in this thread on how this feature would impact your testing.

jennifer-shehane commented 4 years ago

@mydiemho This error message was updated to be clearer about which browsers are supported in Cypress 4.8.0. https://github.com/cypress-io/cypress/pull/7375

kelly-tock commented 4 years ago

Where can we see the current feature work that is prioritized?

aikhelis commented 4 years ago

+1 for Safari support has been long-awaited, as the second most used browser (Mac and iOS/iPadOs) for us. Getting to a point of considering placing all the test coverage to an alternative such as testcafe for browser support.

jennifer-shehane commented 4 years ago

Our Roadmap highlights some of the larger features that are under development.

aikhelis commented 4 years ago

Thank you @jennifer-shehane - this is useful and I'm sure some of these features are important, as long as users do not switch to another tool for the coverage of their user real experience across key browsers.

apis3445 commented 4 years ago

+1 for safari support browser

jprealini commented 4 years ago

+1 for Safari support

hitmands commented 4 years ago

Hi @jennifer-shehane,

I think this is more around showing open commitment on providing support for safari, it's quite concerning that the official roadmap doesn't mention it at all and this topic still says:

image


It would be great to have this moving forward, at least in terms of direction.

sharmilajesupaul commented 4 years ago

I'm curious if the team is also considering adding standalone WebKit support in addition to Safari for MacOS? (I can't seem to find any issues about this).

One of the big benefits is that WebKit is Linux compatible. Which means CI systems or Docker environments can make use of this automation. It's also the engine backing most mobile browsers on iOS which is an important part of coverage for most companies (including Airbnb, where I work).

We've been experimenting with Playwright as well and they seem to support WebKit out of the box https://github.com/microsoft/playwright#documentation--api-reference.

mgol commented 4 years ago

I'm curious if the team is also considering adding standalone WebKit support in addition to Safari for MacOS? (I can't seem to find any issues about this).

@sharmilajesupaul If nothing changed since I last checked, WebKit is way less uniform than Blink. Browsers using Blink generally depend on Chromium without major changes to the engine so they all render web pages identically. WebKit, on the other hand, has multiple build flags so various WebKit-based browsers may be quite different between each other. That’s one of the reasons Safari & Chrome have always had many differences in supported Web APIs.

Maybe it changed since Blink was forked out of WebKit, I don’t know.

sharmilajesupaul commented 4 years ago

@mgol Thats interesting, I hadn’t considered Blink since chrome browsers are well supported by Cypress. My thinking was around the fact that WebKit with an emulated device would probably be the closest thing to mobile Safari that we could run in Docker environments.

hehoo commented 4 years ago

@amirrustam Could you share the current status for this issue? Have we had a plan for implementing the support for Safari? Recently we got a request from our product team asking us to run our E2E tests on Safari. It will be great if we got it planned 😄 .

Ekaterina-Krovyakova commented 4 years ago

@amirrustam Hi ! I also agree that many QA engineers are waiting for Safari browser support. Then Cypress could be the tool of choice for many teams.

WilliamForbesJr commented 4 years ago

Love the world you all are doing in Cypress! I would certainly like to add my input here as well! We encountered some Safari-specific bugs recently that would have been absolutely caught had we had Cypress helping to cover it. Safari would be a game-changer!

sovkan commented 4 years ago

Not sure if this is the place, but I wanted to throw my hat in as well with the need for Safari support. The company I work for ended up not going with Cypress due to no safari support.

Big sad.

codinguncut commented 4 years ago

hi @foolip we would need the following from either extension/devtools APIs:

* get/set/clear cookies by domain

* screenshot page

* record video of page (this can be done via getUserMedia api if it supports capturing the browser tab, which we do in firefox)

in addition, we would also need:

* a way to set a proxy server for all network traffic

* a way to bypass the invalid ssl cert screen/prompt

everything else is done via JavaScript

Is there any chance of having partial/ experimental Safari support?

kennyg1989 commented 4 years ago

Safari is one of the most widely used browsers in the market, this should be prioritized!

codinguncut commented 4 years ago

@Bkucera I would be happy to work on this. Could you point me to a good starting place in the code base (i.e. different implementations of this for Chrome, FF, Edge)? Do you know if anyone has already started work, or achieved partial results for this?

kristianmandrup commented 4 years ago

Check out:

ayang3 commented 4 years ago

We just migrated to Cypress, but we are still using Selenium for Safari testing. Given the high volume of mobile web users on Safari, supporting testing in Safari with Cypress would be a huge win for us, and we can completed migrate to Cypress with cross browser testing! Would love to see the support of Safari in Cypress.

danawoodman commented 4 years ago

For those looking for a solution to Safari support, I highly recommend you checkout Playwright. Seems like a good alternative for those of us that aren't ok with not testing Safari 👍

krysalead commented 4 years ago

Hi,

We have internal discussions about Playwright vs Cypress, I am fighting for Cypress which I found syntax quite nicer than Playwright (too much coding style). But today they had an argument regarding the support of Safari. So, it become political :). Good luck for the implementation

VickyLund commented 4 years ago

We started with Cypress 6 months back and we now have a suite of 750+ cases. We face a lot of issues with Safari, especially in Webviews. A good percentage of our users use Safari to browse our website. Would love to see this being prioritized as we'll be able to use existing cases to cover all major flows in Safari immediately.

Olyya commented 4 years ago

HellO! Cypress is an amazing tool. But for suggestions using cypress for customers need support safari. Is there any estimation about this, or do you plan to do that at all?

jkavalec commented 3 years ago

Adding Firefox and Edge was amazing thing! And for other amazing things like Component testing, really good job on that too.

However as all Apple things Safari is horrible thing that just must do things differently than everyone else, so support for Safari is many times more important than Firefox and Edge, in those two you can generally expect it will work similar to Chrome, but Safari that is quite different story.

I really hope we can convince you that Safari support is part of Cypress that is most missed.

DanielBoa commented 3 years ago

I'd love to be using Cypress but it's a hard sell without it Safari support.

Look forward to the day it's announced!

cbrunnkvist commented 3 years ago

I believe that the biggest motivation for figuring this one out would be that once we support Safari, then support for mobile Safari in Simulator/wired device becomes much more feasible too! 💯 🥇 🍍


and as alluded to earlier in this thread:

Starting in iOS 13, Safari now includes native support for the W3C WebDriver standard. This feature builds on existing support for WebDriver in desktop Safari, first introduced in Safari 10 and macOS Sierra. 1

gutoslv commented 3 years ago

Unfortunately, we need to cover Safari within our tests since we have a significant portion of users who have Safari as the main browser. I'd love to use Cypress as the main automation tool at the company I work for, but it's hard to convince the team without Safari support. Would be easier to convince them if we had it mapped at least on the roadmap.

The work you guys are doing is amazing, and Cypress is definitely the best automation framework that I've worked with. Hope you guys support Safari soon!

hogarthww-labs commented 3 years ago

I've started development on a Cypress DSL adapter for Playwright. Feel free to contribute. Playwright has support for Safari.

dylanz666 commented 3 years ago

Hope cypress can support Safari !

vitaliifokine commented 3 years ago

It's almost 2021. And no support for Safari. Seems Cypress is at a dead end. It's a critical feature.