summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/tests/files/folder_spec.js
blob: 0b143ea0d33b18d91cf4648c5d20ffe5d705cb4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var LoginPage = require('../pages/login.page.js');
var FilesPage = require('../pages/files.page.js');


// ============================ FOLDERS ============================================================== //
// =================================================================================================== //

describe('Folders', function() {
  var params = browser.params;
  var filesPage;
  
  beforeEach(function() {
    isAngularSite(false);
    filesPage = new FilesPage(params.baseUrl);
    filesPage.getAsUser(params.login.user, params.login.password);
  });

  it('should create a new folder', function() {
    filesPage.createNewFolder('testFolder');
    expect(filesPage.listFiles()).toContain('testFolder');
  });

  it('should not create new folder if foldername already exists', function() {
    filesPage.createNewFolder('testFolder');
    var warning = by.css('.tipsy-inner');
    expect(filesPage.alertWarning.isDisplayed()).toBeTruthy();
  });

  it('should delete a folder', function() {
    filesPage.get(); // TODO: reload cause warning alerts don't disappear
    browser.wait(function() {
      return(filesPage.listFiles());
    }, 3000);
    filesPage.deleteFile('testFolder');
    browser.sleep(800);
    expect(filesPage.listFiles()).not.toContain('testFolder');
  });
});

// ============================== SUB FOLDERS ======================================================== //
// =================================================================================================== //

describe('Subfolders', function() {
  var params = browser.params;
  var filesPage;
  
  beforeEach(function() {
    isAngularSite(false);
    filesPage = new FilesPage(params.baseUrl);
    filesPage.getAsUser(params.login.user, params.login.password);
  });


  it('should go into folder and create subfolder', function() {
    var folder = 'hasSubFolder';
    filesPage.createNewFolder(folder);
    filesPage.goInToFolder(folder);
    filesPage.createNewFolder('SubFolder');
    filesPage.createNewFolder('SubFolder2');
    expect(filesPage.listFiles()).toContain('SubFolder', 'SubFolder2');
  });  

  it('should rename a subfolder', function() {
    filesPage.renameFile('SubFolder2', 'NewSubFolder');
    browser.wait(function() {
      return(filesPage.listFiles());
    }, 3000);
    expect(filesPage.listFiles()).toContain('NewSubFolder');
  });

  it('should delete a subfolder', function() {
    filesPage.deleteFile('SubFolder');
    browser.sleep(800);
    expect(filesPage.listFiles()).not.toContain('SubFolder');
  });

  it('should delete a folder containing a subfolder', function() {
    filesPage.get();
    browser.wait(function() {
      return(filesPage.listFiles());
    }, 3000);
    filesPage.deleteFile('hasSubFolder');
    browser.sleep(800);
    expect(filesPage.listFiles()).not.toContain('hasSubFolder');
  });
});