1
0

filesSpec.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 puppeteer = require('puppeteer');
  23. const helper = require('../helper.js');
  24. const config = require('../config.js');
  25. describe('files', function () {
  26. before(async () => {
  27. await helper.init(this)
  28. await helper.login(this)
  29. });
  30. after(async () => await helper.exit());
  31. config.resolutions.forEach(function (resolution) {
  32. it('file-sidebar-share.' + resolution.title, async function () {
  33. return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) {
  34. let element = await page.$('[data-file="welcome.txt"] .action-share');
  35. await element.click('[data-file="welcome.txt"] .action-share');
  36. await page.waitForSelector('.shareWithField');
  37. await helper.delay(500);
  38. await page.$eval('body', e => { $('.shareWithField').blur() });
  39. }, {viewport: resolution});
  40. });
  41. it('file-popover.' + resolution.title, async function () {
  42. return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) {
  43. await page.click('[data-file=\'welcome.txt\'] .action-menu');
  44. await page.waitForSelector('.fileActionsMenu');
  45. }, {viewport: resolution});
  46. });
  47. it('file-sidebar-details.' + resolution.title, async function() {
  48. return helper.takeAndCompare(this, undefined, async function (page) {
  49. await page.click('[data-file=\'welcome.txt\'] .fileActionsMenu [data-action=\'Details\']');
  50. await page.waitForSelector('[data-tabid=\'commentsTabView\']');
  51. await page.$eval('body', e => { $('.shareWithField').blur() });
  52. await helper.delay(500); // wait for animation
  53. }, {viewport: resolution});
  54. });
  55. it('file-sidebar-details-sharing.' + resolution.title, async function() {
  56. return helper.takeAndCompare(this, undefined, async function (page) {
  57. let tab = await helper.childOfClassByText(page, 'tabHeaders', 'Sharing');
  58. tab[0].click();
  59. await page.waitForSelector('input.shareWithField');
  60. await page.$eval('body', e => { $('.shareWithField').blur() });
  61. await helper.delay(500); // wait for animation
  62. }, {viewport: resolution});
  63. });
  64. it('file-sidebar-details-versions.' + resolution.title, async function() {
  65. return helper.takeAndCompare(this, undefined, async function (page) {
  66. let tab = await helper.childOfClassByText(page, 'tabHeaders', 'Versions');
  67. tab[0].click();
  68. await helper.delay(100); // wait for animation
  69. }, {viewport: resolution});
  70. });
  71. it('file-popover.favorite.' + resolution.title, async function () {
  72. return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) {
  73. await page.click('[data-file=\'welcome.txt\'] .action-menu');
  74. await page.waitForSelector('.fileActionsMenu')
  75. await page.click('[data-file=\'welcome.txt\'] .fileActionsMenu [data-action=\'Favorite\']');;
  76. }, {viewport: resolution});
  77. });
  78. it('file-favorites.' + resolution.title, async function () {
  79. return helper.takeAndCompare(this, 'index.php/apps/files', async function (page) {
  80. try {
  81. await page.waitForSelector('#app-navigation-toggle', {
  82. visible: true,
  83. timeout: 1000,
  84. }).then((element) => element.click())
  85. } catch (err) {}
  86. await page.click('#app-navigation [data-id=\'favorites\'] a');
  87. await helper.delay(500); // wait for animation
  88. }, {viewport: resolution});
  89. });
  90. });
  91. });