@@ -1,7 +1,7 @@ | |||
context('FileUploader', () => { | |||
before(() => { | |||
cy.login(); | |||
cy.visit('/app/website'); | |||
cy.visit('/app'); | |||
}); | |||
function open_upload_dialog() { | |||
@@ -14,28 +14,20 @@ context('FileUploader', () => { | |||
open_upload_dialog(); | |||
cy.get_open_dialog().should('contain', 'Drag and drop files'); | |||
cy.hide_dialog(); | |||
cy.get('body').click(); | |||
}); | |||
it('should accept dropped files', () => { | |||
open_upload_dialog(); | |||
cy.fixture('example.json').then(fileContent => { | |||
cy.get_open_dialog().find('.file-upload-area').attachFile({ | |||
fileContent, | |||
fileName: 'example.json', | |||
mimeType: 'application/json' | |||
}, { | |||
subjectType: 'drag-n-drop', | |||
force: true | |||
}); | |||
cy.get_open_dialog().find('.file-name').should('contain', 'example.json'); | |||
cy.intercept('POST', '/api/method/upload_file').as('upload_file'); | |||
cy.get_open_dialog().find('.btn-modal-primary').click(); | |||
cy.wait('@upload_file').its('response.statusCode').should('eq', 200); | |||
cy.get('.modal:visible').should('not.exist'); | |||
cy.get_open_dialog().find('.file-upload-area').attachFile('example.json', { | |||
subjectType: 'drag-n-drop', | |||
}); | |||
cy.get_open_dialog().find('.file-name').should('contain', 'example.json'); | |||
cy.intercept('POST', '/api/method/upload_file').as('upload_file'); | |||
cy.get_open_dialog().find('.btn-modal-primary').click(); | |||
cy.wait('@upload_file').its('response.statusCode').should('eq', 200); | |||
cy.get('.modal:visible').should('not.exist'); | |||
}); | |||
it('should accept uploaded files', () => { | |||
@@ -47,7 +39,7 @@ context('FileUploader', () => { | |||
cy.intercept('POST', '/api/method/upload_file').as('upload_file'); | |||
cy.get_open_dialog().find('.btn-primary').click(); | |||
cy.wait('@upload_file').its('response.body.message') | |||
.should('have.property', 'file_url', '/private/files/example.json'); | |||
.should('have.property', 'file_name', 'example.json'); | |||
cy.get('.modal:visible').should('not.exist'); | |||
}); | |||
@@ -11,15 +11,14 @@ context('Relative Timeframe', () => { | |||
}); | |||
it('sets relative timespan filter for last week and filters list', () => { | |||
cy.visit('/app/List/ToDo/List'); | |||
cy.clear_filters(); | |||
cy.get('.list-row:contains("this is fourth todo")').should('exist'); | |||
cy.add_filter(); | |||
// cy.get('.tag-filters-area .btn:contains("Add Filter")').click(); | |||
cy.get('.fieldname-select-area').should('exist'); | |||
cy.get('.fieldname-select-area input').type("Due Date{enter}", { delay: 100 }); | |||
cy.get('select.condition.form-control').select("Timespan"); | |||
cy.get('.filter-field select.input-with-feedback.form-control').select("last week"); | |||
cy.intercept('POST', '/api/method/frappe.desk.reportview.get').as('list_refresh'); | |||
// cy.get('.filter-box .btn:contains("Apply")').click(); | |||
cy.get('.filter-popover .apply-filters').click({ force: true }); | |||
cy.wait('@list_refresh'); | |||
cy.get('.list-row-container').its('length').should('eq', 1); | |||
@@ -31,21 +30,17 @@ context('Relative Timeframe', () => { | |||
}); | |||
it('sets relative timespan filter for next week and filters list', () => { | |||
cy.visit('/app/List/ToDo/List'); | |||
cy.clear_filters(); | |||
cy.get('.list-row:contains("this is fourth todo")').should('exist'); | |||
// cy.get('.tag-filters-area .btn:contains("Add Filter")').click(); | |||
cy.add_filter(); | |||
cy.get('.fieldname-select-area input').type("Due Date{enter}", { delay: 100 }); | |||
cy.get('select.condition.form-control').select("Timespan"); | |||
cy.get('.filter-field select.input-with-feedback.form-control').select("next week"); | |||
cy.intercept('POST', '/api/method/frappe.desk.reportview.get').as('list_refresh'); | |||
// cy.get('.filter-box .btn:contains("Apply")').click(); | |||
cy.get('.filter-popover .apply-filters').click({ force: true }); | |||
cy.wait('@list_refresh'); | |||
// cy.get('.list-row-container').its('length').should('eq', 1); | |||
// cy.get('.list-row').should('contain', 'this is first todo'); | |||
cy.intercept('POST', '/api/method/frappe.model.utils.user_settings.save') | |||
.as('save_user_settings'); | |||
// cy.get('.remove-filter').click(); | |||
cy.clear_filters(); | |||
cy.wait('@save_user_settings'); | |||
}); | |||
@@ -320,6 +320,7 @@ Cypress.Commands.add('clear_filters', () => { | |||
cy.wait(300); | |||
cy.get('.filter-popover').should('exist'); | |||
cy.get('.filter-popover').find('.clear-filters').click(); | |||
cy.get('.filter-section .filter-button').click(); | |||
cy.window().its('cur_list').then(cur_list => { | |||
cur_list && cur_list.filter_area && cur_list.filter_area.clear(); | |||
}); | |||