|
| 1 | +import { Permissions } from '../../../support/dictionary'; |
| 2 | +import SettingsMenu from '../../../support/fragments/settingsMenu'; |
| 3 | +import ServicePoints from '../../../support/fragments/settings/tenant/servicePoints/servicePoints'; |
| 4 | +import TenantPane, { TENANTS } from '../../../support/fragments/settings/tenant/tenantPane'; |
| 5 | +import Users from '../../../support/fragments/users/users'; |
| 6 | +import getRandomPostfix from '../../../support/utils/stringTools'; |
| 7 | + |
| 8 | +describe('Settings: Tenant', () => { |
| 9 | + const testData = { |
| 10 | + servicePoint: { |
| 11 | + name: `autotest_sp_name_${getRandomPostfix()}`, |
| 12 | + code: `autotest_sp_code_${getRandomPostfix()}`, |
| 13 | + displayName: `autotest_sp_display_${getRandomPostfix()}`, |
| 14 | + }, |
| 15 | + updatedServicePoint: { |
| 16 | + name: `autotest_sp_name_upd_${getRandomPostfix()}`, |
| 17 | + }, |
| 18 | + user: {}, |
| 19 | + }; |
| 20 | + |
| 21 | + before('Create test data', () => { |
| 22 | + // Capability set "Settings - UI-Tenant-Settings Settings Service Points - Manage" |
| 23 | + cy.createTempUser([Permissions.uiTenantSettingsServicePointsCRUD.gui]).then( |
| 24 | + (userProperties) => { |
| 25 | + testData.user = userProperties; |
| 26 | + cy.login(testData.user.username, testData.user.password, { |
| 27 | + path: SettingsMenu.tenantPath, |
| 28 | + waiter: TenantPane.waitLoading, |
| 29 | + }); |
| 30 | + }, |
| 31 | + ); |
| 32 | + }); |
| 33 | + |
| 34 | + after('Delete test data', () => { |
| 35 | + cy.getAdminToken().then(() => { |
| 36 | + [testData.servicePoint.name, testData.updatedServicePoint.name].forEach((name) => { |
| 37 | + ServicePoints.getViaApi({ query: `name=="${name}"` }).then((servicePoints) => { |
| 38 | + if (servicePoints.length) { |
| 39 | + ServicePoints.deleteViaApi(servicePoints[0].id); |
| 40 | + } |
| 41 | + }); |
| 42 | + }); |
| 43 | + Users.deleteViaApi(testData.user.userId); |
| 44 | + }); |
| 45 | + }); |
| 46 | + |
| 47 | + it( |
| 48 | + 'C519 Settings - UI-Tenant-Settings Settings Service Points - Manage (firebird)', |
| 49 | + { tags: ['extendedPath', 'firebird', 'C519'] }, |
| 50 | + () => { |
| 51 | + // Step 6: Open Settings App and navigate to Tenant settings --> Service Points |
| 52 | + // 7.1) See "Service points" menu option |
| 53 | + TenantPane.verifyNavigationOption(TENANTS.SERVICE_POINTS); |
| 54 | + |
| 55 | + // 7.2) See service point list in the right pane |
| 56 | + TenantPane.selectTenant(TENANTS.SERVICE_POINTS); |
| 57 | + ServicePoints.waitLoading(); |
| 58 | + ServicePoints.verifyNewButtonEnabled(); |
| 59 | + |
| 60 | + // 7.3) CREATE: Add a new Service Point |
| 61 | + ServicePoints.createNewServicePoint(testData.servicePoint); |
| 62 | + ServicePoints.servicePointExists(testData.servicePoint.name); |
| 63 | + |
| 64 | + // READ: Open service point details and verify edit button is available |
| 65 | + ServicePoints.openServicePointDetails(testData.servicePoint.name); |
| 66 | + ServicePoints.verifyEditAndCloseButtonEnabled(); |
| 67 | + ServicePoints.closeServicePointPane(testData.servicePoint.name); |
| 68 | + |
| 69 | + // UPDATE: Edit the service point name and save |
| 70 | + ServicePoints.editServicePoint({ |
| 71 | + name: testData.servicePoint.name, |
| 72 | + newName: testData.updatedServicePoint.name, |
| 73 | + }); |
| 74 | + ServicePoints.servicePointExists(testData.updatedServicePoint.name); |
| 75 | + }, |
| 76 | + ); |
| 77 | +}); |
0 commit comments