installSpec.js 2.8 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('install', function () {
  25. before(async () => await helper.init(this));
  26. after(async () => await helper.exit());
  27. config.resolutions.forEach(function (resolution) {
  28. it('show-page.' + resolution.title, async function () {
  29. // (test, route, prepare, action, options
  30. return helper.takeAndCompare(this, 'index.php', async (page) => {
  31. await helper.delay(100);
  32. await page.$eval('body', function (e) {
  33. $('#adminlogin').blur();
  34. });
  35. await helper.delay(100);
  36. }, { waitUntil: 'networkidle0', viewport: resolution});
  37. });
  38. it('show-advanced.' + resolution.title, async function () {
  39. // (test, route, prepare, action, options
  40. return helper.takeAndCompare(this, undefined, async (page) => {
  41. await page.click('#showAdvanced');
  42. await helper.delay(300);
  43. }, { waitUntil: 'networkidle0', viewport: resolution});
  44. });
  45. it('show-advanced-mysql.' + resolution.title, async function () {
  46. // (test, route, prepare, action, options
  47. return helper.takeAndCompare(this, undefined, async (page) => {
  48. await page.click('label.mysql');
  49. await helper.delay(300);
  50. }, { waitUntil: 'networkidle0', viewport: resolution});
  51. });
  52. });
  53. it('runs', async function () {
  54. this.timeout(5*60*1000);
  55. helper.pageBase.setDefaultNavigationTimeout(5*60*1000);
  56. helper.pageCompare.setDefaultNavigationTimeout(5*60*1000);
  57. // just run for one resolution since we can only install once
  58. return helper.takeAndCompare(this, 'index.php', async function (page) {
  59. const login = await page.type('#adminlogin', 'admin');
  60. const password = await page.type('#adminpass', 'admin');
  61. const inputElement = await page.$('input[type=submit]');
  62. await inputElement.click();
  63. await page.waitForNavigation({waitUntil: 'networkidle2'});
  64. await page.waitForSelector('#header');
  65. helper.pageBase.setDefaultNavigationTimeout(60000);
  66. helper.pageCompare.setDefaultNavigationTimeout(60000);
  67. }, { waitUntil: 'networkidle0', viewport: {w: 1920, h: 1080}});
  68. });
  69. });