-
Notifications
You must be signed in to change notification settings - Fork 4
Update WDIO tests to use action menu for plugin activation #580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import myEformsPage from '../../Page objects/MyEforms.page'; | |
| import pluginPage from '../../Page objects/Plugin.page'; | ||
|
|
||
| import { expect } from 'chai'; | ||
| import { $ } from '@wdio/globals'; | ||
|
|
||
| describe('Application settings page - site header section', function () { | ||
| before(async () => { | ||
|
|
@@ -17,47 +18,104 @@ describe('Application settings page - site header section', function () { | |
| }); | ||
|
|
||
| it('should activate the plugin', async () => { | ||
| let plugin = await pluginPage.getFirstPluginRowObj(); | ||
| for (let i = 1; i < 10; i++) { | ||
| // Helper function to activate a plugin by index using action menu | ||
| const activatePlugin = async (index: number, pluginName: string) => { | ||
| // Open action menu | ||
| const actionMenuBtn = await $(`#action-items-${index}`).$('#actionMenu'); | ||
| await actionMenuBtn.waitForDisplayed({ timeout: 40000 }); | ||
| await actionMenuBtn.waitForClickable({ timeout: 40000 }); | ||
| await actionMenuBtn.click(); | ||
| await browser.pause(500); | ||
|
|
||
| // Click on the status button inside the menu | ||
| const statusBtn = await $(`#plugin-status-button${index}`); | ||
| await statusBtn.waitForDisplayed({ timeout: 40000 }); | ||
| await statusBtn.waitForClickable({ timeout: 40000 }); | ||
| await statusBtn.click(); | ||
| await browser.pause(500); | ||
|
|
||
| // Confirm activation in the modal | ||
| const pluginOKBtn = await $('#pluginOKBtn'); | ||
| await pluginOKBtn.waitForDisplayed({ timeout: 40000 }); | ||
| await pluginOKBtn.click(); | ||
| await browser.pause(100000); // We need to wait 100 seconds for the plugin to create db etc. | ||
|
|
||
| // Re-login and navigate back to plugins page | ||
| await loginPage.open('/'); | ||
| await loginPage.login(); | ||
| await myEformsPage.Navbar.goToPluginsPage(); | ||
| await browser.pause(500); | ||
| }; | ||
|
|
||
| // Helper function to check plugin status via action menu | ||
| const checkPluginStatus = async (index: number, expectedStatus: string, pluginName: string) => { | ||
| // Open action menu | ||
| const actionMenuBtn = await $(`#action-items-${index}`).$('#actionMenu'); | ||
| await actionMenuBtn.waitForDisplayed({ timeout: 40000 }); | ||
| await actionMenuBtn.waitForClickable({ timeout: 40000 }); | ||
| await actionMenuBtn.click(); | ||
| await browser.pause(500); | ||
|
|
||
| // Check status | ||
| const statusBtn = await $(`#plugin-status-button${index}`); | ||
| await statusBtn.waitForDisplayed({ timeout: 40000 }); | ||
| const statusIcon = await statusBtn.$('mat-icon'); | ||
| const status = await statusIcon.getText(); | ||
| expect(status, `${pluginName} status is not ${expectedStatus}`).eq(expectedStatus); | ||
|
|
||
| // Close the menu | ||
| await browser.keys(['Escape']); | ||
| await browser.pause(300); | ||
| }; | ||
|
|
||
| // Find and activate Microting Items Planning Plugin | ||
| for (let i = 0; i < 10; i++) { | ||
|
||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Items Planning Plugin') { | ||
| await plugin.enableOrDisablePlugin(); | ||
| await activatePlugin(i, plugin.name); | ||
| break; | ||
| } | ||
| } | ||
| for (let i = 1; i < 10; i++) { | ||
|
|
||
| // Find and activate Microting Time Planning Plugin | ||
| for (let i = 0; i < 10; i++) { | ||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Time Planning Plugin') { | ||
| await plugin.enableOrDisablePlugin(); | ||
| await activatePlugin(i, plugin.name); | ||
| break; | ||
| } | ||
| } | ||
| for (let i = 1; i < 10; i++) { | ||
|
|
||
| // Find and activate Microting Backend Configuration Plugin | ||
| for (let i = 0; i < 10; i++) { | ||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Backend Configuration Plugin') { | ||
| await plugin.enableOrDisablePlugin(); | ||
| await activatePlugin(i, plugin.name); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| for (let i = 1; i < 10; i++) { | ||
| // Verify all plugins are activated | ||
| for (let i = 0; i < 10; i++) { | ||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Items Planning Plugin') { | ||
| expect(plugin.status, 'Microting Items Planning Plugin is not enabled').eq('toggle_on'); | ||
| await checkPluginStatus(i, 'toggle_on', plugin.name); | ||
| break; | ||
| } | ||
| } | ||
| for (let i = 1; i < 10; i++) { | ||
|
|
||
| for (let i = 0; i < 10; i++) { | ||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Time Planning Plugin') { | ||
| expect(plugin.status, 'Microting Time Planning Plugin is not enabled').eq('toggle_on'); | ||
| await checkPluginStatus(i, 'toggle_on', plugin.name); | ||
| break; | ||
| } | ||
| } | ||
| for (let i = 1; i < 10; i++) { | ||
|
|
||
| for (let i = 0; i < 10; i++) { | ||
| const plugin = await pluginPage.getPluginRowObjByIndex(i); | ||
| if (plugin.name === 'Microting Backend Configuration Plugin') { | ||
| expect(plugin.status, 'Microting Backend Configuration Plugin is not enabled').eq('toggle_on'); | ||
| await checkPluginStatus(i, 'toggle_on', plugin.name); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this index needs to be index -= 1, otherwise it will activate the wrong plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 56ff223. Both
activatePlugin()andcheckPluginStatus()now useindex - 1for HTML selectors to account for the difference between 1-basedgetPluginRowObjByIndex()and 0-based DOM element IDs.