You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

einkaufszettel-test.js 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { module, test } from 'qunit';
  2. import { click, visit, currentURL } from '@ember/test-helpers';
  3. import { setupApplicationTest } from 'ember-qunit';
  4. module('Acceptance | einkaufszettel', function(hooks) {
  5. setupApplicationTest(hooks);
  6. test('visiting /einkaufszettel', async function(assert) {
  7. await visit('/');
  8. assert.equal(currentURL(), '/');
  9. assert.dom('nav').exists();
  10. assert.dom('nav a.menu-index').hasText('EinkaufsZettel');
  11. assert.dom('nav a.menu-zettel').hasText('Zettel');
  12. assert.dom('nav a.menu-produkte').hasText('Produkte');
  13. assert.dom('nav a.menu-rezepte').hasText('Rezepte');
  14. });
  15. test('navigating using the nav-bar', async function(assert) {
  16. await visit('/');
  17. assert.dom('nav').exists();
  18. assert.dom('nav a.menu-index').hasText('EinkaufsZettel');
  19. assert.dom('nav a.menu-zettel').hasText('Zettel');
  20. assert.dom('nav a.menu-produkte').hasText('Produkte');
  21. assert.dom('nav a.menu-rezepte').hasText('Rezepte');
  22. await click('nav a.menu-zettel');
  23. assert.equal(currentURL(), '/zettel');
  24. await click('nav a.menu-produkte');
  25. assert.equal(currentURL(), '/produkte');
  26. await click('nav a.menu-rezepte');
  27. assert.equal(currentURL(), '/rezepte');
  28. await click('nav a.menu-index');
  29. assert.equal(currentURL(), '/');
  30. });
  31. test('visiting /zettel', async function(assert) {
  32. await visit('/zettel');
  33. assert.dom('nav').exists();
  34. assert.dom('nav a.menu-index').hasText('EinkaufsZettel');
  35. assert.dom('nav a.menu-zettel').hasText('Zettel');
  36. assert.dom('nav a.menu-produkte').hasText('Produkte');
  37. assert.dom('nav a.menu-rezepte').hasText('Rezepte');
  38. assert.dom('.jumbo h2').hasText('deine Zettel');
  39. assert.dom('.jumbo a.button').hasText('Zettel aktualisieren');
  40. await click('.jumbo a.button');
  41. assert.equal(currentURL(), '/zettel');
  42. });
  43. test('visiting /produkte', async function(assert) {
  44. await visit('/produkte');
  45. assert.dom('nav').exists();
  46. assert.dom('nav a.menu-index').hasText('EinkaufsZettel');
  47. assert.dom('nav a.menu-zettel').hasText('Zettel');
  48. assert.dom('nav a.menu-produkte').hasText('Produkte');
  49. assert.dom('nav a.menu-rezepte').hasText('Rezepte');
  50. assert.dom('.jumbo h2').hasText('deine Produkte');
  51. assert.dom('.jumbo a.button').hasText('Produkt hinzufügen');
  52. await click('.jumbo a.button');
  53. assert.equal(currentURL(), '/neues-produkt');
  54. });
  55. test('visiting /rezepte', async function(assert) {
  56. await visit('/rezepte');
  57. assert.dom('nav').exists();
  58. assert.dom('nav a.menu-index').hasText('EinkaufsZettel')
  59. assert.dom('nav a.menu-zettel').hasText('Zettel');
  60. assert.dom('nav a.menu-produkte').hasText('Produkte');
  61. assert.dom('nav a.menu-rezepte').hasText('Rezepte');
  62. assert.dom('.jumbo h2').hasText('deine Rezepte');
  63. assert.dom('.jumbo a.button').hasText('Rezepte bearbeiten');
  64. await click('.jumbo a.button');
  65. assert.equal(currentURL(), '/rezepte');
  66. });
  67. });