Skip to content

Commit

Permalink
implemented test C466163 (#4016)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev authored Aug 5, 2024
1 parent 3222d97 commit 12e0adb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Permissions } from '../../../support/dictionary';
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import Users from '../../../support/fragments/users/users';
import NewOrder from '../../../support/fragments/orders/newOrder';
import OrderLines from '../../../support/fragments/orders/orderLines';
import Orders from '../../../support/fragments/orders/orders';
import NewOrganization from '../../../support/fragments/organizations/newOrganization';
import Organizations from '../../../support/fragments/organizations/organizations';
import SelectInstanceModal from '../../../support/fragments/orders/modals/selectInstanceModal';
import TopMenu from '../../../support/fragments/topMenu';

describe('Inventory', () => {
describe('Search in "Select instance" plugin', () => {
const testData = {
searchQuery: '333.2.221.1.3',
classificationOption: 'Classification, normalized',
};
const organization = {
...NewOrganization.defaultUiOrganizations,
paymentMethod: 'EFT',
};
const order = {
...NewOrder.defaultOneTimeOrder,
manualPo: false,
};
let orderNumber;
let orderID;
let user;

before('Create user, test data', () => {
cy.getAdminToken();
Organizations.createOrganizationViaApi(organization).then((response) => {
organization.id = response;
order.vendor = response;
});

cy.createOrderApi(order).then((response) => {
orderNumber = response.body.poNumber;
orderID = response.body.id;
});

cy.createTempUser([
Permissions.uiInventoryViewInstances.gui,
Permissions.uiOrdersCreate.gui,
]).then((createdUserProperties) => {
user = createdUserProperties;

cy.login(user.username, user.password, {
path: TopMenu.ordersPath,
waiter: Orders.waitLoading,
});
Orders.searchByParameter('PO number', orderNumber);
Orders.selectFromResultsList(orderNumber);
OrderLines.addPOLine();
OrderLines.clickTitleLookUp();
InventorySearchAndFilter.instanceTabIsDefault();
});
});

after('Delete user, test data', () => {
cy.getAdminToken();
Orders.deleteOrderViaApi(orderID);
Organizations.deleteOrganizationViaApi(organization.id);
Users.deleteViaApi(user.userId);
});

it(
'C466163 Find Instance plugin | No results found when searching by "Classification, normalized" search option (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
SelectInstanceModal.clickSearchOptionSelect();
SelectInstanceModal.chooseSearchOption(testData.classificationOption);
SelectInstanceModal.searchByName(testData.searchQuery);
SelectInstanceModal.checkNoRecordsFound(testData.searchQuery);
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Inventory', () => {
});
SelectInstanceModal.chooseSearchOption(testData.issnOption);
SelectInstanceModal.searchByName(testData.issnNegativeSearchQuery);
SelectInstanceModal.checkNoRecordsFound();
SelectInstanceModal.checkNoRecordsFound(testData.issnNegativeSearchQuery);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Inventory', () => {
});
SelectInstanceModal.chooseSearchOption(testData.issnOption);
SelectInstanceModal.searchByName(testData.issnNegativeSearchQuery);
SelectInstanceModal.checkNoRecordsFound();
SelectInstanceModal.checkNoRecordsFound(testData.issnNegativeSearchQuery);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Inventory', () => {
});
SelectInstanceModal.chooseSearchOption(testData.issnOption);
SelectInstanceModal.searchByName(testData.issnNegativeSearchQuery);
SelectInstanceModal.checkNoRecordsFound();
SelectInstanceModal.checkNoRecordsFound(testData.issnNegativeSearchQuery);
},
);
});
Expand Down
12 changes: 10 additions & 2 deletions cypress/support/fragments/orders/modals/selectInstanceModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,16 @@ export default {
checkResultsListEmpty() {
cy.expect(resultsList.absent());
},
checkNoRecordsFound() {
cy.expect(selectInstanceModal.find(HTML(including('No results found for'))).exists());
checkNoRecordsFound(headingReference) {
cy.expect(
selectInstanceModal
.find(
HTML(
`No results found for "${headingReference}". Please check your spelling and filters.`,
),
)
.exists(),
);
},
verifyInstanceSearchOptionsInOrder() {
cy.wrap(searchOptionSelect.allOptionsText()).should((arrayOfOptions) => {
Expand Down

0 comments on commit 12e0adb

Please sign in to comment.