settings.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const apiUrl = Cypress.env('apiUrl');
  2. describe('Templates', () => {
  3. it('Opens settings page', () => {
  4. cy.resetDB();
  5. cy.loginAndVisit('/settings');
  6. });
  7. it('Changes some settings', () => {
  8. const rootURL = 'http://127.0.0.1:9000';
  9. const faveURL = 'http://127.0.0.1:9000/public/static/logo.png';
  10. cy.get('input[name="app.root_url"]').clear().type(rootURL);
  11. cy.get('input[name="app.favicon_url"]').type(faveURL);
  12. cy.get('.b-tabs nav a').eq(1).click();
  13. cy.get('.tab-item:visible').find('.field').first()
  14. .find('button')
  15. .first()
  16. .click();
  17. // Enable / disable SMTP and delete one.
  18. cy.get('.b-tabs nav a').eq(4).click();
  19. cy.get('.tab-item:visible [data-cy=btn-enable-smtp]').eq(1).click();
  20. cy.get('.tab-item:visible [data-cy=btn-delete-smtp]').first().click();
  21. cy.get('.modal button.is-primary').click();
  22. cy.get('[data-cy=btn-save]').click();
  23. cy.wait(250);
  24. // Verify the changes.
  25. cy.request(`${apiUrl}/api/settings`).should((response) => {
  26. const { data } = response.body;
  27. expect(data['app.root_url']).to.equal(rootURL);
  28. expect(data['app.favicon_url']).to.equal(faveURL);
  29. expect(data['app.concurrency']).to.equal(9);
  30. expect(data.smtp.length).to.equal(1);
  31. expect(data.smtp[0].enabled).to.equal(true);
  32. });
  33. });
  34. });