test: Donwload file. Done.
This commit is contained in:
30
cypress/downloads/rightFile.csv
Normal file
30
cypress/downloads/rightFile.csv
Normal file
@@ -0,0 +1,30 @@
|
||||
CaseID,Activity,Timestamp,Status,Activity_Instance
|
||||
CID_1,檢傷,2023-01-12 15:32:31,start,1
|
||||
CID_1,檢傷,2023-01-12 15:32:31,complete,1
|
||||
CID_1,第一次醫囑,2023-01-12 15:49:01,start,2
|
||||
CID_1,第一次醫囑,2023-01-12 15:49:01,complete,2
|
||||
CID_1,出院,2023-01-13 03:32:00,start,3
|
||||
CID_1,出院,2023-01-13 03:32:00,complete,3
|
||||
CID_5,檢傷,2023-07-13 02:49:36,start,14
|
||||
CID_5,檢傷,2023-07-13 02:49:36,complete,14
|
||||
CID_5,第一次醫囑,2023-07-13 03:07:01,start,15
|
||||
CID_2,檢傷,2023-07-26 08:44:17,start,4
|
||||
CID_2,檢傷,2023-07-26 08:44:17,complete,4
|
||||
CID_2,第一次醫囑,2023-07-26 08:48:05,start,5
|
||||
CID_2,第一次醫囑,2023-07-26 08:48:05,complete,5
|
||||
CID_2,出院,2023-07-26 17:00:49,start,6
|
||||
CID_2,出院,2023-07-26 17:00:49,complete,6
|
||||
CID_4,檢傷,2023-11-01 01:20:19,start,10
|
||||
CID_4,檢傷,2023-11-01 01:20:19,complete,10
|
||||
CID_4,第一次醫囑,2023-11-01 01:34:54,start,11
|
||||
CID_4,第一次醫囑,2023-11-01 01:34:54,complete,11
|
||||
CID_4,住院,2023-11-02 06:36:36,start,12
|
||||
CID_4,住院,2023-11-10 02:35:39,complete,12
|
||||
CID_4,出院,2023-11-10 02:35:39,start,13
|
||||
CID_4,出院,2023-11-10 02:35:39,complete,13
|
||||
CID_3,檢傷,2023-11-27 06:20:48,start,7
|
||||
CID_3,檢傷,2023-11-27 06:20:48,complete,7
|
||||
CID_3,第一次醫囑,2023-11-27 06:40:30,start,8
|
||||
CID_3,第一次醫囑,2023-11-27 06:40:30,complete,8
|
||||
CID_3,出院,2023-11-27 07:21:53,start,9
|
||||
CID_3,出院,2023-11-27 07:21:53,complete,9
|
||||
|
@@ -136,16 +136,35 @@ describe('File Upload etc', () => {
|
||||
// .should('include', 'rightFile');
|
||||
// });
|
||||
|
||||
it('Delete file.', () => {
|
||||
// select file
|
||||
it('Donwload file.', () => {
|
||||
const downloadsFolder = Cypress.config('downloadsFolder');
|
||||
const path = require('path');
|
||||
const filename = path.join(downloadsFolder, 'rightFile.csv');
|
||||
|
||||
// 選取檔案
|
||||
cy.get('table tbody tr:first-child td:first-child')
|
||||
.contains('rightFile') // rightclick 需要 DOM 元素做目標,前面不能階斷言 should
|
||||
.contains('rightFile')
|
||||
.rightclick();
|
||||
cy.get('.p-contextmenu')
|
||||
.find('li')
|
||||
.filter(':contains("Delete")')
|
||||
.filter(':contains("Download")')
|
||||
.click();
|
||||
// delete file
|
||||
cy.contains('h2.swal2-title', 'Confirm Deletion').siblings('.swal2-actions').find('button.swal2-confirm').click();
|
||||
cy.wait(2000);
|
||||
// download to '/cypress/downloads'
|
||||
cy.readFile(filename);
|
||||
cy.wait(2000);
|
||||
})
|
||||
|
||||
// it('Delete file.', () => {
|
||||
// // select file
|
||||
// cy.get('table tbody tr:first-child td:first-child')
|
||||
// .contains('rightFile') // rightclick 需要 DOM 元素做目標,前面不能階斷言 should
|
||||
// .rightclick();
|
||||
// cy.get('.p-contextmenu')
|
||||
// .find('li')
|
||||
// .filter(':contains("Delete")')
|
||||
// .click();
|
||||
// // delete file
|
||||
// cy.contains('h2.swal2-title', 'Confirm Deletion').siblings('.swal2-actions').find('button.swal2-confirm').click();
|
||||
// });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user