settingsSpec.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * @copyright 2018 Julius Härtl <jus@bitgrid.net>
  3. *
  4. * @author 2018 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. const helper = require('../helper.js');
  23. const config = require('../config.js');
  24. describe('settings', function () {
  25. before(async () => {
  26. await helper.init(this)
  27. await helper.login(this)
  28. });
  29. after(async () => await helper.exit());
  30. config.resolutions.forEach(function (resolution) {
  31. it('personal.' + resolution.title, async function () {
  32. return helper.takeAndCompare(this, 'index.php/settings/user', async function (page) {
  33. }, {viewport: resolution});
  34. });
  35. it('admin.' + resolution.title, async function () {
  36. return helper.takeAndCompare(this, 'index.php/settings/admin', async function (page) {
  37. }, {viewport: resolution});
  38. });
  39. ['sharing', 'security', 'theming', 'encryption', 'additional', 'tips-tricks'].forEach(function(endpoint) {
  40. it('admin.' + endpoint + '.' + resolution.title, async function () {
  41. return helper.takeAndCompare(this, 'index.php/settings/admin/' + endpoint, async function (page) {
  42. }, {viewport: resolution, waitUntil: 'networkidle2'});
  43. });
  44. });
  45. it('usermanagement.' + resolution.title, async function () {
  46. return helper.takeAndCompare(this, 'index.php/settings/users', async function (page) {
  47. }, {viewport: resolution});
  48. });
  49. it('usermanagement.add.' + resolution.title, async function () {
  50. return helper.takeAndCompare(this, undefined, async function (page) {
  51. try {
  52. await page.waitForSelector('#app-navigation-toggle', {
  53. visible: true,
  54. timeout: 1000,
  55. }).then((element) => element.click())
  56. } catch (err) {}
  57. let newUserButton = await page.waitForSelector('#new-user-button');
  58. await newUserButton.click();
  59. await helper.delay(200);
  60. await page.$eval('body', function (e) {
  61. $('#newusername').blur();
  62. })
  63. await helper.delay(100);
  64. }, {viewport: resolution});
  65. });
  66. });
  67. });