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

TypeError: Cannot read properties of null (reading 'getAttribute') on form submit #30523

Closed
martinambrus opened this issue Nov 3, 2024 · 1 comment

Comments

@martinambrus
Copy link

martinambrus commented Nov 3, 2024

Current behavior

The test fails without any apparent reason - there is no object on page that I'm trying to get attributes for after the form submit. In fact, there is nothing at all being executed after the form submit but the error is still there.

Desired behavior

The mentioned error should not appear and Cypress testing should continue.

Test code to reproduce

function test_checkout() {
  cy.step( 'go to basket' );
  cy.get( '#block-cart .cart-block--summary a' ).click();
  cy.get('#commerce_cart_form-cart-ajax-wrapper table tbody tr').should('be.visible.and.have.length', 1);

  cy.step( 'go to payment and checkout' );
  // the error will happen after the following line:
  cy.get('#commerce_cart_form-cart-ajax-wrapper #edit-actions #edit-checkout').click();
}

// test logic
describe('AkeVino homepage', () => {

  beforeEach(() => {
    cy.visit('https://akevino.sk/');
    cy.step('Do we have a homepage?');
    cy.get('body').should('have.class', 'path-frontpage');
  });

  it('should add new vine into the basket and go to payment and delivery step', () => {
    cy.step( 'adding to basket' );
    cy.get( '.block-views-blockhomepage-products-block-new-wines .views-view-responsive-grid__item:first .button--add-to-cart' ).click();
    cy.get( '.block-views-blockhomepage-products-block-new-wines .views-view-responsive-grid__item:first .button--add-to-cart' ).parent().should('have.class', 'add-to-cart-clicked');
    cy.waitUntil(() => cy.get('.block-views-blockhomepage-products-block-new-wines .views-view-responsive-grid__item:first .button--add-to-cart').should('not.have.class', 'add-to-cart-clicked'));
    cy.get( '#block-cart .cart-block--summary__count' ).should('contain.text', '1');

    test_checkout();
  });
});

Cypress Version

13.15.1

Node version

20.15.1

Operating System

Windows 11

Debug Logs

https://www.dropbox.com/scl/fi/whjho0efs5gazil7em2j5/cypress-error-debug.log?rlkey=pkl3jht9x1eysmgtvuh0dlplg&st=d37756zl&dl=0

Other

No response

@MikeMcC399
Copy link
Contributor

There is a community response to this issue in https://discord.com/channels/755913899261296641/1302545257799618590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants