Skip to content

Commit fbf682d

Browse files
authored
Fat 26227 spitfire ai automated (#7127) (#7135)
* Implemented C386496 * Implemented C386497 * Implemented C386498 * Implemented C386499 * Implemented C386510 * Implemented C386511 * Implemented C386519 * Implemented C367960 * Implemented C367959 * exclude test C386498
1 parent fb1d43d commit fbf682d

18 files changed

Lines changed: 1589 additions & 1 deletion
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import Permissions from '../../../../support/dictionary/permissions';
2+
import MarcAuthorities from '../../../../support/fragments/marcAuthority/marcAuthorities';
3+
import MarcAuthoritiesSearch from '../../../../support/fragments/marcAuthority/marcAuthoritiesSearch';
4+
import MarcAuthority from '../../../../support/fragments/marcAuthority/marcAuthority';
5+
import TopMenu from '../../../../support/fragments/topMenu';
6+
import Users from '../../../../support/fragments/users/users';
7+
import getRandomPostfix from '../../../../support/utils/stringTools';
8+
9+
describe('MARC', () => {
10+
describe('MARC Authority', () => {
11+
describe('Browse - Authority records', () => {
12+
const testData = {
13+
searchQuery: 'C367960',
14+
browseOption: 'Personal name',
15+
authorityPrefix: '',
16+
authorityRecords: [
17+
{ heading: 'C367960 Erbil, H. Yıldırım', startNumber: `${getRandomPostfix()}1` },
18+
{
19+
heading: 'C367960 Santritter, Joannes Lucilius',
20+
startNumber: `${getRandomPostfix()}2`,
21+
},
22+
{ heading: 'C367960 Chang, Tong-sik', startNumber: `${getRandomPostfix()}3` },
23+
],
24+
createdAuthorityIds: [],
25+
};
26+
27+
before('Create test data', () => {
28+
cy.getAdminToken();
29+
MarcAuthorities.deleteMarcAuthorityByTitleViaAPI('C367960*');
30+
31+
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui]).then(
32+
(createdUserProperties) => {
33+
testData.userProperties = createdUserProperties;
34+
35+
cy.then(() => {
36+
testData.authorityRecords.forEach((record) => {
37+
MarcAuthorities.createMarcAuthorityViaAPI(
38+
testData.authorityPrefix,
39+
record.startNumber,
40+
[
41+
{
42+
tag: '100',
43+
content: `$a ${record.heading}`,
44+
indicators: ['1', '\\'],
45+
},
46+
],
47+
).then((createdRecordId) => {
48+
testData.createdAuthorityIds.push(createdRecordId);
49+
});
50+
});
51+
}).then(() => {
52+
cy.login(testData.userProperties.username, testData.userProperties.password, {
53+
path: TopMenu.marcAuthorities,
54+
waiter: MarcAuthorities.waitLoading,
55+
});
56+
MarcAuthorities.switchToBrowse();
57+
});
58+
},
59+
);
60+
});
61+
62+
after('Delete test data', () => {
63+
cy.getAdminToken();
64+
Users.deleteViaApi(testData.userProperties.userId);
65+
testData.createdAuthorityIds.forEach((id) => {
66+
MarcAuthority.deleteViaAPI(id, true);
67+
});
68+
});
69+
70+
it(
71+
"C367960 Browse | Verify that panes size doesn't change while the loading pane is visible (spitfire)",
72+
{ tags: ['extendedPath', 'spitfire', 'C367960'] },
73+
() => {
74+
// Step 1: Fill in the search box
75+
MarcAuthoritiesSearch.fillSearchInput(testData.searchQuery);
76+
77+
// Step 2: Select browse option dropdown
78+
MarcAuthorities.selectSearchOptionInDropdown(testData.browseOption);
79+
80+
// Step 3: Click Search button
81+
MarcAuthoritiesSearch.clickSearchButton();
82+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
83+
84+
// Step 4: Open first MARC Authority record
85+
MarcAuthorities.selectTitle(testData.authorityRecords[0].heading);
86+
MarcAuthority.waitLoading();
87+
88+
// Step 5: Resize the Search & filter pane
89+
let resizedFirstPaneWidth;
90+
MarcAuthorities.getPaneAuthoritiesFilterWidth().then((initialWidth) => {
91+
const targetWidth = initialWidth + 100;
92+
MarcAuthorities.resizePaneAuthoritiesFilter(targetWidth);
93+
MarcAuthorities.getPaneAuthoritiesFilterWidth().then((newWidth) => {
94+
resizedFirstPaneWidth = newWidth;
95+
expect(Math.abs(newWidth - initialWidth)).to.be.greaterThan(50);
96+
97+
// Step 6: Open another record and verify first pane size persists
98+
MarcAuthorities.selectTitle(testData.authorityRecords[1].heading);
99+
MarcAuthority.waitLoading();
100+
MarcAuthorities.verifyPaneAuthoritiesFilterWidth(resizedFirstPaneWidth);
101+
MarcAuthority.contains(testData.authorityRecords[1].heading);
102+
103+
// Step 7: Resize the detail view pane (third pane)
104+
let resizedThirdPaneWidth;
105+
MarcAuthorities.getPaneMarcViewWidth().then((initialThirdWidth) => {
106+
const targetThirdWidth = initialThirdWidth + 60;
107+
MarcAuthorities.resizePaneMarcView(-1 * targetThirdWidth);
108+
MarcAuthorities.getPaneMarcViewWidth().then((newThirdWidth) => {
109+
resizedThirdPaneWidth = newThirdWidth;
110+
expect(Math.abs(newThirdWidth - initialThirdWidth)).to.be.greaterThan(50);
111+
112+
// Step 8: Open another record and verify both pane sizes persist
113+
MarcAuthorities.selectTitle(testData.authorityRecords[2].heading);
114+
MarcAuthority.waitLoading();
115+
116+
// Verify first pane size remains unchanged
117+
MarcAuthorities.verifyPaneAuthoritiesFilterWidth(resizedFirstPaneWidth);
118+
119+
// Verify third pane size remains unchanged
120+
MarcAuthorities.verifyPaneMarcViewWidth(resizedThirdPaneWidth);
121+
122+
// Verify the record opened successfully
123+
MarcAuthority.contains(testData.authorityRecords[2].heading);
124+
});
125+
});
126+
});
127+
});
128+
},
129+
);
130+
});
131+
});
132+
});
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
import {
2+
DEFAULT_JOB_PROFILE_NAMES,
3+
MARC_AUTHORITY_SEARCH_OPTIONS,
4+
REFERENCES_FILTER_CHECKBOXES,
5+
} from '../../../../support/constants';
6+
import { Permissions } from '../../../../support/dictionary';
7+
import DataImport from '../../../../support/fragments/data_import/dataImport';
8+
import MarcAuthorityBrowse from '../../../../support/fragments/marcAuthority/MarcAuthorityBrowse';
9+
import MarcAuthorities from '../../../../support/fragments/marcAuthority/marcAuthorities';
10+
import MarcAuthoritiesSearch from '../../../../support/fragments/marcAuthority/marcAuthoritiesSearch';
11+
import MarcAuthority from '../../../../support/fragments/marcAuthority/marcAuthority';
12+
import TopMenu from '../../../../support/fragments/topMenu';
13+
import Users from '../../../../support/fragments/users/users';
14+
import getRandomPostfix from '../../../../support/utils/stringTools';
15+
16+
describe('MARC', () => {
17+
describe('MARC Authority', () => {
18+
describe('Browse - Authority records', () => {
19+
const testData = {
20+
advancedSearchOption: MARC_AUTHORITY_SEARCH_OPTIONS.ADVANCED_SEARCH,
21+
searchQueries: {
22+
first:
23+
'identifiers.value containsAll n00063831 or identifiers.value containsAll n91028048',
24+
second:
25+
'geographicName containsAll Cooperstown (N.D.) and keyword containsAll Cooperstown',
26+
},
27+
browseQuery: 'C386498 R',
28+
browseOption: 'Personal name',
29+
filters: {
30+
authoritySource: 'LC Name Authority file (LCNAF)',
31+
excludeSeeFrom: REFERENCES_FILTER_CHECKBOXES.EXCLUDE_SEE_FROM,
32+
},
33+
expectedResults: {
34+
firstQuery: ['C386498 Phillips, Bob, 1951-', 'C386498 Santritter, Joannes Lucilius'],
35+
secondQuery: 'C386498 Cooperstown (N.D.)',
36+
},
37+
authorizedType: 'Authorized',
38+
marcFile: {
39+
marc: 'C386498MarcAuth.mrc',
40+
fileName: `testMarcFile386498.${getRandomPostfix()}.mrc`,
41+
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY,
42+
numberOfRecords: 100,
43+
},
44+
createdAuthorityIDs: [],
45+
};
46+
47+
before('Create test data', () => {
48+
cy.getAdminToken();
49+
MarcAuthorities.getMarcAuthoritiesViaApi({
50+
limit: 100,
51+
query: 'keyword="C386498*"',
52+
}).then((authorities) => {
53+
if (authorities) {
54+
authorities.forEach(({ id }) => {
55+
MarcAuthority.deleteViaAPI(id);
56+
});
57+
}
58+
});
59+
60+
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui]).then(
61+
(createdUserProperties) => {
62+
testData.userProperties = createdUserProperties;
63+
64+
DataImport.uploadFileViaApi(
65+
testData.marcFile.marc,
66+
testData.marcFile.fileName,
67+
testData.marcFile.jobProfileToRun,
68+
).then((response) => {
69+
response.forEach((record) => {
70+
testData.createdAuthorityIDs.push(record.authority.id);
71+
});
72+
});
73+
74+
cy.login(testData.userProperties.username, testData.userProperties.password, {
75+
path: TopMenu.marcAuthorities,
76+
waiter: MarcAuthorities.waitLoading,
77+
});
78+
},
79+
);
80+
});
81+
82+
after('Delete test data', () => {
83+
cy.getAdminToken();
84+
Users.deleteViaApi(testData.userProperties.userId);
85+
testData.createdAuthorityIDs.forEach((id) => {
86+
MarcAuthority.deleteViaAPI(id, true);
87+
});
88+
});
89+
90+
// KNOWN ISSUE: Steps 5 fail due to UIMARCAUTH-532
91+
it.skip(
92+
'C386498 Switching between Search and Browse in "MARC authority" app (advanced search) (spitfire)',
93+
{ tags: ['extendedPathBroken', 'spitfire', 'C386498'] },
94+
() => {
95+
// Step 1: Select "Advanced search" option, fill query and apply filters
96+
MarcAuthorities.selectSearchOptionInDropdown(testData.advancedSearchOption);
97+
MarcAuthorities.checkSelectOptionFieldContent(testData.advancedSearchOption);
98+
MarcAuthoritiesSearch.fillSearchInput(testData.searchQueries.first);
99+
MarcAuthorities.chooseAuthoritySourceOption(testData.filters.authoritySource);
100+
MarcAuthoritiesSearch.selectExcludeReferencesFilter(testData.filters.excludeSeeFrom);
101+
102+
// Step 2: Click "Search" and verify results
103+
MarcAuthoritiesSearch.clickSearchButton();
104+
testData.expectedResults.firstQuery.forEach((heading) => {
105+
MarcAuthorities.checkAfterSearch(testData.authorizedType, heading);
106+
});
107+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
108+
109+
// Step 3: Switch to Browse
110+
MarcAuthorities.switchToBrowse();
111+
MarcAuthorities.verifyBrowseTabIsOpened();
112+
113+
// Step 4: Fill browse query and search
114+
MarcAuthorityBrowse.searchBy(testData.browseOption, testData.browseQuery);
115+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
116+
117+
// Step 5: Switch to Search - verify state is same as Step 2
118+
MarcAuthorities.switchToSearch();
119+
MarcAuthorities.verifySearchTabIsOpened();
120+
MarcAuthorities.checkSelectOptionFieldContent(testData.advancedSearchOption);
121+
MarcAuthorities.checkSearchInput(testData.searchQueries.first);
122+
testData.expectedResults.firstQuery.forEach((heading) => {
123+
MarcAuthorities.checkAfterSearch(testData.authorizedType, heading);
124+
});
125+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
126+
127+
// Step 6: Update search query with another value
128+
MarcAuthoritiesSearch.fillSearchInput(testData.searchQueries.second);
129+
130+
// Step 7: Click "Search" and verify single result with detail view
131+
MarcAuthoritiesSearch.clickSearchButton();
132+
MarcAuthorities.checkAfterSearch(
133+
testData.authorizedType,
134+
testData.expectedResults.secondQuery,
135+
);
136+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
137+
138+
// Step 8: Switch to Browse - verify browse results still from Step 4
139+
MarcAuthorities.switchToBrowse();
140+
MarcAuthorities.verifyBrowseTabIsOpened();
141+
MarcAuthorities.checkSearchInput(testData.browseQuery);
142+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
143+
144+
// Step 9: Switch to Search - verify state same as Step 7
145+
MarcAuthorities.switchToSearch();
146+
MarcAuthorities.verifySearchTabIsOpened();
147+
MarcAuthorities.checkSelectOptionFieldContent(testData.advancedSearchOption);
148+
MarcAuthorities.checkSearchInput(testData.searchQueries.second);
149+
MarcAuthorities.checkAfterSearch(
150+
testData.authorizedType,
151+
testData.expectedResults.secondQuery,
152+
);
153+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
154+
155+
// Step 10: Click "Reset all" - verify Search is cleared
156+
MarcAuthorities.clickResetAndCheck();
157+
158+
// Step 11: Switch to Browse - verify browse results still displayed (not affected by reset)
159+
MarcAuthorities.switchToBrowse();
160+
MarcAuthorities.verifyBrowseTabIsOpened();
161+
MarcAuthorities.checkSearchInput(testData.browseQuery);
162+
MarcAuthorities.verifySearchResultTabletIsAbsent(false);
163+
164+
// Step 12: Switch to Search - verify search state is still cleared
165+
MarcAuthorities.switchToSearch();
166+
MarcAuthorities.verifySearchTabIsOpened();
167+
MarcAuthorities.checkSearchOption('keyword');
168+
MarcAuthorities.checkSearchInput('');
169+
MarcAuthorities.verifySearchResultTabletIsAbsent(true);
170+
},
171+
);
172+
});
173+
});
174+
});

0 commit comments

Comments
 (0)