Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit e11eec7

Browse files
qvalentinGimleux
andauthored
Review Branch (#184)
* Feature/breadcrump and buttons row (#176) * changed toolbar button design * changed toolbar button design * Added dynamic active property to breadcrumb * Extracted FileListHeader from FileList * refactored file list status (Loading Screen) * Added hr to file list - table header * fixed error on FileListItemHeader Extraction * Custom scroll bar Co-authored-by: Gimleux <[email protected]> * Feature/ff 448 search files (#182) * FF-451 blur background of modal * FF-452 api function for search * FF-449 modal for search * FF-450 modal with input and search results * update snapshots * fix linting waring, add hook for this * change BE url again * pre push hook will fail with lint warnings * add autofocus to inputs * update snapshots * improve search function and going to the folder * refactor path state in FileList * display of search results * update snapshots * some css * update snapshots * fix tests * FF-457 add story for search * FF-458 add cypress test for search * clean up tests * remove vertiacal scrolling, improve loading * update tests * FF-471 add external preview link (#183) * FF-471 add external preview link * fix test * remove @tsIgnores Co-authored-by: Gimleux <[email protected]>
1 parent cdfd6da commit e11eec7

29 files changed

+1075
-487
lines changed

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
. "$(dirname "$0")/_/husky.sh"
33

44
npm test -- --watchAll=false
5+
eslint --max-warnings 0 src --ext .ts --ext .tsx --cache

cypress/integration/filesystem.js

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1+
/* eslint no-undef: 0 */
2+
13
import "../support/index";
24

35
describe("The filesystem page", () => {
4-
beforeEach(() => {
5-
cy.log("Login before every test");
6+
beforeEach(() => {
7+
cy.log("Login before every test");
8+
});
69

7-
});
10+
it("changes the url when you click on a file", () => {
11+
cy.loginWithUrl("/file");
12+
cy.get("div.col-md-4.col-6 a").contains("Admin").click();
13+
cy.url().should("include", "/admin");
14+
});
815

9-
it("changes the url when you click on a file", () => {
10-
cy.loginWithUrl("/file");
11-
cy.get("div.col-md-4.col-7").contains("Admin").click();
12-
cy.url().should("include", "/admin");
13-
});
16+
it("goes back to the home of the filesystem", () => {
17+
cy.loginWithUrl("/file/admin");
18+
cy.get("div").contains("Main").click();
19+
cy.url().should("not.include", "/admin");
20+
});
1421

15-
it("goes back to the home of the filesystem", () => {
16-
cy.loginWithUrl("/file/admin");
17-
cy.get("div").contains("Home").click();
18-
cy.url().should("not.include", "/admin");
19-
});
22+
it("shows error message when a path does not exist", () => {
23+
cy.loginWithUrl("/file/fghdhjghjdfhjhdfkhg/dfghjkhghjdfhj");
24+
cy.get("div").contains(
25+
"Folder does not exist, or you are not allowed to see the folder."
26+
);
27+
});
2028

21-
it("shows error message when a path does not exist", () => {
22-
cy.loginWithUrl("/file/fghdhjghjdfhjhdfkhg/dfghjkhghjdfhj");
23-
cy.get("div").contains("Folder does not exist, or you are not allowed to see the folder.")
24-
});
29+
it("finds a folder and enters it", () => {
30+
cy.loginWithUrl("/file");
31+
cy.get("button.btn.btn-outline-secondary.btn-sm")
32+
.contains("Search")
33+
.click();
34+
cy.get("input[id=searchValue]").type("admin");
35+
cy.get(
36+
" div.modal-body > div > div > div.text-truncate.col-6 > a"
37+
).click();
38+
});
2539
});
26-
27-

cypress/integration/login_spec.js

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
describe('The Home Page', () => {
2-
it('successfully loads', () => {
3-
cy.visit('/')
4-
})
1+
/* eslint no-undef: 0 */
52

3+
describe("The Home Page", () => {
4+
it("successfully loads", () => {
5+
cy.visit("/");
6+
});
67

7-
it('sets auth cookie when logging in via form submission', function () {
8-
// destructuring assignment of the this.currentUser object
9-
const username = 'admin';
10-
const password = 'admin';
8+
it("sets auth cookie when logging in via form submission", function () {
9+
const username = "admin";
10+
const password = "admin";
1111

12-
//cy.visit('/login')
13-
14-
cy.get('input[id=formBasicUsername]').type(username)
12+
cy.get("input[id=formBasicUsername]").type(username);
1513

1614
// {enter} causes the form to submit
17-
cy.get('input[id=formBasicPassword]').type(`${password}{enter}`)
18-
19-
// we should be redirected to /dashboard
20-
//cy.url().should('include', '/dashboard')
21-
22-
23-
15+
cy.get("input[id=formBasicPassword]").type(`${password}{enter}`);
2416

2517
// UI should reflect this user being logged in
26-
cy.get('h1').should('contain', 'FileFighter')
18+
cy.get("h1").should("contain", "FileFighter");
2719

2820
// our auth cookie should be present
29-
cy.getCookie('refreshToken').should('exist')
30-
})
31-
32-
})
21+
cy.getCookie("refreshToken").should("exist");
22+
});
23+
});
Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,58 @@
1-
import '../support/index'
1+
/* eslint no-undef: 0 */
22

3-
const password="tghisZHdgaszugi342"
3+
import "../support/index";
44

5-
describe('The register Page', () => {
5+
const password = "tghisZHdgaszugi342";
66

7+
describe("The register Page", () => {
78
beforeEach(() => {
8-
cy.log('Login before every test')
9-
cy.loginWithUrl("")
10-
})
11-
12-
13-
14-
it('registers a user successfully', () => {
15-
16-
17-
18-
cy.get("#ff-heath-table > tbody > tr:nth-child(4) > td:nth-child(2)").contains(/^\d+/).then(($tr)=>
19-
{
20-
const currentUserCount = $tr.text()
21-
22-
23-
24-
25-
cy.log(`current Count of users: ${currentUserCount}`)
26-
console.log(currentUserCount)
27-
28-
cy.get("span.navbar-link-description").contains("Registration").click()
29-
30-
31-
const username = Math.floor(Math.random() * Math.floor(1000000)).toString()
32-
cy.get("#registrationContainer #formBasicUsername").type(username)
33-
cy.get("#formBasicPassword").type(password)
34-
cy.get("#formConfirmPassword").type(password)
35-
36-
cy.get(".btn.btn-primary").contains("Submit").click()
37-
cy.get("span.navbar-link-description").contains("Main").click()
38-
39-
cy.logout()
40-
41-
cy.get('input[id=formBasicUsername]').type(username)
42-
43-
cy.get('input[id=formBasicPassword]').type(`${password}{enter}`)
44-
45-
46-
cy.get('h1').should('contain', 'FileFighter')
47-
48-
49-
let newUserCount = (parseInt(currentUserCount)+1).toString();
50-
cy.log(newUserCount);
51-
52-
cy.get("#ff-heath-table > tbody > tr:nth-child(4) > td:nth-child(2)").contains(/^\d+/).should('contain',newUserCount)
53-
})
54-
})
55-
56-
57-
58-
59-
})
9+
cy.log("Login before every test");
10+
cy.loginWithUrl("");
11+
});
12+
13+
it("registers a user successfully", () => {
14+
cy.get("#ff-heath-table > tbody > tr:nth-child(4) > td:nth-child(2)")
15+
.contains(/^\d+/)
16+
.then(($tr) => {
17+
const currentUserCount = $tr.text();
18+
19+
cy.log(`current Count of users: ${currentUserCount}`);
20+
console.log(currentUserCount);
21+
22+
cy.get("span.navbar-link-description")
23+
.contains("Registration")
24+
.click();
25+
26+
const username = Math.floor(
27+
Math.random() * Math.floor(1000000)
28+
).toString();
29+
cy.get("#registrationContainer #formBasicUsername").type(
30+
username
31+
);
32+
cy.get("#formBasicPassword").type(password);
33+
cy.get("#formConfirmPassword").type(password);
34+
35+
cy.get(".btn.btn-primary").contains("Submit").click();
36+
cy.get("span.navbar-link-description").contains("Main").click();
37+
38+
cy.logout();
39+
40+
cy.get("input[id=formBasicUsername]").type(username);
41+
42+
cy.get("input[id=formBasicPassword]").type(
43+
`${password}{enter}`
44+
);
45+
46+
cy.get("h1").should("contain", "FileFighter");
47+
48+
let newUserCount = (parseInt(currentUserCount) + 1).toString();
49+
cy.log(newUserCount);
50+
51+
cy.get(
52+
"#ff-heath-table > tbody > tr:nth-child(4) > td:nth-child(2)"
53+
)
54+
.contains(/^\d+/)
55+
.should("contain", newUserCount);
56+
});
57+
});
58+
});

0 commit comments

Comments
 (0)