25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

77 lines
2.6 KiB

  1. context('Control Color', () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit('/app/website');
  5. });
  6. function get_dialog_with_color() {
  7. return cy.dialog({
  8. title: 'Color',
  9. fields: [{
  10. label: 'Color',
  11. fieldname: 'color',
  12. fieldtype: 'Color'
  13. }]
  14. });
  15. }
  16. it('Verifying if the color control is selecting correct', () => {
  17. get_dialog_with_color().as('dialog');
  18. cy.findByPlaceholderText('Choose a color').click();
  19. ///Selecting a color from the color palette
  20. cy.get('[style="background-color: rgb(79, 157, 217);"]').click();
  21. //Checking if the css attribute is correct
  22. cy.get('.color-map').should('have.css', 'color', 'rgb(79, 157, 217)');
  23. cy.get('.hue-map').should('have.css', 'color', 'rgb(0, 145, 255)');
  24. //Checking if the correct color is being selected
  25. cy.get('@dialog').then(dialog => {
  26. let value = dialog.get_value('color');
  27. expect(value).to.equal('#4F9DD9');
  28. });
  29. //Selecting a color
  30. cy.get('[style="background-color: rgb(203, 41, 41);"]').click();
  31. //Checking if the correct css is being selected
  32. cy.get('.color-map').should('have.css', 'color', 'rgb(203, 41, 41)');
  33. cy.get('.hue-map').should('have.css', 'color', 'rgb(255, 0, 0)');
  34. //Checking if the correct color is being selected
  35. cy.get('@dialog').then(dialog => {
  36. let value = dialog.get_value('color');
  37. expect(value).to.equal('#CB2929');
  38. });
  39. //Selecting color from the palette
  40. cy.get('.color-map > .color-selector').click(65, 87, {force: true});
  41. cy.get('.color-map').should('have.css', 'color', 'rgb(56, 0, 0)');
  42. //Checking if the expected color is selected and getting displayed
  43. cy.get('@dialog').then(dialog => {
  44. let value = dialog.get_value('color');
  45. expect(value).to.equal('#380000');
  46. });
  47. //Selecting the color from the hue map
  48. cy.get('.hue-map > .hue-selector').click(35, -1, {force: true});
  49. cy.get('.color-map').should('have.css', 'color', 'rgb(56, 45, 0)');
  50. cy.get('.hue-map').should('have.css', 'color', 'rgb(255, 204, 0)');
  51. cy.get('.color-map > .color-selector').click(55, 12, {force: true});
  52. cy.get('.color-map').should('have.css', 'color', 'rgb(46, 37, 0)');
  53. //Checking if the correct color is being displayed
  54. cy.get('@dialog').then(dialog => {
  55. let value = dialog.get_value('color');
  56. expect(value).to.equal('#2e2500');
  57. });
  58. //Clearing the field and checking if the field contains the placeholder "Choose a color"
  59. cy.get('.input-with-feedback').click({force: true});
  60. cy.get_field('color', 'Color').type('{selectall}').clear();
  61. cy.get_field('color', 'Color').invoke('attr', 'placeholder').should('contain', 'Choose a color');
  62. });
  63. });