-
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.
- Loading branch information
1 parent
b9d8110
commit d20cfd4
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
cypress/e2e/marc/marc-authority/verify-geographic-name-option-uses-all-search-operator.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,101 @@ | ||
import { DEFAULT_JOB_PROFILE_NAMES } from '../../../support/constants'; | ||
import Permissions from '../../../support/dictionary/permissions'; | ||
import DataImport from '../../../support/fragments/data_import/dataImport'; | ||
import MarcAuthorities from '../../../support/fragments/marcAuthority/marcAuthorities'; | ||
import MarcAuthority from '../../../support/fragments/marcAuthority/marcAuthority'; | ||
import TopMenu from '../../../support/fragments/topMenu'; | ||
import Users from '../../../support/fragments/users/users'; | ||
import getRandomPostfix from '../../../support/utils/stringTools'; | ||
|
||
describe('MARC', () => { | ||
describe('MARC Authority', () => { | ||
const testData = { | ||
searchOptions: ['Keyword', 'Geographic name'], | ||
recordType: 'Authorized', | ||
marcValue: 'C584445 Greenwich Village (New York, N.Y.) Maps', | ||
searchQueries: [ | ||
'Greenwich Village (New York, N.Y.) Maps', | ||
'Maps Greenwich New York Village (N.Y.)', | ||
'Maps New York Village (N.Y.)', | ||
'Maps New York Brooklyn Village (N.Y.)', | ||
], | ||
invalidQuery: 'Maps New York Brooklyn Village (N.Y.)', | ||
}; | ||
const marcFiles = [ | ||
{ | ||
marc: 'marcAuthFileForC584445.mrc', | ||
fileName: `testMarcFileC584445.${getRandomPostfix()}.mrc`, | ||
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY, | ||
propertyName: 'authority', | ||
}, | ||
]; | ||
const createdAuthorityIDs = []; | ||
let user; | ||
|
||
before('Create user, test data', () => { | ||
cy.getAdminToken(); | ||
// make sure there are no duplicate authority records in the system | ||
MarcAuthorities.deleteMarcAuthorityByTitleViaAPI('C584445*'); | ||
|
||
cy.createTempUser([Permissions.moduleDataImportEnabled.gui]).then((userProperties) => { | ||
testData.preconditionUserId = userProperties.userId; | ||
|
||
cy.getUserToken(userProperties.username, userProperties.password); | ||
marcFiles.forEach((marcFile) => { | ||
DataImport.uploadFileViaApi( | ||
marcFile.marc, | ||
marcFile.fileName, | ||
marcFile.jobProfileToRun, | ||
).then((response) => { | ||
response.forEach((record) => { | ||
createdAuthorityIDs.push(record[marcFile.propertyName].id); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
cy.getAdminToken(); | ||
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui]).then( | ||
(createdUserProperties) => { | ||
user = createdUserProperties; | ||
|
||
cy.login(user.username, user.password, { | ||
path: TopMenu.marcAuthorities, | ||
waiter: MarcAuthorities.waitLoading, | ||
}); | ||
MarcAuthorities.switchToSearch(); | ||
}, | ||
); | ||
}); | ||
|
||
after('Delete user, test data', () => { | ||
cy.getAdminToken(); | ||
Users.deleteViaApi(testData.preconditionUserId); | ||
Users.deleteViaApi(user.userId); | ||
createdAuthorityIDs.forEach((id) => { | ||
MarcAuthority.deleteViaAPI(id); | ||
}); | ||
}); | ||
|
||
it( | ||
'C584445 Verify that "Geographic name" search option uses "all" search operator ("Greenwich Village (New York, N.Y.) Maps" case) (spitfire)', | ||
{ tags: ['criticalPath', 'spitfire', 'C584445'] }, | ||
() => { | ||
// execute search by "Keyword" option | ||
testData.searchOptions.forEach((option) => { | ||
testData.searchQueries.forEach((query) => { | ||
MarcAuthorities.searchByParameter(option, query); | ||
cy.wait(1000); | ||
if (query === testData.invalidQuery) { | ||
MarcAuthorities.verifyEmptySearchResults(query); | ||
} else { | ||
MarcAuthorities.checkAfterSearch(testData.recordType, testData.marcValue); | ||
} | ||
MarcAuthorities.clickResetAndCheck(query); | ||
cy.wait(500); | ||
}); | ||
}); | ||
}, | ||
); | ||
}); | ||
}); |
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 @@ | ||
00511cz a2200169n 4500001000800000005001700008008004100025010001700066035001600083035002200099040002300121151005300144667005400197670006300251906001800314953000900332806019620110729162706.0091020|| anannbabn |n ana ash2009125702 a(DLC)442070 a(DLC)sh2009125702 aDLCbengcDLCdDLC aC584445 Greenwich Village (New York, N.Y.)vMaps aC584445 Record generated for validation purposes. aC584445 Work cat.: Gay & lesbian "FunMap" Manhattan, c1990 t8888utc00v0 atc00 |