cypress-io / cypress

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

Error: EISDIR: illegal operation on a directory #1244

Closed tanuj-vishnoi closed 3 years ago

tanuj-vishnoi commented 6 years ago

Current behavior:

Error message is thrown

Error: EISDIR: illegal operation on a directory, 
open 'C:\Users\*********\AppData\Roaming\Cypress\cy\production\projects\CyDemo-f6363983d1108dd01027bb4ab06585aa\bundles

Desired behavior:

On clicking signIn button user should land on dashboard page

How to reproduce:

Submit userId and password in respective fields and hit signIn

Test code:

function loadFixture() {
    cy.fixture('login').as('loginJson')
}
describe('Login', function () {
    beforeEach(function () {
        loadFixture()
    })

    before(function () {
        cy.visit('https://*************.com');
    })

    it('It Should load in to the application', function () {
        cy.title().should('contain', 'xyz');
    })

    it('It Should enter credentials and login', function () {
        cy.get('#Username').type(this.loginJson.masterCoder.email).should('have.value', this.loginJson.masterCoder.email);
        cy.get('#Password').type(this.loginJson.masterCoder.password).should('have.value', this.loginJson.masterCoder.password);
        cy.get('.button-label.ng-binding').and('be.visible').click();
    })
});

Additional Info (images, stack traces, etc)

cypresserror

dwineknott commented 4 years ago

Hi @jennifer-shehane ,

Revisiting this, after updating to version Cypress 5.0.0 I'm still getting this redirect error. The message in the cypress client is different now though. You can see the redirect is still resolving to https://app.songtrust.com/__/#add/success/{id} (stripping out the /songwriter/ ).

The test is passing with this error when I run it locally, but fails command line (or in CI). Command line client crashes with "The automation client disconnected. Cannot continue running tests."

I am using experimentalSourceRewriting: true in my config.

Screen Shot 2020-08-25 at 4 39 16 PM

Sample code:

`describe('Smoke Test', () => {

   Cypress.on('uncaught:exception', (err, runnable) => {
        // returning false here prevents Cypress from
        // failing the test
        return false
    });

    beforeEach(() => {
        cy.server()
        cy.route('POST', 'app.songtrust.com/api/v1/lod/').as('lod');

    });

it('IMRO ', () => {
    //Begin funnel workflow 

   cy.request({
    method: 'POST',
    url: 'app.songtrust.com/api/v1/user/login/',
    body: {
        username: 'demo@songtrust.com',
        password: 'testing',
    }
    });
    cy.visit('app.songtrust.com/songwriters/#add');
    cy.findByTestId('show-lod-pros-button')
    .click();
    cy.findByTestId('lod-pro-selections')
    .select('IMRO', {force:true});
    cy.findByTestId('lod-pro-selections')
    .should('have.value', 'IMRO');
    cy.findByTestId('continue-to-form')
    .click();

    /////LOD Form - IMRO///////
    cy.url()
    .should('contains', '/songwriters/#add/lod-form');  //assert URL

    cy.findByTestId('first-name')
    .should('be.visible')
    .type('Frank');

    cy.findByTestId('middle-name')
    .should('be.visible');

    cy.findByTestId('last-name')
    .should('be.visible')
    .type('Ikiseh');

    cy.findByTestId('id_email')
    .should('be.visible')
    .type('imro@songtrust.com');

    cy.findByTestId('id_writer_id')
    .should('be.visible')
    .type('01047205098');

    cy.findByTestId('lod-us-representation')
    .should('be.visible')
    .select('ASCAP', {force: true});

    cy.findByTestId('pubco_no')
    .should('be.visible');

    cy.findByTestId('pubco_yes')
    .should('be.visible')
    .click();

    cy.findByTestId('id_publishing_company')
    .should('be.visible')
    .type('Alpha Music');

    cy.findByTestId('publishing_company_pro')
    .should('be.visible')
    .select('ASCAP', {force: true});

    cy.findByTestId('id_publisher_id')
    .should('be.visible')
    .type('697403510');

    //Signature Modal
    cy.get('.type-toggle')
    .should('be.visible')
    .click();

    cy.get('.typed-signature-field')
    .should('be.visible')
    .type('Frank Ikiseh');

    //Submit Form - IMRO
    cy.get('.standard')
    .should('be.visible')
    .click();
    cy.wait('@lod').should((xhr) => {
      expect(xhr.status, 'successfull POST').to.equal(201);
    });

    //Thank you modal - NOT WORKING DUE TO CYPRESS BUG

   });
});
bowens-zn commented 4 years ago

It seems to be an issue with the hash # in the URL, I still have the same issue.

sloeff commented 4 years ago

Same problem here with the website http://automationpractice.com I am running Cypress 5.1.0, with or without experimentalSourceRewriting flag makes no difference. Sharing code is tricky since it happens on the account creation page.

http://automationpractice.com/index.php?controller=authentication&multi-shipping=0&display_guest_checkout=0&back=http%3A%2F%2Fautomationpractice.com%2Findex.php%3Fcontroller%3Dorder%26step%3D1%26multi-shipping%3D0#account-creation

Error: EISDIR: illegal operation on a directory, open 'C:\Users\SanderL\AppData\Roaming\Cypress\cy\production\projects\MyStore-a3d227b386b9f2d993939c6fc2b3ad9b\bundles'_

cypress.json:

{
    "testFiles": "**/*.feature",
    "viewportWidth": 1800,
    "viewportHeight": 1000,
    "defaultCommandTimeout": 10000,
    "pageLoadTimeout": 30000,
    "video": false,
    "baseUrl": "http://automationpractice.com"
}
benjaminbours commented 3 years ago

Hi, I got the same problem while using github actions. Here is my output: Error: EISDIR: illegal operation on a directory, open '/github/home/.config/Cypress/cy/production/projects/workspace-3ef6b2ad9cc100f006a5d4a7217ff063/bundles'

It happens only on specific tests, I have other tests passing before this crash.

I have no issues locally, headless or not, only while working in a CI or when I reproduce locally the CI using https://github.com/nektos/act. I'm using Cypress 6.0.1, and I use the container cypress/included:6.0.1 when using act.

EDIT:

Using ´experimentalSourceRewriting: true´ in the cypress config solved it, but then I had others trouble such as JS illegal invocation at some places where there is window.location.reload(). Looking at the code in the browser, it looks like the code added by cypress around mine make it crashed.

vicluber commented 3 years ago

Same issue here. Using 6.0.0 (Also tried 6.0.1 and downgrades). The error shows up as soon as cypress starts, after running "npx cypress open" Adding "experimentalSourceRewriting": true, to cypress.json did not solve the issue.

Screenshot from 2020-12-15 13-22-06

jennifer-shehane commented 3 years ago

Can reproduce still with this example, although the error is different.

it('illegal operation on a directory', () => {
  cy.visit('https://www.staging.nutheorie.be/')
  cy.get('select[name="city"]').eq(0).select('auto-theorie-cursus-amsterdam')
  cy.wait(500)
  cy.get('[name="course"]').select('ma 29 maart 2021')
  cy.get('.btn-block > button[type="submit"]').eq(0).click()
})
Screen Shot 2021-03-24 at 2 47 00 PM
cypress-bot[bot] commented 3 years ago

The code for this is done in cypress-io/cypress#16394, but has yet to be released. We'll update this issue and reference the changelog when it's released.

cypress-bot[bot] commented 3 years ago

Released in 7.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v7.3.0, please open a new issue.