Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

45 рядки
1.4 KiB

  1. context('Control Duration', () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit('/app/space/Website');
  5. });
  6. function get_dialog_with_duration(hide_days = 0, hide_seconds = 0) {
  7. return cy.dialog({
  8. title: 'Duration',
  9. fields: [{
  10. 'fieldname': 'duration',
  11. 'fieldtype': 'Duration',
  12. 'hide_days': hide_days,
  13. 'hide_seconds': hide_seconds
  14. }]
  15. });
  16. }
  17. it('should set duration', () => {
  18. get_dialog_with_duration().as('dialog');
  19. cy.get('.frappe-control[data-fieldname=duration] input')
  20. .first()
  21. .click();
  22. cy.get('.duration-input[data-duration=days]')
  23. .type(45, { force: true })
  24. .blur({ force: true });
  25. cy.get('.duration-input[data-duration=minutes]')
  26. .type(30)
  27. .blur({ force: true });
  28. cy.get('.frappe-control[data-fieldname=duration] input').first().should('have.value', '45d 30m');
  29. cy.get('.frappe-control[data-fieldname=duration] input').first().blur();
  30. cy.get('.duration-picker').should('not.be.visible');
  31. cy.get('@dialog').then(dialog => {
  32. let value = dialog.get_value('duration');
  33. expect(value).to.equal(3889800);
  34. });
  35. });
  36. it('should hide days or seconds according to duration options', () => {
  37. get_dialog_with_duration(1, 1).as('dialog');
  38. cy.get('.frappe-control[data-fieldname=duration] input').first().click();
  39. cy.get('.duration-input[data-duration=days]').should('not.be.visible');
  40. cy.get('.duration-input[data-duration=seconds]').should('not.be.visible');
  41. });
  42. });