-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/folio-org/stripes-testing
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
...ss/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-incorrectly-formatted-identifiers.cy.js
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import permissions from '../../../support/dictionary/permissions'; | ||
import BulkEditSearchPane from '../../../support/fragments/bulk-edit/bulk-edit-search-pane'; | ||
import TopMenu from '../../../support/fragments/topMenu'; | ||
import Users from '../../../support/fragments/users/users'; | ||
import FileManager from '../../../support/utils/fileManager'; | ||
import getRandomPostfix, { randomFourDigitNumber } from '../../../support/utils/stringTools'; | ||
import InteractorsTools from '../../../support/utils/interactorsTools'; | ||
|
||
let user; | ||
const fileNameInvalidHoldingsUUIDs = `invalidHoldingsUUIDs ${getRandomPostfix()}.csv`; | ||
const fileNameInvalidHoldingsHRIDs = `invalidHoldingsHRIDs ${getRandomPostfix()}.csv`; | ||
const fileNameInvalidInstanceHRIDs = `invalidInstanceHRIDs ${getRandomPostfix()}.csv`; | ||
const fileNameInvalidItemBarcodes = `invalidItemBarcodes ${getRandomPostfix()}.csv`; | ||
const arrayOfFileNames = [ | ||
fileNameInvalidHoldingsUUIDs, | ||
fileNameInvalidHoldingsHRIDs, | ||
fileNameInvalidInstanceHRIDs, | ||
fileNameInvalidItemBarcodes, | ||
]; | ||
const errorMessage = | ||
'Incorrect number of tokens found in record: expected 1 actual 3 (IncorrectTokenCountException)'; | ||
const getCalloutContent = (fileName) => { | ||
return `${fileName} is formatted incorrectly. Please correct the formatting and upload the file again.`; | ||
}; | ||
const checkResponse = (alias, fileName) => { | ||
cy.wait(alias).then((interception) => { | ||
expect(interception.response.body.linkToTriggeringCsvFile).to.include(fileName); | ||
expect(interception.response.body.errorMessage).to.eq(errorMessage); | ||
}); | ||
}; | ||
|
||
describe('bulk-edit', () => { | ||
describe('in-app approach', () => { | ||
before('create test data', () => { | ||
cy.createTempUser([permissions.bulkEditEdit.gui, permissions.inventoryCRUDHoldings.gui]).then( | ||
(userProperties) => { | ||
user = userProperties; | ||
|
||
arrayOfFileNames.forEach((fileName) => { | ||
FileManager.createFile( | ||
`cypress/fixtures/${fileName}`, | ||
`${randomFourDigitNumber()},${randomFourDigitNumber()},${randomFourDigitNumber()}`, | ||
); | ||
}); | ||
|
||
cy.login(user.username, user.password, { | ||
path: TopMenu.bulkEditPath, | ||
waiter: BulkEditSearchPane.waitLoading, | ||
}); | ||
}, | ||
); | ||
}); | ||
|
||
after('delete test data', () => { | ||
cy.getAdminToken(); | ||
Users.deleteViaApi(user.userId); | ||
|
||
arrayOfFileNames.forEach((fileName) => { | ||
FileManager.deleteFile(`cypress/fixtures/${fileName}`); | ||
}); | ||
}); | ||
|
||
it( | ||
'C440082 Verify Error while uploading file with incorrectly formatted identifiers - Holdings (firebird)', | ||
{ tags: ['criticalPath', 'firebird'] }, | ||
() => { | ||
BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Holdings UUIDs'); | ||
cy.intercept('GET', '/bulk-operations/*').as('bulkOperationHoldingsUUIDs'); | ||
BulkEditSearchPane.uploadFile(fileNameInvalidHoldingsUUIDs); | ||
InteractorsTools.checkCalloutErrorMessage(getCalloutContent(fileNameInvalidHoldingsUUIDs)); | ||
checkResponse('@bulkOperationHoldingsUUIDs', fileNameInvalidHoldingsUUIDs); | ||
InteractorsTools.dismissCallout(getCalloutContent(fileNameInvalidHoldingsUUIDs)); | ||
|
||
BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Holdings HRIDs'); | ||
cy.intercept('GET', '/bulk-operations/*').as('bulkOperationHoldingsHRIDs'); | ||
BulkEditSearchPane.uploadFile(fileNameInvalidHoldingsHRIDs); | ||
InteractorsTools.checkCalloutErrorMessage(getCalloutContent(fileNameInvalidHoldingsHRIDs)); | ||
checkResponse('@bulkOperationHoldingsHRIDs', fileNameInvalidHoldingsHRIDs); | ||
InteractorsTools.dismissCallout(getCalloutContent(fileNameInvalidHoldingsHRIDs)); | ||
|
||
BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Instance HRIDs'); | ||
cy.intercept('GET', '/bulk-operations/*').as('bulkOperationInstanceHRIDs'); | ||
BulkEditSearchPane.uploadFile(fileNameInvalidInstanceHRIDs); | ||
InteractorsTools.checkCalloutErrorMessage(getCalloutContent(fileNameInvalidInstanceHRIDs)); | ||
checkResponse('@bulkOperationInstanceHRIDs', fileNameInvalidInstanceHRIDs); | ||
InteractorsTools.dismissCallout(getCalloutContent(fileNameInvalidInstanceHRIDs)); | ||
|
||
BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Item barcodes'); | ||
cy.intercept('GET', '/bulk-operations/*').as('bulkOperationItemBarcodes'); | ||
BulkEditSearchPane.uploadFile(fileNameInvalidItemBarcodes); | ||
InteractorsTools.checkCalloutErrorMessage(getCalloutContent(fileNameInvalidItemBarcodes)); | ||
checkResponse('@bulkOperationItemBarcodes', fileNameInvalidItemBarcodes); | ||
InteractorsTools.dismissCallout(getCalloutContent(fileNameInvalidItemBarcodes)); | ||
}, | ||
); | ||
}); | ||
}); |