Add e2e test and confirm support for date range date list widget

Created on 30 March 2025, 25 days ago

Overview

Child of [#3487284)]

Proposed resolution

Remove 'field_xbt_daterange_datelist' from skipped fields in xb_test_article_fields_install
Add explicit e2e coverage to entity-form-field-types-test.cy.js for date range date list widget

User interface changes

πŸ“Œ Task
Status

Active

Version

0.0

Component

Redux-integrated field widgets

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    This failed for me locally.

          cy:command βœ”  get @startDateHour
          cy:command ✘  assert      expected **<select>** to have value **'6'**, but the value was **'15'**
    
      0 passing (2m)
      1 failing
    
      1) Entity form field types
           Can interact with form fields:
    
          Timed out retrying after 4000ms
          + expected - actual
    
          -'15'
          +'6'
    
          at eval (webpack://@drupal/experience_builder/./tests/e2e/entity-form-field-types-test.cy.js:200:30)
      at Array.forEach (<anonymous>)
          at Object.edit (webpack://@drupal/experience_builder/./tests/e2e/entity-form-field-types-test.cy.js:199:40)
          at eval (webpack://@drupal/experience_builder/./tests/e2e/entity-form-field-types-test.cy.js:349:12)
      at Array.forEach (<anonymous>)
          at Context.eval (webpack://@drupal/experience_builder/./tests/e2e/entity-form-field-types-test.cy.js:342:27)
    

    It just happens to work for you because it's your timezone!
    I was able to verify that with ddev config --timezone=Australia/Sydney and running the test again.

    We need to ensure the browser is in that timezone for the tests.
    I was able to achieve that with:

        // We need to set the timezone in the running browser too.
        Cypress.automation('remote:debugger:protocol', {
          command: 'Emulation.setTimezoneOverride',
          params: {
           timezoneId: 'Australia/Sydney',
          },
        });
    

    in the before() method of the test.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    The timezone needs to match bootstrap.php
    So you need to run the cypress command with TZ=Australia/Sydney @penyaskito

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Ah, I didn't read your comment properly, you're saying we can set the timezone in the config.
    I'll do that.

    FYI it's not my timezone, its what core uses in bootstrap.php - mine is slightly different (no daylight savings)

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Did that, thanks

  • Pipeline finished with Success
    16 days ago
    Total: 2714s
    #468774
  • Pipeline finished with Success
    16 days ago
    Total: 1856s
    #468885
  • Pipeline finished with Success
    16 days ago
    Total: 1430s
    #469212
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Now locally my tests are still failing as in #8, even with Emulation.setTimezoneOverride.
    Changing docker timezone affects this. I don't think we should rely on it. I'm investigating this.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Per #13.

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    @larowlan Couldn't get to this today. If you want to look at it you can reproduce it with something like TZ=America/Chicago in your container.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    @penyaskito when XbTestSetup runs, the test site installer has already loaded bootstrap.php which has set the PHP default timezone to Australia/Sydney which means that for the logged in user their timezone is set to Australia/Sydney and therefore Drupal shows the default values in that TZ. In this MR we set the timezone in CI to Australia/Sydney - I don't see a way around it because this happens before Drupal is installed and impacts the site's default timezone

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Ah, I think instead of using .local() in day JS I can force the TZ to Australia/Sydney instead.

    Leave it with me

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    That's what I thought, but wasn't sure if that would break the actual purpose of the test.

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • Pipeline finished with Success
    15 days ago
    Total: 2650s
    #469667
  • Pipeline finished with Canceled
    14 days ago
    Total: 116s
    #471003
  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    Rebased.
    Thanks to
    defaultValue.tz(tz);

    we don't need

    -    // We need to set the timezone in the running browser too.
    -    Cypress.automation('remote:debugger:protocol', {
    -      command: 'Emulation.setTimezoneOverride',
    -      params: {
    -        timezoneId: 'Australia/Sydney',
    -      },
    -    });
    

    anymore, so removed. This passes for me locally.

  • Pipeline finished with Success
    14 days ago
    Total: 1635s
    #471006
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

    With the current implementation, the dropdown options include the label names in addition to the expected number/month/etc values and selecting these results in an error in the preview. (notice I was able to choose "Hour" as an option for the Hour dropdown).

    This should get addressed and ideally the test expanded to check at least one of the dropdowns to ensure it doesn't regress to again offering the labels as selectable options.

  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI
  • Pipeline finished with Success
    14 days ago
    Total: 1987s
    #471577
  • Pipeline finished with Success
    13 days ago
    Total: 1762s
    #471595
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Fixed those issues

  • Pipeline finished with Success
    10 days ago
    Total: 1489s
    #473371
  • Pipeline finished with Success
    8 days ago
    Total: 1601s
    #475979
  • Pipeline finished with Skipped
    8 days ago
    #476208
  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

    πŸ‘

Production build 0.71.5 2024