Skip to content

Commit b18d1e3

Browse files
authored
Get admin token (#7187)
* removed cleaning cookies before getting an admin token
1 parent b5577e2 commit b18d1e3

7 files changed

Lines changed: 16 additions & 9 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ CLAUDE.md
3636
.claude
3737
.opencode
3838
cypress.local.js
39+
40+
.agents/*
41+
skills-lock.json

cypress/e2e/data-import/e2e/mrc-import-with-matching-001.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('Data Import', () => {
144144
});
145145

146146
// download exported marc file
147-
cy.getAdminToken();
147+
cy.getAdminToken(false);
148148
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_EXPORT);
149149
ExportFile.uploadFile(nameForCSVFile);
150150
ExportFile.exportWithDefaultJobProfile(nameForCSVFile);

cypress/e2e/data-import/e2e/mrc-import-with-matching-999ff.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('Data Import', () => {
180180

181181
// download exported marc file
182182
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_EXPORT);
183-
cy.getAdminToken().then(() => {
183+
cy.getAdminToken(false).then(() => {
184184
ExportFile.uploadFile(nameForCSVFile);
185185
ExportFile.exportWithDefaultJobProfile(nameForCSVFile);
186186
ExportFile.getRecordHridOfExportedFile(nameForCSVFile).then((req) => {

cypress/e2e/inventory/holdings/see-holdings-with-1000+-items.cy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ describe('Inventory', () => {
7878
});
7979

8080
after('Delete test data', () => {
81+
cy.wait(3000);
8182
cy.getAdminToken().then(() => {
8283
Users.deleteViaApi(user.userId);
8384
cy.getInstance({
@@ -94,7 +95,7 @@ describe('Inventory', () => {
9495

9596
it(
9697
'C350639 Verify the ability to see holdings with 1000+ items: CASE 1 (folijet)',
97-
{ tags: ['smoke', 'folijet', 'C350639', 'shiftLeft'] },
98+
{ tags: ['smoke', 'folijet', 'C350639'] },
9899
() => {
99100
InventorySearchAndFilter.searchByParameter(
100101
'Keyword (title, contributor, identifier, HRID, UUID)',

cypress/e2e/marc/marc-holdings/moving-items.cy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ describe('MARC', () => {
4949
permissions.converterStorageAll.gui,
5050
]).then((userProperties) => {
5151
userId = userProperties.userId;
52-
cy.login(userProperties.username, userProperties.password);
53-
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
52+
// cy.login(userProperties.username, userProperties.password);
53+
// TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
5454
cy.getAdminToken()
5555
.then(() => {
5656
cy.getLoanTypes({ limit: 1 });

cypress/e2e/receiving/user-in-acq-unit-cannot-edit-acq-unit-of-title-without-manage-permission.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('Receiving', () => {
123123
...orderResponse,
124124
workflowStatus: ORDER_STATUSES.OPEN,
125125
}).then(() => {
126-
cy.getAdminToken();
126+
cy.getAdminToken(false);
127127
Receiving.getTitleByPoLineIdViaApi(orderLine.id).then((titleData) => {
128128
Receiving.updateTitleViaApi({
129129
...titleData,

cypress/support/api/auth.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ Cypress.Commands.add('setUserPassword', (userCredentials, ignoreErrors = false)
4747
});
4848
});
4949

50-
Cypress.Commands.add('getAdminToken', () => {
51-
cy.clearCookies({ domain: null });
52-
cy.wait(2000); // Wait for cookies to be cleared
50+
Cypress.Commands.add('getAdminToken', (clearCookies = true) => {
51+
if (clearCookies) {
52+
cy.wait(1000); // Wait for any ongoing requests to finish
53+
cy.clearCookies({ domain: null });
54+
cy.wait(2000); // Wait for cookies to be cleared
55+
}
5356
cy.getToken(Cypress.env('diku_login'), Cypress.env('diku_password'));
5457
});
5558

0 commit comments

Comments
 (0)