Skip to content

Commit

Permalink
Merge branch 'master' into FAT-16784
Browse files Browse the repository at this point in the history
  • Loading branch information
sviatlana-stsiapanava authored Sep 30, 2024
2 parents ce1e988 + 4b60e18 commit 538dbf7
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Users from '../../../support/fragments/users/users';
import { getTestEntityValue } from '../../../support/utils/stringTools';

describe('lists', () => {
describe('Add new list', () => {
describe('permissions', () => {
const userData = {};
const listData = {
name: `C411693-${getTestEntityValue('test_list')}`,
Expand Down Expand Up @@ -47,19 +47,19 @@ describe('lists', () => {
});

after('Delete test data', () => {
cy.getUserToken(userData.username, userData.password);
Lists.deleteViaApi(listData.id);
cy.getAdminToken();
Lists.deleteViaApi(listData.id);
Users.deleteViaApi(userData.userId);
});

it(
'411694 C411693 Lists (Admin): All permissions (corsair)',
'C411694 C411693 Lists (Admin): All permissions (corsair)',
{ tags: ['smoke', 'corsair'] },
() => {
cy.login(userData.username, userData.password);
cy.visit(TopMenu.listsPath);
Lists.waitLoading();
cy.login(userData.username, userData.password, {
path: TopMenu.listsPath,
waiter: Lists.waitLoading,
});
Lists.verifyNewButtonIsEnabled();
Lists.verifyListIsPresent(listData.name);
Lists.selectActiveLists();
Expand Down
67 changes: 67 additions & 0 deletions cypress/e2e/lists/permissions/lists-refresh-permissions.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Permissions from '../../../support/dictionary/permissions';
import Lists from '../../../support/fragments/lists/lists';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import { getTestEntityValue } from '../../../support/utils/stringTools';

describe('lists', () => {
describe('permissions', () => {
const userData = {};
const listData = {
name: `C411821-${getTestEntityValue('test_list')}`,
description: `C411821-${getTestEntityValue('test_list_description')}`,
recordType: 'Users',
fqlQuery: '',
isActive: true,
isPrivate: false,
};

before('Create test data', () => {
cy.getAdminToken();
cy.createTempUser([
Permissions.listsCreateEditRefresh.gui,
Permissions.usersViewRequests.gui,
Permissions.uiOrdersCreate.gui,
Permissions.inventoryAll.gui,
Permissions.loansAll.gui,
Permissions.uiOrganizationsViewEditCreate.gui,
])
.then((userProperties) => {
userData.username = userProperties.username;
userData.password = userProperties.password;
userData.userId = userProperties.userId;
})
.then(() => {
Lists.buildQueryOnActiveUsers().then((query) => {
Lists.createQueryViaApi(query).then((createdQuery) => {
listData.queryId = createdQuery.queryId;
listData.fqlQuery = createdQuery.fqlQuery;
listData.fields = ['users.active', 'user.id'];

Lists.createViaApi(listData).then((body) => {
listData.id = body.id;
});
});
});
});
});

after('Delete test data', () => {
cy.getAdminToken();
Lists.deleteViaApi(listData.id);
Users.deleteViaApi(userData.userId);
});

it('C411821 Refresh list: Not canned lists (corsair)', { tags: ['smoke', 'corsair'] }, () => {
cy.login(userData.username, userData.password, {
path: TopMenu.listsPath,
waiter: Lists.waitLoading,
});
Lists.verifyListIsPresent(listData.name);
Lists.openList(listData.name);
Lists.openActions();
Lists.refreshList();
Lists.waitForCompilingToComplete();
});
});
});
78 changes: 78 additions & 0 deletions cypress/e2e/lists/permissions/lists-view-permissions.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import Permissions from '../../../support/dictionary/permissions';
import Lists from '../../../support/fragments/lists/lists';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import { getTestEntityValue } from '../../../support/utils/stringTools';

describe('lists', () => {
describe('permissions', () => {
const userData = {};
const listData = {
name: `C418651-${getTestEntityValue('test_list')}`,
description: `C418651-${getTestEntityValue('test_list_description')}`,
recordType: 'Users',
fqlQuery: '',
isActive: true,
isPrivate: false,
};

before('Create test data', () => {
cy.getAdminToken();
cy.createTempUser([
Permissions.listsView.gui,
Permissions.usersViewRequests.gui,
Permissions.uiOrdersCreate.gui,
Permissions.inventoryAll.gui,
Permissions.loansAll.gui,
Permissions.uiOrganizationsViewEditCreate.gui,
])
.then((userProperties) => {
userData.username = userProperties.username;
userData.password = userProperties.password;
userData.userId = userProperties.userId;
})
.then(() => {
Lists.buildQueryOnActiveUsers().then((query) => {
Lists.createQueryViaApi(query).then((createdQuery) => {
listData.queryId = createdQuery.queryId;
listData.fqlQuery = createdQuery.fqlQuery;
listData.fields = ['users.active', 'user.id'];

Lists.createViaApi(listData).then((body) => {
listData.id = body.id;
});
});
});
});
});

after('Delete test data', () => {
cy.getAdminToken();
Lists.deleteViaApi(listData.id);
Users.deleteViaApi(userData.userId);
});

it('C418651 Lists (Enable): Can view lists (corsair)', { tags: ['smoke', 'corsair'] }, () => {
cy.login(userData.username, userData.password, {
path: TopMenu.listsPath,
waiter: Lists.waitLoading,
});
Lists.verifyNewButtonDoesNotExist();
Lists.verifyListIsPresent(listData.name);
Lists.selectActiveLists();
Lists.selectInactiveLists();
Lists.selectPrivateLists();
Lists.selectSharedLists();
Lists.selectRecordTypeFilter(listData.recordType);
Lists.resetAllFilters();

Lists.openList(listData.name);
Lists.openActions();
Lists.verifyRefreshListButtonDoesNotExist();
Lists.verifyEditListButtonDoesNotExist();
Lists.verifyDuplicateListButtonDoesNotExist();
Lists.verifyDeleteListButtonDoesNotExist();
Lists.verifyExportListButtonDoesNotExist();
});
});
});
5 changes: 5 additions & 0 deletions cypress/support/dictionary/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,11 @@ export default {
gui: 'Lists (Admin): All permissions',
},

listsView: {
internal: 'module.lists.enabled',
gui: 'Lists (Enable): Can view lists',
},

listsEdit: {
internal: 'module.lists.refresh',
gui: 'Lists (Edit): Can create, edit, and refresh lists',
Expand Down
24 changes: 24 additions & 0 deletions cypress/support/fragments/lists/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export default {
cy.expect(duplicateList.has({ disabled: true }));
},

verifyDuplicateListButtonDoesNotExist() {
cy.expect(duplicateList.absent());
},

deleteList() {
cy.do(deleteList.click());
cy.wait(1000);
Expand All @@ -179,10 +183,18 @@ export default {
cy.expect(deleteList.has({ disabled: true }));
},

verifyDeleteListButtonDoesNotExist() {
cy.expect(deleteList.absent());
},

verifyEditListButtonIsDisabled() {
cy.expect(editList.has({ disabled: true }));
},

verifyEditListButtonDoesNotExist() {
cy.expect(editList.absent());
},

verifyEditListButtonIsActive() {
cy.expect(editList.exists());
cy.expect(editList.has({ disabled: false }));
Expand All @@ -197,6 +209,10 @@ export default {
cy.expect(exportList.has({ disabled: true }));
},

verifyExportListButtonDoesNotExist() {
cy.expect(exportList.absent());
},

verifyExportListButtonIsActive() {
cy.expect(exportList.exists());
cy.expect(exportList.has({ disabled: false }));
Expand Down Expand Up @@ -225,6 +241,14 @@ export default {
cy.expect(newLink.exists());
},

verifyNewButtonIsDisabled() {
cy.expect(newLink.has({ disabled: true }));
},

verifyNewButtonDoesNotExist() {
cy.expect(newLink.absent());
},

expiredPatronLoan() {
cy.do(Link('Inactive patrons with open loans').click());
},
Expand Down

0 comments on commit 538dbf7

Please sign in to comment.