mirror of
https://github.com/filegator/filegator.git
synced 2025-08-11 15:53:59 +02:00
cypress e2e tests;
This commit is contained in:
@@ -25,13 +25,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a class="is-paddingless" @click="selectDir">
|
<a id="sitemap" class="is-paddingless" @click="selectDir">
|
||||||
<b-icon icon="sitemap" class="is-marginless" size="is-small" />
|
<b-icon icon="sitemap" class="is-marginless" size="is-small" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="actions is-flex is-justify-between">
|
<section id="multi-actions" class="is-flex is-justify-between">
|
||||||
<div>
|
<div>
|
||||||
<b-field v-if="can('upload') && ! checked.length" class="file is-inline-block">
|
<b-field v-if="can('upload') && ! checked.length" class="file is-inline-block">
|
||||||
<b-upload multiple native @input="files = $event">
|
<b-upload multiple native @input="files = $event">
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
{{ props.row.time ? formatDate(props.row.time) : '' }}
|
{{ props.row.time ? formatDate(props.row.time) : '' }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column class="action-padding" width="51">
|
<b-table-column id="single-actions" width="51">
|
||||||
<b-dropdown v-if="props.row.type != 'back'" :disabled="checked.length > 0" aria-role="list" position="is-bottom-left">
|
<b-dropdown v-if="props.row.type != 'back'" :disabled="checked.length > 0" aria-role="list" position="is-bottom-left">
|
||||||
<button slot="trigger" class="button is-small">
|
<button slot="trigger" class="button is-small">
|
||||||
<b-icon icon="ellipsis-h" size="is-small" />
|
<b-icon icon="ellipsis-h" size="is-small" />
|
||||||
@@ -541,10 +541,10 @@ export default {
|
|||||||
.breadcrumb a {
|
.breadcrumb a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.actions {
|
#multi-actions {
|
||||||
min-height: 55px;
|
min-height: 55px;
|
||||||
}
|
}
|
||||||
.actions a {
|
#multi-actions a {
|
||||||
margin: 0 15px 15px 0;
|
margin: 0 15px 15px 0;
|
||||||
}
|
}
|
||||||
.file-row a {
|
.file-row a {
|
||||||
@@ -553,7 +553,7 @@ export default {
|
|||||||
.file-row.type-dir a.name {
|
.file-row.type-dir a.name {
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
}
|
}
|
||||||
.action-padding {
|
#single-actions {
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
}
|
}
|
||||||
.drop-info {
|
.drop-info {
|
||||||
|
1
tests/frontend/e2e/fixtures/dir_home.json
Normal file
1
tests/frontend/e2e/fixtures/dir_home.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"data":{"location":"\/","files":[{"type":"dir","path":"\/Folder","name":"Folder","size":0,"time":1561107605},{"type":"dir","path":"\/My Documents","name":"My Documents","size":0,"time":1561111756},{"type":"dir","path":"\/Projects","name":"Projects","size":0,"time":1560583678},{"type":"dir","path":"\/Test","name":"Test","size":0,"time":1561108206},{"type":"file","path":"\/Brochure.pdf","name":"Brochure.pdf","size":70646,"time":1561112785},{"type":"file","path":"\/compressed.zip","name":"compressed.zip","size":217,"time":1561107915},{"type":"file","path":"\/english.js","name":"english.js","size":2434,"time":1560581859},{"type":"file","path":"\/logo.png","name":"logo.png","size":13638,"time":1560581761},{"type":"file","path":"\/read_only_demo.txt","name":"read_only_demo.txt","size":31,"time":1561107677}]}}
|
1
tests/frontend/e2e/fixtures/dir_mydocs.json
Normal file
1
tests/frontend/e2e/fixtures/dir_mydocs.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"data":{"location":"\/My Documents","files":[{"type":"back","path":"\/","name":"..","size":0,"time":0},{"type":"file","path":"\/My Documents\/Cool Project.doc","name":"Cool Project.doc","size":13638,"time":1560583727},{"type":"file","path":"\/My Documents\/Document-1.doc","name":"Document-1.doc","size":13638,"time":1560583594},{"type":"file","path":"\/My Documents\/Document-2.doc","name":"Document-2.doc","size":13638,"time":1560583597},{"type":"file","path":"\/My Documents\/logo.png","name":"logo.png","size":13638,"time":1560583532}]}}
|
12
tests/frontend/e2e/fixtures/getconfig.json
Normal file
12
tests/frontend/e2e/fixtures/getconfig.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"app_name": "FileGator",
|
||||||
|
"app_version": "7.0.0-RC3",
|
||||||
|
"language": "english",
|
||||||
|
"logo": "",
|
||||||
|
"upload_max_size": 104857600,
|
||||||
|
"upload_chunk_size": 1048576,
|
||||||
|
"upload_simultaneous": 3,
|
||||||
|
"default_archive_name": "archive.zip"
|
||||||
|
}
|
||||||
|
}
|
16
tests/frontend/e2e/fixtures/getuser.json
Normal file
16
tests/frontend/e2e/fixtures/getuser.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"role": "guest",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\\/",
|
||||||
|
"username": "guest",
|
||||||
|
"name": "Guest"
|
||||||
|
}
|
||||||
|
}
|
46
tests/frontend/e2e/fixtures/listusers.json
Normal file
46
tests/frontend/e2e/fixtures/listusers.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"role": "admin",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\/",
|
||||||
|
"username": "admin",
|
||||||
|
"name": "Admin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "guest",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\/",
|
||||||
|
"username": "guest",
|
||||||
|
"name": "Guest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\/",
|
||||||
|
"username": "john",
|
||||||
|
"name": "john"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
16
tests/frontend/e2e/fixtures/login_admin.json
Normal file
16
tests/frontend/e2e/fixtures/login_admin.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"role": "admin",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\/",
|
||||||
|
"username": "admin",
|
||||||
|
"name": "Admin"
|
||||||
|
}
|
||||||
|
}
|
16
tests/frontend/e2e/fixtures/login_user.json
Normal file
16
tests/frontend/e2e/fixtures/login_user.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"role": "user",
|
||||||
|
"permissions": [
|
||||||
|
"read",
|
||||||
|
"write",
|
||||||
|
"upload",
|
||||||
|
"download",
|
||||||
|
"batchdownload",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"homedir": "\/",
|
||||||
|
"username": "john",
|
||||||
|
"name": "John"
|
||||||
|
}
|
||||||
|
}
|
@@ -1,8 +1,124 @@
|
|||||||
// https://docs.cypress.io/api/introduction/api.html
|
// https://docs.cypress.io/api/introduction/api.html
|
||||||
|
Cypress.Cookies.defaults({
|
||||||
|
whitelist: 'filegator' // do not clear this cookie every time
|
||||||
|
})
|
||||||
|
|
||||||
describe('My First Test', () => {
|
describe('Browser', () => {
|
||||||
it('Visits the app root url', () => {
|
|
||||||
|
// once before any of the tests run.
|
||||||
|
before(function () {
|
||||||
|
})
|
||||||
|
|
||||||
|
// before each test
|
||||||
|
beforeEach(function () {
|
||||||
|
cy.server()
|
||||||
|
cy.route('GET', '?r=/getconfig', 'fixture:getconfig')
|
||||||
|
cy.route('GET', '?r=/getuser', 'fixture:getuser')
|
||||||
|
cy.route('POST', '?r=/getdir', 'fixture:dir_home')
|
||||||
|
cy.route('POST', '?r=/changedir', 'fixture:dir_mydocs')
|
||||||
|
cy.route('GET', '?r=/listusers', 'fixture:listusers')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Visits the root', () => {
|
||||||
cy.visit('/')
|
cy.visit('/')
|
||||||
cy.contains('h1', 'Welcome to Your Vue.js App')
|
cy.contains('My Documents')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Go to subfolder', () => {
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('My Documents').click()
|
||||||
|
cy.contains('Cool Project.doc')
|
||||||
|
cy.contains('Home')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Login admin', function() {
|
||||||
|
cy.viewport(1024, 768)
|
||||||
|
cy.route('POST', '?r=/login', 'fixture:login_admin')
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('Log in').click()
|
||||||
|
cy.get('input[name="username"]').type('admin')
|
||||||
|
cy.get('input[type="password"]').type('admin123')
|
||||||
|
cy.contains('Log in').click()
|
||||||
|
|
||||||
|
cy.contains('a.navbar-item', 'Files')
|
||||||
|
cy.contains('a.navbar-item', 'Users')
|
||||||
|
cy.contains('a.navbar-item', 'Log out')
|
||||||
|
cy.contains('a.navbar-item', 'Profile').click()
|
||||||
|
cy.contains('.modal', 'Old password')
|
||||||
|
cy.contains('.modal', 'New password')
|
||||||
|
cy.get('.modal-close').click()
|
||||||
|
cy.contains('a.navbar-item', 'Users').click()
|
||||||
|
cy.contains('admin')
|
||||||
|
cy.contains('guest')
|
||||||
|
cy.contains('john').click()
|
||||||
|
cy.contains('.modal', 'Role')
|
||||||
|
cy.contains('.modal', 'Username')
|
||||||
|
cy.contains('.modal', 'Name')
|
||||||
|
cy.contains('.modal', 'Password')
|
||||||
|
cy.contains('.modal', 'Home Folder')
|
||||||
|
cy.contains('.modal', 'Permissions')
|
||||||
|
cy.contains('.modal .field', 'Read')
|
||||||
|
cy.contains('.modal .field', 'Write')
|
||||||
|
cy.contains('.modal .field', 'Upload')
|
||||||
|
cy.contains('.modal .field', 'Download')
|
||||||
|
cy.contains('.modal .field', 'Batch Download')
|
||||||
|
cy.contains('.modal .field', 'Zip')
|
||||||
|
cy.get('.modal-close').click()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Check multiple files', () => {
|
||||||
|
cy.viewport(1024, 768)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('Selected: 0 of 9')
|
||||||
|
cy.contains('#multi-actions', 'Add files')
|
||||||
|
cy.contains('#multi-actions', 'New')
|
||||||
|
cy.get('span.check').first().click()
|
||||||
|
cy.contains('Selected: 9 of 9')
|
||||||
|
cy.contains('#multi-actions', 'Download')
|
||||||
|
cy.contains('#multi-actions', 'Copy')
|
||||||
|
cy.contains('#multi-actions', 'Move')
|
||||||
|
cy.contains('#multi-actions', 'Zip')
|
||||||
|
cy.contains('#multi-actions', 'Delete')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Single dir actions', () => {
|
||||||
|
cy.viewport(1024, 768)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('tr.type-dir', 'Copy')
|
||||||
|
cy.contains('tr.type-dir', 'Move')
|
||||||
|
cy.contains('tr.type-dir', 'Rename')
|
||||||
|
cy.contains('tr.type-dir', 'Zip')
|
||||||
|
cy.contains('tr.type-dir', 'Delete')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Single file actions', () => {
|
||||||
|
cy.viewport(1024, 768)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('tr.type-file', 'Download')
|
||||||
|
cy.contains('tr.type-file', 'Copy')
|
||||||
|
cy.contains('tr.type-file', 'Move')
|
||||||
|
cy.contains('tr.type-file', 'Rename')
|
||||||
|
cy.contains('tr.type-file', 'Zip')
|
||||||
|
cy.contains('tr.type-file', 'Unzip')
|
||||||
|
cy.contains('tr.type-file', 'Delete')
|
||||||
|
cy.contains('tr.type-file', 'Copy link')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('New folder and file', () => {
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('New').click()
|
||||||
|
cy.contains('.dropdown-content', 'Folder')
|
||||||
|
cy.contains('.dropdown-content', 'File')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Tree view', () => {
|
||||||
|
cy.viewport(1024, 768)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.contains('My Documents').click()
|
||||||
|
cy.get('#sitemap').click()
|
||||||
|
cy.contains('Projects')
|
||||||
|
cy.contains('Test')
|
||||||
|
cy.contains('Close').click()
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user