1 import {EnhancedPageObject, NightwatchBrowser} from 'nightwatch';
2 import {fixtureFile, randomString} from '../../utils';
4 const exampleXpath = '//*[@tag="010"]/*[@code="a"][1]';
6 function navigateToMarcBatchImport(vandelay: EnhancedPageObject): void {
7 browser.page.navbar().click('@catMenu')
8 .click('@catMenuMarcBatchImportExport')
9 .verify.textContains('div.lead.alert', 'MARC Batch Import/Export');
13 before: (browser: NightwatchBrowser) => {
14 // TODO: Once https://bugs.launchpad.net/evergreen/+bug/1989260 is resolved,
15 // login as a cataloging administrator, rather than the admin / demo123 credentials
16 browser.page.login().loginToWebClient(browser, 'admin', 'demo123');
19 after: (browser: NightwatchBrowser) => {
23 'Can create a new record display attribute': (browser: NightwatchBrowser) => {
24 const vandelay = browser.page.vandelay();
25 navigateToMarcBatchImport(vandelay);
26 vandelay.click('@recordDisplayAttributes')
28 .click('@newVqradButton')
29 .setValue('@codeInput', 'lccn')
30 .setValue('@descriptionInput', 'LC control number')
31 .setValue('@xpathInput', exampleXpath)
33 .assert.textContains('div.eg-grid-body', exampleXpath);
36 'Record display attribute displays in queue screen': (browser: NightwatchBrowser) => {
37 const vandelay = browser.page.vandelay();
38 navigateToMarcBatchImport(vandelay);
39 vandelay.click('@recordTypeCombobox') // open the combobox
40 .click('@authorityRecordType') // select the option we want
41 .setValue('@queueName', randomString())
42 .setValue('#upload-file', fixtureFile('authority-record.mrc'))
43 .click('@uploadButton')
44 .waitForElementVisible('@goToQueueButton', 10_000)
45 .click('@goToQueueButton')
46 .assert.textContains('div.eg-grid-header-row', 'LC control number')
47 .assert.textContains('div.eg-grid-body', 'sh 85038796');