joomla-projects / joomla-cypress

Helpers for using Cypress with Joomla for testing
3 stars 9 forks source link

installJoomla Language selection #13

Open murrayDI opened 10 months ago

murrayDI commented 10 months ago

When trying to test Installation with Joomla 5.0.2 and joomla-cypress 1.0.1 this makes trouble https://github.com/joomla-projects/joomla-cypress/pull/11

1) Install Joomla
       Install Joomla:
     CypressError: Timed out retrying after 4000ms: `cy.select()` failed because it could not find a single `<option>` with value, index, or text matching: `English (en-GB) | English (United Kingdom)`

Installation-cy-js Joomla-Installer

muhme commented 10 months ago

I was running in this issue too, first tried to delete the space before and after the pipe (|), but this was also not working for me.

I used the following replacement:

cy.get('#jform_language').then(select => {
  if (select.find('option:contains("English (en-GB)")').length) {
    // If 'English (en-GB)' exists, select it
    cy.get('#jform_language').select('English (en-GB)');
  } else if (select.find('option:contains("English (United Kingdom)")').length) {
    // If 'English (United Kingdom)' exists, select it
    cy.get('#jform_language').select('English (United Kingdom)');
  }
});

should I create a PR?

murrayDI commented 9 months ago

Something happening here? Joomla installation still not possible using joomla-cypress.

muhme commented 5 months ago

The current joomla-cypress version 1.0.3's installJoomla() function uses en-GB to select the language. This approach works for both Joomla 4 and Joomla 5 due to the following reasons:

In Joomla 4.4.6, the HTML source code for the language option is:

    <option value="en-GB">English (United Kingdom)</option>

In Joomla >= 5.1, the HTML source code for the language option is:

    <option value="en-GB">English (en-GB) | English (United Kingdom)</option>

@laoneo I recommend closing this issue, which was opened for joomla-cypress 1.0.1, as it has been resolved in version 1.0.3.

murrayDI commented 5 months ago

@muhme OK. We will try 1.0.3.

laoneo commented 5 months ago

@murrayDI can you report back if 1.0.3 works for you?

murrayDI commented 5 months ago

@laoneo will do