svg.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* globals stats, valueToPoint */
  2. module.exports = {
  3. 'svg': function (browser) {
  4. browser
  5. .url('http://localhost:8080/examples/svg/')
  6. .waitForElementVisible('svg', 1000)
  7. .assert.count('g', 1)
  8. .assert.count('polygon', 1)
  9. .assert.count('circle', 1)
  10. .assert.count('text', 6)
  11. .assert.count('label', 6)
  12. .assert.count('button', 7)
  13. .assert.count('input[type="range"]', 6)
  14. .assert.evaluate(function () {
  15. const points = stats.map(function (stat, i) {
  16. const point = valueToPoint(stat.value, i, 6)
  17. return point.x + ',' + point.y
  18. }).join(' ')
  19. return document.querySelector('polygon').attributes[0].value === points
  20. })
  21. .click('button.remove')
  22. .assert.count('text', 5)
  23. .assert.count('label', 5)
  24. .assert.count('button', 6)
  25. .assert.count('input[type="range"]', 5)
  26. .assert.evaluate(function () {
  27. const points = stats.map(function (stat, i) {
  28. const point = valueToPoint(stat.value, i, 5)
  29. return point.x + ',' + point.y
  30. }).join(' ')
  31. return document.querySelector('polygon').attributes[0].value === points
  32. })
  33. .setValue('input[name="newlabel"]', 'foo')
  34. .click('#add > button')
  35. .assert.count('text', 6)
  36. .assert.count('label', 6)
  37. .assert.count('button', 7)
  38. .assert.count('input[type="range"]', 6)
  39. .assert.evaluate(function () {
  40. const points = stats.map(function (stat, i) {
  41. const point = valueToPoint(stat.value, i, 6)
  42. return point.x + ',' + point.y
  43. }).join(' ')
  44. return document.querySelector('polygon').attributes[0].value === points
  45. })
  46. .end()
  47. }
  48. }