test: Donwload file. Done.
This commit is contained in:
@@ -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