adaptlearning / adapt_framework

A toolkit for creating responsive, accessible, multilanguage HTML5 e-learning courses.
https://www.adaptlearning.org/
GNU General Public License v3.0
576 stars 247 forks source link

Chore: Added testMultipleForContainsOrNotExists command for passing array of objects to test #3536

Closed cahirodoherty-learningpool closed 5 months ago

cahirodoherty-learningpool commented 6 months ago

Addresses #3535

Chore

oliverfoster commented 6 months ago

Where would you need this:

cy.testMultipleForContainsOrNotExists([
  {
    target: 'selector',
    value: 'value',
    stripHtml: true
  },
  {
    target: 'selector1',
    value: 'value1',
    stripHtml: true
  },
  {
    target: 'selector2',
    value: 'value2',
    stripHtml: false
  }
])

Where you couldn't use this:

const stripHtml = cy.helpers.stripHtml
cy.testContainsOrNotExists({
  'selector': stripHtml('value'),
  'selector1': stripHtml('value1'),
  'selector2': 'value2'
})

It seems like overkill to have both functions, or at least overkill to add a shortcut that's longer than the original shortcut.

oliverfoster commented 5 months ago

Where would you need this:

cy.testMultipleForContainsOrNotExists([
  {
    target: 'selector',
    value: 'value',
    stripHtml: true
  },
  {
    target: 'selector1',
    value: 'value1',
    stripHtml: true
  },
  {
    target: 'selector2',
    value: 'value2',
    stripHtml: false
  }
])

Where you couldn't use this:

const stripHtml = cy.helpers.stripHtml
cy.testContainsOrNotExists({
  'selector': stripHtml('value'),
  'selector1': stripHtml('value1'),
  'selector2': 'value2'
})

It seems like overkill to have both functions, or at least overkill to add a shortcut that's longer than the original shortcut.

^ @cahirodoherty-learningpool