Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-38179

Add a "click on" step definition which locator scope is limited to a html table row




      During behat tests creation I'm finding out that, when displaying table-based moodle elements, is common that the commands are using a generic text string; for example in the groupings list, the last row includes a list of commands (edit/delete/show groups in grouping) and they are using ALT attributes like "Edit" or "Delete".

      Both for accessiblity and for writting behat tests easily (right now the only option is with XPath, which requires more time and is less maintainable) would be better to use text strings that allows us to differentiate between the different instances they point to, something like "Edit grouping-name-1 grouping" instead of "Edit" everywhere. Neither this way seems a correct approach as it would require us to add tons of new strings "Edit grouping-name-1 grouping", "Delete grouping-name-1 grouping", "Edit group-name-1 group".... so I would propose to add command-genericelement strings also avoiding problems with RTL or other language specific issues, for example:

      $groupingname = 'Grouping1';
      echo get_string('editelement', 'moodle', $groupingname); // "Edit {$a}"
      // Displays "Edit Grouping1"

      Right now edit, delete and this kind of generic actions is what I'm thinking of, but it will not be enough and IMO strings like "Show groups in grouping" should also be changed to something more distinctive like "Show grouping-name-1 groups", I guess this will be a problem for language maintainers and I don't know if I'm missing something important so I'd like to hear more opinions about it.


        Issue Links



              dmonllao David Monllaó
              dmonllao David Monllaó
              Dan Poltawski Dan Poltawski
              Nobody Nobody
              0 Vote for this issue
              1 Start watching this issue