@@ -3,6 +3,7 @@ import myEformsPage from '../../Page objects/MyEforms.page';
33import pluginPage from '../../Page objects/Plugin.page' ;
44
55import { expect } from 'chai' ;
6+ import { $ } from '@wdio/globals' ;
67
78describe ( 'Application settings page - site header section' , function ( ) {
89 before ( async ( ) => {
@@ -16,17 +17,68 @@ describe('Application settings page - site header section', function () {
1617 const plugin = await pluginPage . getFirstPluginRowObj ( ) ;
1718 expect ( plugin . id ) . equal ( 1 ) ;
1819 expect ( plugin . name ) . equal ( 'Microting Workflow Plugin' ) ;
19- expect ( plugin . status , 'status is not equal' ) . eq ( 'toggle_off' ) ;
20+
21+ // Open action menu to check status
22+ const actionMenuBtn = await $ ( '#action-items-0' ) . $ ( '#actionMenu' ) ;
23+ await actionMenuBtn . waitForDisplayed ( { timeout : 40000 } ) ;
24+ await actionMenuBtn . waitForClickable ( { timeout : 40000 } ) ;
25+ await actionMenuBtn . click ( ) ;
26+ await browser . pause ( 500 ) ;
27+
28+ const statusBtn = await $ ( '#plugin-status-button0' ) ;
29+ await statusBtn . waitForDisplayed ( { timeout : 40000 } ) ;
30+ const statusIcon = await statusBtn . $ ( 'mat-icon' ) ;
31+ const status = await statusIcon . getText ( ) ;
32+ expect ( status , 'status is not equal' ) . eq ( 'toggle_off' ) ;
33+
34+ // Close the menu
35+ await browser . keys ( [ 'Escape' ] ) ;
36+ await browser . pause ( 300 ) ;
2037 } ) ;
2138
2239 it ( 'should activate the plugin' , async ( ) => {
23- let plugin = await pluginPage . getFirstPluginRowObj ( ) ;
24- await plugin . enableOrDisablePlugin ( ) ;
25-
26- // $('Microting Items Planning Plugin').waitForDisplayed({timeout: 10000});
27- plugin = await pluginPage . getFirstPluginRowObj ( ) ;
40+ // Open action menu
41+ const actionMenuBtn = await $ ( '#action-items-0' ) . $ ( '#actionMenu' ) ;
42+ await actionMenuBtn . waitForDisplayed ( { timeout : 40000 } ) ;
43+ await actionMenuBtn . waitForClickable ( { timeout : 40000 } ) ;
44+ await actionMenuBtn . click ( ) ;
45+ await browser . pause ( 500 ) ;
46+
47+ // Click on the status button inside the menu
48+ const statusBtn = await $ ( '#plugin-status-button0' ) ;
49+ await statusBtn . waitForDisplayed ( { timeout : 40000 } ) ;
50+ await statusBtn . waitForClickable ( { timeout : 40000 } ) ;
51+ await statusBtn . click ( ) ;
52+ await browser . pause ( 500 ) ;
53+
54+ // Confirm activation in the modal
55+ const pluginOKBtn = await $ ( '#pluginOKBtn' ) ;
56+ await pluginOKBtn . waitForDisplayed ( { timeout : 40000 } ) ;
57+ await pluginOKBtn . click ( ) ;
58+ await browser . pause ( 100000 ) ; // We need to wait 100 seconds for the plugin to create db etc.
59+
60+ // Re-login and navigate back to plugins page
61+ await loginPage . open ( '/' ) ;
62+ await loginPage . login ( ) ;
63+ await myEformsPage . Navbar . goToPluginsPage ( ) ;
64+ await browser . pause ( 500 ) ;
65+
66+ // Verify the plugin is now activated
67+ const plugin = await pluginPage . getFirstPluginRowObj ( ) ;
2868 expect ( plugin . id ) . equal ( 1 ) ;
2969 expect ( plugin . name ) . equal ( 'Microting Workflow Plugin' ) ;
30- expect ( plugin . status , 'status is not equal' ) . eq ( 'toggle_on' ) ;
70+
71+ // Open action menu to check new status
72+ const actionMenuBtn2 = await $ ( '#action-items-0' ) . $ ( '#actionMenu' ) ;
73+ await actionMenuBtn2 . waitForDisplayed ( { timeout : 40000 } ) ;
74+ await actionMenuBtn2 . waitForClickable ( { timeout : 40000 } ) ;
75+ await actionMenuBtn2 . click ( ) ;
76+ await browser . pause ( 500 ) ;
77+
78+ const statusBtn2 = await $ ( '#plugin-status-button0' ) ;
79+ await statusBtn2 . waitForDisplayed ( { timeout : 40000 } ) ;
80+ const statusIcon2 = await statusBtn2 . $ ( 'mat-icon' ) ;
81+ const status = await statusIcon2 . getText ( ) ;
82+ expect ( status , 'status is not equal' ) . eq ( 'toggle_on' ) ;
3183 } ) ;
3284} ) ;
0 commit comments