Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

54 linhas
1.3 KiB

  1. context('Control Barcode', () => {
  2. beforeEach(() => {
  3. cy.login();
  4. cy.visit('/app/website');
  5. });
  6. function get_dialog_with_barcode() {
  7. return cy.dialog({
  8. title: 'Barcode',
  9. fields: [
  10. {
  11. label: 'Barcode',
  12. fieldname: 'barcode',
  13. fieldtype: 'Barcode'
  14. }
  15. ]
  16. });
  17. }
  18. it('should generate barcode on setting a value', () => {
  19. get_dialog_with_barcode().as('dialog');
  20. cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox')
  21. .type('123456789')
  22. .blur();
  23. cy.get('.frappe-control[data-fieldname=barcode] svg[data-barcode-value="123456789"]')
  24. .should('exist');
  25. cy.get('@dialog').then(dialog => {
  26. let value = dialog.get_value('barcode');
  27. expect(value).to.contain('<svg');
  28. expect(value).to.contain('data-barcode-value="123456789"');
  29. });
  30. });
  31. it('should reset when input is cleared', () => {
  32. get_dialog_with_barcode().as('dialog');
  33. cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox')
  34. .type('123456789')
  35. .blur();
  36. cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox')
  37. .clear()
  38. .blur();
  39. cy.get('.frappe-control[data-fieldname=barcode] svg[data-barcode-value="123456789"]')
  40. .should('not.exist');
  41. cy.get('@dialog').then(dialog => {
  42. let value = dialog.get_value('barcode');
  43. expect(value).to.equal('');
  44. });
  45. });
  46. });