Skip to content

Commit

Permalink
fixes for QG
Browse files Browse the repository at this point in the history
  • Loading branch information
ostapwd committed Nov 18, 2024
1 parent 47410d9 commit 97fea9c
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 183 deletions.
108 changes: 60 additions & 48 deletions cypress/e2e/inventory/tags/filter-instances-by-tags.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,68 @@ import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';

describe('Inventory', () => {
describe('Tags', () => {
let userId;
let instanceRecord = null;
const testTag = `test_tag_${uuid()}`;
const tagsCount = '1';
describe(
'Tags',
{
retries: {
runMode: 1,
},
},
() => {
let userId;
let instanceRecord = null;
let testTag;
const tagsCount = '1';

beforeEach(() => {
cy.getAdminToken()
.then(() => {
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
instanceRecord = instanceData;
});
})
.then(() => {
cy.createTempUser([
permissions.inventoryAll.gui,
permissions.uiTagsPermissionAll.gui,
]).then(({ username, password, userId: id }) => {
userId = id;
cy.login(username, password);
beforeEach(() => {
testTag = `test_tag_${uuid()}`;
cy.getAdminToken()
.then(() => {
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
instanceRecord = instanceData;
});
})
.then(() => {
cy.createTempUser([
permissions.inventoryAll.gui,
permissions.uiTagsPermissionAll.gui,
]).then(({ username, password, userId: id }) => {
userId = id;
cy.login(username, password, {
path: TopMenu.inventoryPath,
waiter: InventorySearchAndFilter.waitLoading,
});
});
});
});
});
});

afterEach(() => {
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(instanceRecord.instanceId);
Users.deleteViaApi(userId);
});
afterEach(() => {
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(instanceRecord.instanceId);
Users.deleteViaApi(userId);
});

it(
'C343215 Filter instances by tags (volaris)',
{ tags: ['smoke', 'volaris', 'shiftLeft', 'C343215'] },
() => {
cy.visit(TopMenu.inventoryPath);
InventorySearchAndFilter.verifyPanesExist();
InventorySearchAndFilter.searchInstanceByTitle(instanceRecord.instanceTitle);
InventorySearchAndFilter.verifySearchResult(instanceRecord.instanceTitle);
InventorySearchAndFilter.selectFoundInstance(instanceRecord.instanceTitle);
InventorySearchAndFilter.verifyInstanceDetailsView();
InventorySearchAndFilter.openTagsField();
InventorySearchAndFilter.verifyTagsView();
InventorySearchAndFilter.addTag(testTag);
cy.reload();
InventorySearchAndFilter.verifyTagCount(tagsCount);
InventorySearchAndFilter.closeInstanceDetailPane();
InventorySearchAndFilter.resetAllAndVerifyNoResultsAppear();
InventorySearchAndFilter.filterByTag(testTag);
InventorySearchAndFilter.verifyIsFilteredByTag(instanceRecord.instanceTitle);
},
);
});
it(
'C343215 Filter instances by tags (volaris)',
{ tags: ['smoke', 'volaris', 'shiftLeft', 'C343215'] },
() => {
InventorySearchAndFilter.verifyPanesExist();
InventorySearchAndFilter.searchInstanceByTitle(instanceRecord.instanceTitle);
InventorySearchAndFilter.verifySearchResult(instanceRecord.instanceTitle);
InventorySearchAndFilter.selectFoundInstance(instanceRecord.instanceTitle);
InventorySearchAndFilter.verifyInstanceDetailsView();
InventorySearchAndFilter.openTagsField();
InventorySearchAndFilter.verifyTagsView();
InventorySearchAndFilter.addTag(testTag);
cy.reload();
cy.wait(5000);
InventorySearchAndFilter.verifyTagCount(tagsCount);
InventorySearchAndFilter.closeInstanceDetailPane();
InventorySearchAndFilter.resetAllAndVerifyNoResultsAppear();
InventorySearchAndFilter.filterByTag(testTag);
InventorySearchAndFilter.verifyIsFilteredByTag(instanceRecord.instanceTitle);
},
);
},
);
});
69 changes: 39 additions & 30 deletions cypress/e2e/invoices/invoices-manually-create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,45 @@ import VendorAddress from '../../support/fragments/invoices/vendorAddress';
import Organizations from '../../support/fragments/organizations/organizations';
import TopMenu from '../../support/fragments/topMenu';

describe('Invoices', () => {
const invoice = { ...NewInvoice.defaultUiInvoice };
const vendorPrimaryAddress = { ...VendorAddress.vendorAddress };
describe(
'Invoices',
{
retries: {
runMode: 1,
},
},
() => {
let invoice;
let vendorPrimaryAddress;

before(() => {
cy.getAdminToken();
Organizations.getOrganizationViaApi({ query: `name=${invoice.vendorName}` }).then(
(organization) => {
invoice.accountingCode = organization.erpCode;
Object.assign(
vendorPrimaryAddress,
organization.addresses.find((address) => address.isPrimary === true),
);
},
);
cy.getBatchGroups().then((batchGroup) => {
invoice.batchGroup = batchGroup.name;
beforeEach(() => {
invoice = { ...NewInvoice.defaultUiInvoice };
vendorPrimaryAddress = { ...VendorAddress.vendorAddress };
cy.getAdminToken();
Organizations.getOrganizationViaApi({ query: `name=${invoice.vendorName}` }).then(
(organization) => {
invoice.accountingCode = organization.erpCode;
Object.assign(
vendorPrimaryAddress,
organization.addresses.find((address) => address.isPrimary === true),
);
},
);
cy.getBatchGroups().then((batchGroup) => {
invoice.batchGroup = batchGroup.name;
});
cy.loginAsAdmin({ path: TopMenu.invoicesPath, waiter: Invoices.waitLoading });
});
cy.loginAsAdmin();
cy.visit(TopMenu.invoicesPath);
});

it(
'C2299 Manually Create Invoice (thunderjet)',
{ tags: ['smoke', 'thunderjet', 'shiftLeft'] },
() => {
Invoices.createDefaultInvoice(invoice, vendorPrimaryAddress);
Invoices.checkCreatedInvoice(invoice, vendorPrimaryAddress);
Invoices.deleteInvoiceViaActions();
Invoices.confirmInvoiceDeletion();
},
);
});
it(
'C2299 Manually Create Invoice (thunderjet)',
{ tags: ['smoke', 'thunderjet', 'shiftLeft'] },
() => {
Invoices.createDefaultInvoice(invoice, vendorPrimaryAddress);
Invoices.checkCreatedInvoice(invoice, vendorPrimaryAddress);
Invoices.deleteInvoiceViaActions();
Invoices.confirmInvoiceDeletion();
},
);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,72 +9,81 @@ import getRandomPostfix from '../../../../support/utils/stringTools';

describe('MARC', () => {
describe('MARC Authority', () => {
describe('Browse - Authority records', () => {
const testData = {
searchOptionPersonalName: 'Personal name',
searchOptionNameTitle: 'Name-title',
searchOptionKeyword: 'Keyword',
recordA: 'Angelou, Maya.',
recordB: 'Angelou, Maya. And still I rise',
recordBRef: 'Angelou, Maya. Still I rise',
authorized: 'Authorized',
reference: 'Reference',
recordWithoutTitle: 'Twain, Mark, 1835-1910',
};
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY;
const propertyName = 'authority';
const fileName = `C360522 testMarcFile.${getRandomPostfix()}.mrc`;
const createdAuthorityIDs = [];
describe(
'Browse - Authority records',
{
retries: {
runMode: 1,
},
},
() => {
const testData = {
searchOptionPersonalName: 'Personal name',
searchOptionNameTitle: 'Name-title',
searchOptionKeyword: 'Keyword',
recordA: 'Angelou, Maya.',
recordB: 'Angelou, Maya. And still I rise',
recordBRef: 'Angelou, Maya. Still I rise',
authorized: 'Authorized',
reference: 'Reference',
recordWithoutTitle: 'Twain, Mark, 1835-1910',
};
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY;
const propertyName = 'authority';
let fileName;
const createdAuthorityIDs = [];

before('Creating data', () => {
cy.createTempUser([
Permissions.moduleDataImportEnabled.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;
beforeEach('Creating data', () => {
fileName = `C360522 testMarcFile.${getRandomPostfix()}.mrc`;
cy.createTempUser([
Permissions.moduleDataImportEnabled.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;

cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
});
});
});

after('Deleting data', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.userProperties.userId);
createdAuthorityIDs.forEach((id) => {
MarcAuthority.deleteViaAPI(id);
afterEach('Deleting data', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.userProperties.userId);
createdAuthorityIDs.forEach((id) => {
MarcAuthority.deleteViaAPI(id);
});
createdAuthorityIDs.length = 0;
});
createdAuthorityIDs.length = 0;
});

it(
'C360522 Import of "MARC Authority" record with same valid prefixes in "001" and "010 $a" fields (spitfire)',
{ tags: ['smoke', 'authority', 'spitfire', 'shiftLeft', 'C360522'] },
() => {
DataImport.uploadFileViaApi(
'D_genre(prefixes_in_001_010Sa)sc_03.mrc',
fileName,
jobProfileToRun,
).then((response) => {
response.forEach((record) => {
createdAuthorityIDs.push(record[propertyName].id);
it(
'C360522 Import of "MARC Authority" record with same valid prefixes in "001" and "010 $a" fields (spitfire)',
{ tags: ['smoke', 'authority', 'spitfire', 'shiftLeft', 'C360522'] },
() => {
DataImport.uploadFileViaApi(
'D_genre(prefixes_in_001_010Sa)sc_03.mrc',
fileName,
jobProfileToRun,
).then((response) => {
response.forEach((record) => {
createdAuthorityIDs.push(record[propertyName].id);
});
});
});
Logs.waitFileIsImported(fileName);
Logs.checkJobStatus(fileName, 'Completed');
Logs.openFileDetails(fileName);
Logs.goToTitleLink('Case Reports');
cy.wait(1000);
Logs.checkAuthorityLogJSON([
'"sourceFileId":',
'"6ddf21a6-bc2f-4cb0-ad96-473e1f82da23"',
'"naturalId":',
'"D002363"',
]);
},
);
});
Logs.waitFileIsImported(fileName);
Logs.checkJobStatus(fileName, 'Completed');
Logs.openFileDetails(fileName);
Logs.goToTitleLink('Case Reports');
cy.wait(1000);
Logs.checkAuthorityLogJSON([
'"sourceFileId":',
'"6ddf21a6-bc2f-4cb0-ad96-473e1f82da23"',
'"naturalId":',
'"D002363"',
]);
},
);
},
);
});
});
17 changes: 9 additions & 8 deletions cypress/support/fragments/inventory/filterItems.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { including } from '@interactors/html';
import {
Checkbox,
Button,
Accordion,
MultiColumnListCell,
Button,
MultiColumnList,
TextField,
MultiColumnListCell,
MultiSelect,
MultiSelectOption,
} from '../../../../interactors';
import { ITEM_STATUS_NAMES } from '../../constants';

Expand All @@ -27,11 +28,11 @@ export default {
],

toggleStatus(statusName) {
cy.do(TextField({ label: 'itemStatus-field' }).fillIn(statusName));
// need to wait until status is uploaded
cy.wait(500);
cy.do(MultiSelect({ id: 'itemStatus-multiselect' }).toggle());
cy.wait(500);
cy.do(MultiSelectOption(including(statusName)).click());
cy.wait(1500);
cy.do(TextField({ label: 'itemStatus-field' }).focus());
cy.do(Checkbox(statusName).click());
},

toggleItemStatusAccordion() {
Expand Down
6 changes: 4 additions & 2 deletions cypress/support/fragments/inventory/inventoryInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ const openHoldings = (...holdingToBeOpened) => {
};

const openItemByBarcode = (itemBarcode) => {
cy.wait(500);
cy.do(
instanceDetailsSection
.find(MultiColumnListCell({ columnIndex: 0, content: itemBarcode }))
.find(Button(including(itemBarcode)))
.click(),
);
cy.wait(500);
ItemRecordView.waitLoading();
};

Expand Down Expand Up @@ -1082,9 +1084,9 @@ export default {
},

deleteTag: (tagName) => {
cy.do(MultiSelect().find(closeTag).click());
cy.do(MultiSelect({ id: 'input-tag' }).find(closeTag).click());
cy.expect(
MultiSelect()
MultiSelect({ id: 'input-tag' })
.find(HTML(including(tagName)))
.absent(),
);
Expand Down
Loading

0 comments on commit 97fea9c

Please sign in to comment.