@@ -27,68 +27,22 @@ test.describe('Application settings page - site header section', () => {
2727 const plugin = await pluginPage . getFirstPluginRowObj ( ) ;
2828 expect ( plugin . id ) . toBe ( 1 ) ;
2929 expect ( plugin . name ) . toBe ( 'Microting Workflow Plugin' ) ;
30-
31- // Open action menu to check status
32- const actionMenuBtn = page . locator ( '#action-items-0' ) . locator ( '#actionMenu' ) ;
33- await actionMenuBtn . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
34- await actionMenuBtn . click ( ) ;
35- await page . waitForTimeout ( 500 ) ;
36-
37- const statusBtn = page . locator ( '#plugin-status-button0' ) ;
38- await statusBtn . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
39- const statusIcon = statusBtn . locator ( 'mat-icon' ) ;
40- const status = await statusIcon . textContent ( ) ;
41- expect ( status ) . toBe ( 'toggle_off' ) ;
42-
43- // Close the menu
44- await page . keyboard . press ( 'Escape' ) ;
45- await page . waitForTimeout ( 300 ) ;
30+ expect ( plugin . status ) . toBe ( 'toggle_off' ) ;
4631 } ) ;
4732
4833 test ( 'should activate the plugin' , async ( ) => {
34+ test . setTimeout ( 180000 ) ;
4935 const loginPage = new LoginPage ( page ) ;
5036 const myEformsPage = new MyEformsPage ( page ) ;
5137 const pluginPage = new PluginPage ( page ) ;
5238
53- // Open action menu
54- const actionMenuBtn = page . locator ( '#action-items-0' ) . locator ( '#actionMenu' ) ;
55- await actionMenuBtn . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
56- await actionMenuBtn . click ( ) ;
57- await page . waitForTimeout ( 500 ) ;
58-
59- // Click on the status button inside the menu
60- const statusBtn = page . locator ( '#plugin-status-button0' ) ;
61- await statusBtn . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
62- await statusBtn . click ( ) ;
63- await page . waitForTimeout ( 500 ) ;
64-
65- // Confirm activation in the modal
66- const pluginOKBtn = page . locator ( '#pluginOKBtn' ) ;
67- await pluginOKBtn . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
68- await pluginOKBtn . click ( ) ;
69- await page . waitForTimeout ( 100000 ) ; // Wait for plugin to create db etc.
70-
71- // Re-login and navigate back to plugins page
72- await loginPage . open ( '/' ) ;
73- await loginPage . login ( ) ;
74- await myEformsPage . Navbar . goToPluginsPage ( ) ;
75- await page . waitForTimeout ( 500 ) ;
76-
77- // Verify the plugin is now activated
7839 const plugin = await pluginPage . getFirstPluginRowObj ( ) ;
79- expect ( plugin . id ) . toBe ( 1 ) ;
80- expect ( plugin . name ) . toBe ( 'Microting Workflow Plugin' ) ;
81-
82- // Open action menu to check new status
83- const actionMenuBtn2 = page . locator ( '#action-items-0' ) . locator ( '#actionMenu' ) ;
84- await actionMenuBtn2 . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
85- await actionMenuBtn2 . click ( ) ;
86- await page . waitForTimeout ( 500 ) ;
40+ await plugin . enableOrDisablePlugin ( ) ;
8741
88- const statusBtn2 = page . locator ( '#plugin-status-button0' ) ;
89- await statusBtn2 . waitFor ( { state : 'visible' , timeout : 40000 } ) ;
90- const statusIcon2 = statusBtn2 . locator ( 'mat-icon' ) ;
91- const status = await statusIcon2 . textContent ( ) ;
92- expect ( status ) . toBe ( 'toggle_on' ) ;
42+ // After enableOrDisablePlugin: re-logged in and on plugins page
43+ const pluginAfter = await pluginPage . getFirstPluginRowObj ( ) ;
44+ expect ( pluginAfter . id ) . toBe ( 1 ) ;
45+ expect ( pluginAfter . name ) . toBe ( 'Microting Workflow Plugin' ) ;
46+ expect ( pluginAfter . status ) . toBe ( 'toggle_on' ) ;
9347 } ) ;
9448} ) ;
0 commit comments