Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing on Safari after upgrading to v3.7.0 #8348

Open
etshi opened this issue Dec 3, 2024 · 4 comments
Open

Tests failing on Safari after upgrading to v3.7.0 #8348

etshi opened this issue Dec 3, 2024 · 4 comments
Labels
STATE: Need response An issue that requires a response or attention from the team. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@etshi
Copy link

etshi commented Dec 3, 2024

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 etshi added the TYPE: bug The described behavior is considered as wrong (bug). label Dec 3, 2024
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 3, 2024
@Bayheck
Copy link
Collaborator

Bayheck commented Dec 5, 2024

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 Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Dec 5, 2024
@etshi
Copy link
Author

etshi commented Dec 5, 2024

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)

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 5, 2024
@github-actions github-actions bot removed the STATE: Need clarification An issue lacks information for further research. label Dec 5, 2024
@PavelMor25 PavelMor25 added the STATE: Issue accepted An issue has been reproduced. label Dec 11, 2024
Copy link

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 github-actions bot removed STATE: Need response An issue that requires a response or attention from the team. STATE: Issue accepted An issue has been reproduced. labels Dec 11, 2024
@bognix
Copy link

bognix commented Dec 11, 2024

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.

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need response An issue that requires a response or attention from the team. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

4 participants