|
1 | 1 | import loginPage from '../../../Login.page'; |
2 | 2 | import pluginPage from '../../../Plugin.page'; |
3 | 3 |
|
4 | | -describe('Time Planning Plugin Activation for Absence Requests Tests', () => { |
| 4 | +describe('Enable Backend Config plugin', () => { |
5 | 5 | beforeEach(() => { |
6 | 6 | cy.visit('http://localhost:4200'); |
7 | 7 | loginPage.login(); |
| 8 | + pluginPage.Navbar.goToPluginsPage(); |
8 | 9 | }); |
9 | 10 |
|
10 | | - it('should activate time-planning plugin', () => { |
11 | | - pluginPage.Navbar.goToPluginsPage(); |
12 | | - cy.intercept('GET', '**/api/plugins-management/plugins').as('getPlugins'); |
13 | | - cy.wait('@getPlugins', { timeout: 30000 }); |
14 | | - |
15 | | - pluginPage.getEnableBtn('time-planning-pn').then((enableBtn) => { |
16 | | - if (enableBtn.is(':visible')) { |
17 | | - enableBtn.click(); |
18 | | - cy.wait(1000); |
| 11 | + it('should enabled Time registration plugin', () => { |
| 12 | + const pluginName = 'Microting Time Planning Plugin'; |
| 13 | + |
| 14 | + // Open action menu for the plugin |
| 15 | + cy.contains('.mat-mdc-row', pluginName).first().find('#actionMenu').click(); |
| 16 | + cy.wait(500); |
| 17 | + |
| 18 | + // Click the status button inside the menu to enable the plugin |
| 19 | + cy.get('#plugin-status-button0').should('be.visible').click(); |
| 20 | + cy.wait(500); |
| 21 | + |
| 22 | + // Confirm activation in the modal if present |
| 23 | + cy.get('body').then(($body) => { |
| 24 | + if ($body.find('#pluginOKBtn').length > 0) { |
| 25 | + cy.get('#pluginOKBtn').click(); |
| 26 | + cy.wait(100000); // Wait for plugin activation |
19 | 27 | } |
20 | 28 | }); |
| 29 | + |
| 30 | + cy.visit('http://localhost:4200'); |
| 31 | + loginPage.login(); |
| 32 | + pluginPage.Navbar.goToPluginsPage(); |
| 33 | + |
| 34 | + // Verify the plugin is enabled by checking the status |
| 35 | + // Re-open the action menu to check the status |
| 36 | + cy.contains('.mat-mdc-row', pluginName).first().find('#actionMenu').click(); |
| 37 | + cy.wait(500); |
| 38 | + |
| 39 | + cy.get('#plugin-status-button0') |
| 40 | + .find('mat-icon') |
| 41 | + .should('contain.text', 'toggle_on'); // plugin is enabled |
21 | 42 | }); |
22 | 43 | }); |
0 commit comments