|
| 1 | +// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates |
| 2 | +// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> |
| 3 | +// |
| 4 | +// SPDX-License-Identifier: Apache-2.0 |
| 5 | +import { faker } from '../../testing/Faker'; |
| 6 | +import { test } from '../utils'; |
| 7 | + |
| 8 | +const [resourceName1, resourceName2, resourceName3, resourceName4] = |
| 9 | + faker.opossum.resourceNames({ count: 4 }); |
| 10 | +const [attributionId1, packageInfo1] = faker.opossum.rawAttribution({ |
| 11 | + packageName: 'a', |
| 12 | + classification: 0, |
| 13 | + criticality: 'medium', |
| 14 | +}); |
| 15 | +const [attributionId2, packageInfo2] = faker.opossum.rawAttribution({ |
| 16 | + packageName: 'b', |
| 17 | + classification: 1, |
| 18 | + criticality: 'high', |
| 19 | +}); |
| 20 | + |
| 21 | +test.use({ |
| 22 | + data: { |
| 23 | + inputData: faker.opossum.inputData({ |
| 24 | + resources: faker.opossum.resources({ |
| 25 | + [resourceName1]: { |
| 26 | + [resourceName2]: { |
| 27 | + [resourceName3]: 1, |
| 28 | + }, |
| 29 | + }, |
| 30 | + [resourceName4]: 1, |
| 31 | + }), |
| 32 | + externalAttributions: faker.opossum.rawAttributions({ |
| 33 | + [attributionId1]: packageInfo1, |
| 34 | + [attributionId2]: packageInfo2, |
| 35 | + }), |
| 36 | + resourcesToAttributions: faker.opossum.resourcesToAttributions({ |
| 37 | + [faker.opossum.filePath(resourceName1, resourceName2, resourceName3)]: [ |
| 38 | + attributionId1, |
| 39 | + ], |
| 40 | + [faker.opossum.filePath(resourceName4)]: [attributionId2], |
| 41 | + }), |
| 42 | + }), |
| 43 | + }, |
| 44 | +}); |
| 45 | + |
| 46 | +test('shows classification and criticality in statistics popup only if selected', async ({ |
| 47 | + menuBar, |
| 48 | + projectStatisticsPopup, |
| 49 | +}) => { |
| 50 | + await menuBar.openProjectStatistics(); |
| 51 | + await projectStatisticsPopup.assert.titleIsVisible(); |
| 52 | + // hover on title to avoid getting tooltips that mess up locators |
| 53 | + await projectStatisticsPopup.title.hover(); |
| 54 | + |
| 55 | + await projectStatisticsPopup.assert.signalsByCriticalityIsVisible(); |
| 56 | + await projectStatisticsPopup.assert.signalsByClassificationIsShown(); |
| 57 | + |
| 58 | + await menuBar.toggleShowClassificationOff(); |
| 59 | + |
| 60 | + await projectStatisticsPopup.assert.signalsByCriticalityIsVisible(); |
| 61 | + await projectStatisticsPopup.assert.signalsByClassificationIsNotShown(); |
| 62 | + |
| 63 | + await menuBar.toggleShowCriticalityOff(); |
| 64 | + |
| 65 | + await projectStatisticsPopup.assert.signalsByCriticalityIsNotVisible(); |
| 66 | + await projectStatisticsPopup.assert.signalsByClassificationIsNotShown(); |
| 67 | +}); |
0 commit comments