-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84c3269
commit 6fa8c16
Showing
16 changed files
with
272 additions
and
246 deletions.
There are no files selected for viewing
193 changes: 114 additions & 79 deletions
193
cypress/e2e/backoffice/file-manager-attachment/file-list.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,136 @@ | ||
import { container } from '@utils'; | ||
import { UserLoginScenario } from '@scenarios/backoffice'; | ||
import { FileManagerAttachmentDynamicFixtures, FileManagerAttachmentStaticFixtures } from '@interfaces/backoffice'; | ||
import { FileManagerAttachmentListPage, FileManagerAttachmentAddPage, FileManagerAttachmentViewPage, FileManagerAttachmentDeletePage, FileManagerAttachmentDetachPage, FileManagerAttachmentAttachPage } from '@pages/backoffice'; | ||
import { | ||
FileManagerAttachmentListPage, | ||
FileManagerAttachmentAddPage, | ||
FileManagerAttachmentViewPage, | ||
FileManagerAttachmentDeletePage, | ||
FileManagerAttachmentDetachPage, | ||
FileManagerAttachmentAttachPage, | ||
} from '@pages/backoffice'; | ||
|
||
describeForSsp('File Manager Module - Files List', { tags: ['@backoffice', '@fileManager', '@ssp'] }, () => { | ||
const userLoginScenario = container.get(UserLoginScenario); | ||
const fileManagerAttachmentListPage = container.get(FileManagerAttachmentListPage); | ||
|
||
let dynamicFixtures: FileManagerAttachmentDynamicFixtures; | ||
let staticFixtures: FileManagerAttachmentStaticFixtures; | ||
|
||
before((): void => { | ||
({ dynamicFixtures, staticFixtures } = Cypress.env()); | ||
}); | ||
const userLoginScenario = container.get(UserLoginScenario); | ||
const fileManagerAttachmentListPage = container.get(FileManagerAttachmentListPage); | ||
|
||
beforeEach(() => { | ||
userLoginScenario.execute({ | ||
username: dynamicFixtures.rootUser.username, | ||
password: staticFixtures.defaultPassword, | ||
}); | ||
}); | ||
let dynamicFixtures: FileManagerAttachmentDynamicFixtures; | ||
let staticFixtures: FileManagerAttachmentStaticFixtures; | ||
|
||
it('should access the Files List page in Backoffice', () => { | ||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.verifyListPage(); | ||
before((): void => { | ||
({ dynamicFixtures, staticFixtures } = Cypress.env()); | ||
}); | ||
|
||
beforeEach(() => { | ||
userLoginScenario.execute({ | ||
username: dynamicFixtures.rootUser.username, | ||
password: staticFixtures.defaultPassword, | ||
}); | ||
}); | ||
|
||
it('should successfully detach file from entity', () => { | ||
const fileManagerAttachmentDetachPage = container.get(FileManagerAttachmentDetachPage); | ||
it('should access the Files List page in Backoffice', () => { | ||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.verifyListPage(); | ||
}); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickViewButton(); | ||
|
||
fileManagerAttachmentDetachPage.detachFile(); | ||
fileManagerAttachmentDetachPage.verifySuccessMessage(); | ||
}); | ||
it('should successfully detach file from entity', () => { | ||
const fileManagerAttachmentDetachPage = container.get(FileManagerAttachmentDetachPage); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickViewButton(); | ||
|
||
fileManagerAttachmentDetachPage.detachFile(); | ||
fileManagerAttachmentDetachPage.verifySuccessMessage(); | ||
}); | ||
|
||
it('should upload multiple files with size constraints', () => { | ||
const fileManagerAttachmentAddPage = container.get(FileManagerAttachmentAddPage); | ||
|
||
// Prepare test files that meet the constraints | ||
const testFiles: { fileContent: any; fileName: string; mimeType: string; filePath: string }[] = []; | ||
|
||
it('should upload multiple files with size constraints', () => { | ||
const fileManagerAttachmentAddPage = container.get(FileManagerAttachmentAddPage); | ||
|
||
// Prepare test files that meet the constraints | ||
const testFiles: { fileContent: any; fileName: string; mimeType: string; filePath: string; }[] = []; | ||
|
||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/document1.pdf', 'binary').then((fileContent) => { | ||
testFiles.push({ fileContent, fileName: 'document1.pdf', mimeType: 'application/pdf', filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/document1.pdf' }); | ||
}).then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/image1.jpeg', 'binary'); | ||
}).then((fileContent) => { | ||
testFiles.push({ fileContent, fileName: 'image1.jpeg', mimeType: 'image/jpeg', filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/image1.jpeg' }); | ||
}).then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/image2.png', 'binary'); | ||
}).then((fileContent) => { | ||
testFiles.push({ fileContent, fileName: 'image2.png', mimeType: 'image/png', filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/image2.png' }); | ||
}).then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/document2.pdf', 'binary'); | ||
}).then((fileContent) => { | ||
testFiles.push({ fileContent, fileName: 'document2.pdf', mimeType: 'application/pdf', filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/document2.pdf' }); | ||
}).then(() => { | ||
fileManagerAttachmentAddPage.visit(); | ||
fileManagerAttachmentAddPage.uploadFiles(testFiles); | ||
fileManagerAttachmentAddPage.verifyFileUploadConstraints(); | ||
fileManagerAttachmentAddPage.submitForm(); | ||
fileManagerAttachmentAddPage.verifySuccessMessage(); | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/document1.pdf', 'binary') | ||
.then((fileContent) => { | ||
testFiles.push({ | ||
fileContent, | ||
fileName: 'document1.pdf', | ||
mimeType: 'application/pdf', | ||
filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/document1.pdf', | ||
}); | ||
}); | ||
}) | ||
.then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/image1.jpeg', 'binary'); | ||
}) | ||
.then((fileContent) => { | ||
testFiles.push({ | ||
fileContent, | ||
fileName: 'image1.jpeg', | ||
mimeType: 'image/jpeg', | ||
filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/image1.jpeg', | ||
}); | ||
}) | ||
.then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/image2.png', 'binary'); | ||
}) | ||
.then((fileContent) => { | ||
testFiles.push({ | ||
fileContent, | ||
fileName: 'image2.png', | ||
mimeType: 'image/png', | ||
filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/image2.png', | ||
}); | ||
}) | ||
.then(() => { | ||
cy.fixture('suite/backoffice/file-manager-attachment/test-files/document2.pdf', 'binary'); | ||
}) | ||
.then((fileContent) => { | ||
testFiles.push({ | ||
fileContent, | ||
fileName: 'document2.pdf', | ||
mimeType: 'application/pdf', | ||
filePath: 'cypress/fixtures/suite/backoffice/file-manager-attachment/test-files/document2.pdf', | ||
}); | ||
}) | ||
.then(() => { | ||
fileManagerAttachmentAddPage.visit(); | ||
fileManagerAttachmentAddPage.uploadFiles(testFiles); | ||
fileManagerAttachmentAddPage.verifyFileUploadConstraints(); | ||
fileManagerAttachmentAddPage.submitForm(); | ||
fileManagerAttachmentAddPage.verifySuccessMessage(); | ||
}); | ||
}); | ||
|
||
it('should successfully delete a file', () => { | ||
const fileManagerAttachmentDeletePage = container.get(FileManagerAttachmentDeletePage); | ||
it('should successfully delete a file', () => { | ||
const fileManagerAttachmentDeletePage = container.get(FileManagerAttachmentDeletePage); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickDeleteButton(); | ||
|
||
fileManagerAttachmentDeletePage.confirmDelete(); | ||
fileManagerAttachmentDeletePage.verifySuccessMessage(); | ||
}); | ||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickDeleteButton(); | ||
|
||
it('should display file details on view page', () => { | ||
const fileManagerAttachmentViewPage = container.get(FileManagerAttachmentViewPage); | ||
fileManagerAttachmentDeletePage.confirmDelete(); | ||
fileManagerAttachmentDeletePage.verifySuccessMessage(); | ||
}); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickViewButton(); | ||
fileManagerAttachmentViewPage.verifyFileDetailsAreVisible(); | ||
}); | ||
it('should display file details on view page', () => { | ||
const fileManagerAttachmentViewPage = container.get(FileManagerAttachmentViewPage); | ||
|
||
it('should successfully attach file to multiple entities', () => { | ||
const fileManagerAttachmentAttachPage = container.get(FileManagerAttachmentAttachPage); | ||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickViewButton(); | ||
fileManagerAttachmentViewPage.verifyFileDetailsAreVisible(); | ||
}); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickAttachButton(); | ||
fileManagerAttachmentAttachPage.selectCompany('comp'); | ||
fileManagerAttachmentAttachPage.selectCompanyUser('spen'); | ||
fileManagerAttachmentAttachPage.selectCompanyBusinessUnit('unit'); | ||
fileManagerAttachmentAttachPage.submitForm(); | ||
fileManagerAttachmentAttachPage.verifySuccessMessage(); | ||
}); | ||
it('should successfully attach file to multiple entities', () => { | ||
const fileManagerAttachmentAttachPage = container.get(FileManagerAttachmentAttachPage); | ||
|
||
fileManagerAttachmentListPage.visit(); | ||
fileManagerAttachmentListPage.clickAttachButton(); | ||
fileManagerAttachmentAttachPage.selectCompany('comp'); | ||
fileManagerAttachmentAttachPage.selectCompanyUser('spen'); | ||
fileManagerAttachmentAttachPage.selectCompanyBusinessUnit('unit'); | ||
fileManagerAttachmentAttachPage.submitForm(); | ||
fileManagerAttachmentAttachPage.verifySuccessMessage(); | ||
}); | ||
}); | ||
|
||
function describeForSsp(title: string, options: { tags: string[] }, fn: () => void): void { | ||
(['suite'].includes(Cypress.env('repositoryId')) ? describe : describe.skip)(title, fn); | ||
(['suite'].includes(Cypress.env('repositoryId')) ? describe : describe.skip)(title, fn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
cypress/fixtures/suite/backoffice/file-manager-attachment/static-file-list.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"defaultPassword": "change123", | ||
"rootUser": { | ||
"firstName": "Admin", | ||
"lastName": "Spryker", | ||
"username": "[email protected]" | ||
}, | ||
"fileNameToUpload": "test-file.pdf", | ||
"fileSize": "1MB", | ||
"fileType": "application/pdf", | ||
"fileUploadPath": "cypress/fixtures/files/test-file.pdf" | ||
"defaultPassword": "change123", | ||
"rootUser": { | ||
"firstName": "Admin", | ||
"lastName": "Spryker", | ||
"username": "[email protected]" | ||
}, | ||
"fileNameToUpload": "test-file.pdf", | ||
"fileSize": "1MB", | ||
"fileType": "application/pdf", | ||
"fileUploadPath": "cypress/fixtures/files/test-file.pdf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.