testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Tests failing on Safari after upgrading to v3.7.0

Open etshi opened this issue 1 year ago • 5 comments

What is your Scenario?

On a cookie banner click accept all cookies which will make the banner not show again for the rest of the test scenario

What is the Current behavior?

Only on Safari and after upgrading from testcafe v1.18.0 to v3.7.0 the cookie banner keeps re-appearing.

It was working as expected in v1.18.0 before the upgrade

What is the Expected behavior?

On a cookie banner click accept all cookies which will make the banner not show again for the rest of the test scenario

What is the public URL of the test page? (attach your complete example)

https://github.com/etshi/Testcafe-example/tree/main

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture('Minimal Working Example') .page('https://staging.app.cargo.one');

test('Click buttons on cargo.one staging', async t => { // Accept cookies const acceptCookiesButton = Selector('.iubenda-cs-accept-btn'); await t .click(acceptCookiesButton) .wait(2000); // Wait for 2 seconds

// Click on login button const loginButton = Selector('#btn-login-password'); await t.click(loginButton); });

Your complete configuration file

{ "selectorTimeout": 10000, "assertionTimeout": 10000, "skipUncaughtErrors": true, "skipJsErrors": true, "stopOnFirstFail": true, "disableNativeAutomation": true, "quarantineMode": { "successThreshold": 1, "attemptLimit": 6 } }v

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Run the minimal working example
  2. Check that the test runs on Safari
  3. Check that after clicking the Accept Cookie button it re appears (while it shouldn't) after 1 or 2 seconds

TestCafe version

3.7.0

Node.js version

18.20.4

Command-line arguments

testcafe safari ./test.js

Browser name(s) and version(s)

Safari v17.6

Platform(s) and version(s)

No response

Other

No response

etshi avatar Dec 03 '24 09:12 etshi

Hello, thank you for reaching out to us.

Updating from v1.18.0 to v3.7.0 is a big leap between 2 major versions. Breaking changes like the one you encountered are possible.

However, the described behavior is expected because cookies are not preserved between test runs.

As a workaround, you can use a Fixture.beforeEach hook to accept cookies before each test run.

fixture`Fixture.beforeEach`
    .page`https://devexpress.github.io/testcafe/example/`
    .beforeEach(async t => {
         const acceptCookiesButton = Selector('.iubenda-cs-accept-btn');
         await t.click(acceptCookiesButton);
    })

In addition, you can also use User Roles for an easier authentication process.

Bayheck avatar Dec 05 '24 12:12 Bayheck

Just to clarify, the problem is not even happening between different test runs, but is happening in the same test run. The cookie banner simply keep appearing on top of other elements causing the test to fail.

Also, the tests run as expected on other browsers (Firefox, Chrome and Edge)

etshi avatar Dec 05 '24 15:12 etshi

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

github-actions[bot] avatar Dec 11 '24 10:12 github-actions[bot]

On TestCafe version 2.2.0 the cookie banner behaves as expected, starting with v2.3.0 the issue described by @etshi occurs.

In v2.2.0 after clicking the cookie banner I can see the session cookie being set in the browser, starting with v2.3.0 and higher the cookie is no longer set.

bognix avatar Dec 11 '24 11:12 bognix

Hello @bognix,

Thank you for sharing this information. It will help us investigate this issue further.

PavelMor25 avatar Dec 16 '24 10:12 PavelMor25

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] avatar Jul 16 '25 02:07 github-actions[bot]

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.

github-actions[bot] avatar Jul 27 '25 02:07 github-actions[bot]