Skip to content

Commit

Permalink
fixed C466237,C466238,C466319
Browse files Browse the repository at this point in the history
  • Loading branch information
TetianaParanich committed Sep 25, 2024
1 parent d798e95 commit 2a3eb73
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 100 deletions.
85 changes: 0 additions & 85 deletions cypress/e2e/permissions/view-reading-room-access-permission.cy.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import uuid from 'uuid';
import Permissions from '../../support/dictionary/permissions';
import SettingsReadingRoom from '../../support/fragments/settings/tenant/general/readingRoom';
import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints';
import TopMenu from '../../support/fragments/topMenu';
import UserEdit from '../../support/fragments/users/userEdit';
import Users from '../../support/fragments/users/users';
import UsersCard from '../../support/fragments/users/usersCard';
import UsersSearchPane from '../../support/fragments/users/usersSearchPane';

describe('Reading Room Access', () => {
const testData = {
servicePoint: ServicePoints.getDefaultServicePoint(),
readingRoomId: uuid(),
};

before('Create test data', () => {
cy.getAdminToken();
ServicePoints.createViaApi(testData.servicePoint)
.then((servicePoint) => {
testData.servicePoint.id = servicePoint.body.id;
})
.then(() => SettingsReadingRoom.createReadingRoomViaApi(
testData.servicePoint.id,
testData.servicePoint.name,
testData.readingRoomId,
false,
));

cy.createTempUser([]).then((userProperties) => {
testData.userWithoutPermissions = userProperties;

UserEdit.addServicePointViaApi(
testData.servicePoint.id,
userProperties.userId,
testData.servicePoint.id,
);
});

cy.createTempUser([Permissions.uiUserCanAssignUnassignPermissions.gui]).then(
(userProperties) => {
testData.user = userProperties;

cy.login(testData.user.username, testData.user.password, {
path: TopMenu.usersPath,
waiter: UsersSearchPane.waitLoading,
});
},
);
});

after('Deleting created entities', () => {
cy.getAdminToken();
ServicePoints.deleteViaApi(testData.servicePoint.id);
SettingsReadingRoom.deleteReadingRoomViaApi(testData.readingRoomId);
Users.deleteViaApi(testData.user.userId);
Users.deleteViaApi(testData.userWithoutPermissions.userId);
});

it(
'C466238 User can create edit and remove reading room access permission (volaris)',
{ tags: ['smoke', 'volaris'] },
() => {
UsersSearchPane.searchByUsername(testData.userWithoutPermissions.username);
UsersSearchPane.waitLoading();
UserEdit.addPermissions([Permissions.uiSettingsTenantReadingRoomAll.gui]);
UserEdit.saveAndClose();
UsersCard.verifyPermissions([Permissions.uiSettingsTenantReadingRoomAll.gui]);
},
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import uuid from 'uuid';
import Permissions from '../../support/dictionary/permissions';
import { ReadingRoom } from '../../support/fragments/settings/tenant/general';
import SettingsReadingRoom from '../../support/fragments/settings/tenant/general/readingRoom';
import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints';
import TopMenu from '../../support/fragments/topMenu';
import UserEdit from '../../support/fragments/users/userEdit';
import Users from '../../support/fragments/users/users';
import UsersCard from '../../support/fragments/users/usersCard';
import UsersSearchPane from '../../support/fragments/users/usersSearchPane';

describe('Reading Room Access', () => {
const testData = {
servicePoint: ServicePoints.getDefaultServicePoint(),
readingRoomId: uuid(),
};

before('Create test data and login', () => {
cy.getAdminToken();
ServicePoints.createViaApi(testData.servicePoint)
.then((servicePoint) => {
testData.servicePoint.id = servicePoint.body.id;
})
.then(() => SettingsReadingRoom.createReadingRoomViaApi(
testData.servicePoint.id,
testData.servicePoint.name,
testData.readingRoomId,
false,
));

cy.createTempUser([]).then((userProperties) => {
testData.userWithoutPermissions = userProperties;

UserEdit.addServicePointViaApi(
testData.servicePoint.id,
userProperties.userId,
testData.servicePoint.id,
);
});

cy.createTempUser([Permissions.uiUserCanAssignUnassignPermissions.gui]).then(
(userProperties) => {
testData.user = userProperties;

cy.login(testData.user.username, testData.user.password, {
path: TopMenu.usersPath,
waiter: UsersSearchPane.waitLoading,
});
},
);
});

after('Deleting created entities', () => {
cy.getAdminToken();
ServicePoints.deleteViaApi(testData.servicePoint.id);
ReadingRoom.deleteReadingRoomViaApi(testData.readingRoomId);
Users.deleteViaApi(testData.user.userId);
Users.deleteViaApi(testData.userWithoutPermissions.userId);
});

it(
'C466237 User can view reading room access permission (volaris)',
{ tags: ['smoke', 'volaris'] },
() => {
UsersSearchPane.searchByUsername(testData.userWithoutPermissions.username);
UsersSearchPane.waitLoading();
UserEdit.addPermissions([Permissions.uiSettingsTenantReadingRoom.gui]);
UserEdit.saveAndClose();
UsersCard.verifyPermissions([Permissions.uiSettingsTenantReadingRoom.gui]);
},
);
});
77 changes: 77 additions & 0 deletions cypress/e2e/reading-room/user-can-view-reading-room-access.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import uuid from 'uuid';
import Permissions from '../../support/dictionary/permissions';
import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints';
import SettingsMenu from '../../support/fragments/settingsMenu';
import Users from '../../support/fragments/users/users';
import SettingsReadingRoom from '../../support/fragments/settings/tenant/general/readingRoom';
import getRandomPostfix from '../../support/utils/stringTools';

describe('Reading Room Access', () => {
const testData = {
firstReadingRoomId: uuid(),
firstReadingRoomName: `Autotest_Reading_Room${getRandomPostfix()}`,
secondReadingRoomId: uuid(),
thirdReadingRoomId: uuid(),
};

before('Create test data', () => {
cy.getAdminToken();
ServicePoints.createViaApi(ServicePoints.getDefaultServicePoint()).then((servicePoint) => {
testData.firstServicePoint = servicePoint.body;

SettingsReadingRoom.createReadingRoomViaApi(
testData.firstServicePoint.id,
testData.firstServicePoint.name,
testData.firstReadingRoomId,
false,
testData.firstReadingRoomName,
);
});
ServicePoints.createViaApi(ServicePoints.getDefaultServicePoint()).then((servicePoint) => {
testData.secondServicePoint = servicePoint.body;

SettingsReadingRoom.createReadingRoomViaApi(
testData.secondServicePoint.id,
testData.secondServicePoint.name,
testData.secondReadingRoomId,
false,
);
});
ServicePoints.createViaApi(ServicePoints.getDefaultServicePoint()).then((servicePoint) => {
testData.thirdServicePoint = servicePoint.body;

SettingsReadingRoom.createReadingRoomViaApi(
testData.thirdServicePoint.id,
testData.thirdServicePoint.name,
testData.thirdReadingRoomId,
false,
);
});

cy.createTempUser([Permissions.uiSettingsTenantReadingRoom.gui]).then((userProperties) => {
testData.user = userProperties;

cy.login(testData.user.username, testData.user.password);
});
});

after('Deleting created entities', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.user.userId);
ServicePoints.deleteViaApi(testData.firstServicePoint.id);
ServicePoints.deleteViaApi(testData.secondServicePoint.id);
ServicePoints.deleteViaApi(testData.thirdServicePoint.id);
SettingsReadingRoom.deleteReadingRoomViaApi(testData.firstReadingRoomId);
SettingsReadingRoom.deleteReadingRoomViaApi(testData.secondReadingRoomId);
SettingsReadingRoom.deleteReadingRoomViaApi(testData.thirdReadingRoomId);
});

it('C466319 User can view reading room access (volaris)', { tags: ['smoke', 'volaris'] }, () => {
cy.visit(SettingsMenu.tenantPath);
SettingsReadingRoom.loadReadingRoomRecord();
SettingsReadingRoom.verifyColumns();
SettingsReadingRoom.verifyActionsButtonAbsent();
SettingsReadingRoom.verifyNewButtonAbsent();
SettingsReadingRoom.verifyPublicCheckboxIsDisabled(testData.firstReadingRoomName);
});
});
Loading

0 comments on commit 2a3eb73

Please sign in to comment.