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

Cypress reports the following error: (uncaught exception)SecurityError: Failed to enumerate the properties of 'Storage': access is denied for this document. #30884

Open
ecaijw opened this issue Jan 16, 2025 · 4 comments
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@ecaijw
Copy link

ecaijw commented Jan 16, 2025

Current behavior

Hi,
when I run my test case with Chrome in Cypress, it reports the following error.

(uncaught exception)SecurityError: Failed to enumerate the properties of 'Storage': access is denied for this document.
(xhr)POST 201 http://localhost:3004/auth/getCurrentUser

It has been working well for months, and from yesterday this error happened.

From the first day of the testing code, chromeWebSecurity has been set as false.

export default defineConfig({
  chromeWebSecurity: false,

For "Third-party cookies" in the Chrome setting, it is the default option "Block third-party cookies in Incognito mode"; I have tried to set it as "Allow third-party cookies", but Cypress still reported the same error.

Desired behavior

No response

Test code to reproduce

The error happened after the code clicked the Login button of my local website.

cy.login(username, password, organizationName);

Cypress.Commands.add('login', (username, password, organizationName) => {
  new LoginPage()
    .setOrganizationNameField(organizationName)
    .setEmailField(username)
    .setPasswordField(password)
    .clickOnLoginButton();
});

    clickOnLoginButton(): this {
        cy.xpath(this.LoginButton).click();
        StepLogger.logStep("Click on login button" , async () => {
        })
        return this;
    }

Cypress Version

13.17.0

Node version

18.19.1

Operating System

mac OS 14.5

Debug Logs

The following is the log when I run the test case.
BEFORE EACH
1 clearCookies
2 clearLocalStorage
3 visit http://localhost:5173/<blabla>
4 url
5 assertexpected <input#mantine-8gy8jfez8.mantine-Input-input.mantine-TextInput-input.mantine-1ox2u7s> to exist in the DOM
(xhr)POST 201 http://localhost:3004/auth/isOrganisationExists
6 xpath//*[@data-testid='email-input']
7 type <blabla>
8 wait300
9 assertexpected <input#mantine-47t3z2oz7.mantine-1wjqxrl.mantine-PasswordInput-innerInput> to exist in the DOM
10 xpath//*[@data-testid='password-input']
11 type <blabla>
12 wait300
13 xpath//*[@data-testid='login-button']
14 click
(xhr)POST 201 http://localhost:3004/auth/loginWithOrgName
15 wait300
(uncaught exception)SecurityError: Failed to enumerate the properties of 'Storage': access is denied for this document.
(xhr)POST 201 http://localhost:3004/auth/getCurrentUser
(page load)--page loaded--
(new url)chrome-error://chromewebdata/

<img width="768" alt="Image" src="https://github.com/user-attachments/assets/ca76ee4d-8ebd-431a-bb21-0f3697679bff" />

Other

No response

@MikeMcC399
Copy link
Contributor

@ecaijw

It looks like the following applies to your issue:

@cypress/xpath

@cypress/xpath has been deprecated and is no longer supported.

See https://github.com/cypress-io/cypress/tree/develop/npm/xpath

@jennifer-shehane
Copy link
Member

@ecaijw Did your Chrome version change yesterday by chance? Chrome 132 went stable Jan 14. That may be related.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jan 16, 2025
@kalcefer
Copy link

kalcefer commented Jan 20, 2025

@ecaijw
Do you have allure report enabled? I get a similar error only with allure report enabled. allure-framework/allure-js#1222

@kalcefer
Copy link

kalcefer commented Jan 20, 2025

@ecaijw
try to make a clean project. with a minimum number of steps
cy.visit(http://${Cypress.env("host")})
cy.clearLocalStorage()
cy.reload()
or
cy.visit(http://${Cypress.env("host")})

@ecaijw Did your Chrome version change yesterday by chance? Chrome 132 went stable Jan 14. That may be related.

@jennifer-shehane
I checked on the new version of the chrome 132 browser. the error is consistently reproducible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

4 participants