1- import { expect , vi } from "vitest" ;
1+ import { expect } from "vitest" ;
22import { test , describe } from "../../drivers/vitest/driver" ;
33import * as precondition from "../../preconditions" ;
44import { licenseTypeDetails } from "./questions/licenseTypeDetails" ;
5+ import { licenseExpiryDate } from "./questions/licenseExpiryDate" ;
6+ import { licenseExpiryDaysLeft } from "./questions/licenseExpiryDaysLeft" ;
7+ import { waitFor } from "@testing-library/vue" ;
58
69describe ( "FEATURE: License" , ( ) => {
710 describe ( "RULE: Platform license type should be shown shown" , ( ) => {
811 test ( "EXAMPLE: Valid platform license type should be shown" , async ( { driver } ) => {
9-
10- /* SCENARIO
11- Given the platform license is valid
12- Then the platform license type is shown
13- */
12+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
1413 await driver . setUp ( precondition . hasActiveLicense ) ;
1514 await driver . goTo ( "/configuration/license" ) ;
16-
17- expect ( await licenseTypeDetails ( ) ) . toBe ( "Commercial, Enterprise" ) ;
18-
19-
20-
15+ waitFor ( async ( ) => {
16+ expect ( await licenseTypeDetails ( ) ) . toBe ( "Commercial, Enterprise" ) ;
17+ } ) ;
2118 } ) ;
22- describe ( "RULE: License expiry date should be shown" , ( ) => {
23- test . todo ( "EXAMPLE: Valid license expiry date should be shown" ) ;
24-
25- /* SCENARIO
26- Given a valid platform license
27- Then the license expiry date is shown
28- */
19+ } ) ;
20+ describe ( "RULE: License expiry date should be shown" , ( ) => {
21+ test ( "EXAMPLE: Valid license expiry date should be shown" , async ( { driver } ) => {
22+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
23+ await driver . setUp ( precondition . hasActiveLicense ) ;
24+ await driver . goTo ( "/configuration/license" ) ;
25+ waitFor ( async ( ) => {
26+ expect ( await licenseExpiryDate ( ) ) . toBeVisible ( ) ;
27+ } ) ;
2928 } ) ;
30- describe ( "RULE: Remaining license period should be displayed" , ( ) => {
31- test . todo ( "EXAMPLE: An expired license should show 'expired'" ) ;
32-
33- /* SCENARIO
29+ } ) ;
30+ describe ( "RULE: Remaining license period should be displayed" , ( ) => {
31+ test . todo ( "EXAMPLE: An expired license should show 'expired'" ) ;
32+ /* SCENARIO
3433 Expired license
35-
34+
3635 Given an expired platform license
37- Then "expired" is shown
38- */
39-
40- test . todo ( "EXAMPLE: License expiring with 10 days should show 'expiring in X days'" ) ;
41- /* SCENARIO
42- License expiring soon
43-
44- Given a platform license with an expiry date within 10 days
45- Then "expiring in X days" is shown
36+ Then "expired" is shown
4637 */
47-
48- test . todo ( "EXAMPLE: License expiring tomorrow should show 'expiring tomorrow'" ) ;
49- /* SCENARIO
50- License expiring tomorrow
51-
52- Given a platform license which expires tomorrow
53- Then "expiring tomorrow" is shown
54- */
55-
56- test . todo ( "EXAMPLE: License expiring today should show 'expiring today'" ) ;
57- /* SCENARIO
58- License expiring today
59-
60- Given a platform license which expires today
61- Then "expiring today" is shown
62- */
63-
64- test . todo ( "EXAMPLE: License expiring in more than 10 days should show 'X days left" ) ;
38+ } ) ;
39+ describe ( "RULE: License expiring soon must be displayed" , ( ) => {
40+ test ( "EXAMPLE: License expiring with 10 days should show 'expiring in X days'" , async ( { driver } ) => {
6541 /* SCENARIO
66- License expiring in the future
67-
68- Given a platform license which expires more than 10 days from now
69- Then "X days left" is shown
70- */
42+ License expiring soon
43+
44+ Given a platform license with an expiry date within 10 days
45+ Then "expiring in X days" is shown
46+ */
47+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
48+ const x = precondition . hasExpiringLicense ( precondition . LicenseType . Subscription ) ;
49+ console . log ( x ) ;
50+ await driver . setUp ( precondition . hasExpiringLicense ( precondition . LicenseType . Subscription ) ) ;
51+ await driver . goTo ( "/configuration/license" ) ;
52+ waitFor ( async ( ) => {
53+ expect ( await licenseExpiryDaysLeft ( ) ) . toBeVisible ( ) ;
54+ } ) ;
7155 } ) ;
72- describe ( "RULE: Non-license options should be hidden if license has expired" , ( ) => {
73- test . todo ( "EXAMPLE: Only 'LICENSE' tab is visible when license has expired" ) ;
74-
56+ } ) ;
57+ describe ( "RULE: ABC" , ( ) => {
58+ test . todo ( "EXAMPLE: License expiring tomorrow should show 'expiring tomorrow'" ) ;
59+ /* SCENARIO
60+ License expiring tomorrow
61+
62+ Given a platform license which expires tomorrow
63+ Then "expiring tomorrow" is shown
64+ */
65+ } ) ;
66+ describe ( "RULE: EFG" , ( ) => {
67+ test . todo ( "EXAMPLE: License expiring today should show 'expiring today'" ) ;
68+ /* SCENARIO
69+ License expiring today
70+
71+ Given a platform license which expires today
72+ Then "expiring today" is shown
73+ */
74+ } ) ;
75+ describe ( "RULE: Remaining license period should be displayed" , ( ) => {
76+ test ( "EXAMPLE: License expiring in more than 10 days should show 'X days left" , async ( { driver } ) => {
7577 /* SCENARIO
76- Given an expired license
77- Then "LICENSE" is the only visible tab in the Configuration screen
78- */
78+ License expiring in the future
79+
80+ Given a platform license which expires more than 10 days from now
81+ Then "X days left" is shown
82+ */
83+ await driver . setUp ( precondition . serviceControlWithMonitoring ) ;
84+ await driver . setUp ( precondition . hasActiveLicense ) ;
85+ await driver . goTo ( "/configuration/license" ) ;
86+ waitFor ( async ( ) => {
87+ expect ( await licenseExpiryDaysLeft ( ) ) . toContain ( "days left" ) ;
88+ } ) ;
7989 } ) ;
8090 } ) ;
81- } ) ;
91+ describe ( "RULE: Non-license options should be hidden if license has expired" , ( ) => {
92+ test . todo ( "EXAMPLE: Only 'LICENSE' tab is visible when license has expired" ) ;
93+
94+ /* SCENARIO
95+ Given an expired license
96+ Then "LICENSE" is the only visible tab in the Configuration screen
97+ */
98+ } ) ;
99+ } ) ;
0 commit comments