Skip to content

Commit cb7bb83

Browse files
authored
Merge pull request #7160 from microting/copilot/migrate-settings-tests-to-cypress
Migrate Application Settings tests from WebDriverIO to Cypress
2 parents 69a971b + 8cafb50 commit cb7bb83

File tree

5 files changed

+286
-10
lines changed

5 files changed

+286
-10
lines changed

WDIO_TO_CYPRESS_MIGRATION.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This document tracks the migration of WebDriverIO (wdio) e2e tests to Cypress te
77
## Current Status
88

99
- **Total wdio tests**: 38
10-
- **Cypress tests implemented**: 37
11-
- **Tests remaining to migrate**: 13
10+
- **Cypress tests implemented**: 39
11+
- **Tests remaining to migrate**: 11
1212

1313
## Tests Already Migrated to Cypress ✓
1414

@@ -54,22 +54,34 @@ The following wdio tests have been successfully migrated to Cypress:
5454
- ✓ folder-child.edit.spec.cy.ts (cypress/e2e/f/)
5555
- ✓ folder-child.delete.spec.cy.ts (cypress/e2e/f/)
5656

57-
## Tests to Migrate (17 tests)
57+
### Application Settings
58+
- ✓ application-settings.login-page.spec.cy.ts (cypress/e2e/g/)
59+
- ✓ application-settings.site-header.spec.cy.ts (cypress/e2e/g/)
60+
61+
## Tests to Migrate (15 tests)
5862

5963
The following tests need to be migrated from wdio to Cypress. They are organized by functional area for easier sub-issue creation.
6064

61-
### 1. Application Settings (2 tests)
65+
### 1. Application Settings (2 tests)
6266

6367
**Category**: Application Configuration and Settings
6468
**Priority**: Medium
65-
**Location**: e2e/Tests/application-settings/
69+
**Location**: e2e/Tests/application-settings/
70+
**Migrated to**: cypress/e2e/g/
6671

67-
Tests to migrate:
68-
- [ ] application-settings.login-page.spec.ts
69-
- [ ] application-settings.site-header.spec.ts
72+
Tests migrated:
73+
- application-settings.login-page.spec.cy.ts
74+
- application-settings.site-header.spec.cy.ts
7075

7176
**Description**: Tests for application-level settings including login page configuration and site header customization.
7277

78+
**Key Functionality**:
79+
- Customizing login page main and secondary text
80+
- Toggling visibility of login page elements (main text, secondary text, image)
81+
- Resetting login page settings to defaults
82+
- Customizing site header image visibility
83+
- Verifying changes persist on login and header pages
84+
7385
---
7486

7587
### 2. Device Users (3 tests) ✓
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { Navbar } from './Navbar.page';
2+
3+
export class ApplicationSettings {
4+
public Navbar = new Navbar();
5+
6+
// Save button
7+
getSaveBtn() {
8+
return cy.get('#applicationSettingsSaveBtn');
9+
}
10+
11+
save() {
12+
this.getSaveBtn().should('be.visible').click();
13+
cy.wait(500);
14+
cy.get('#spinner-animation').should('not.exist');
15+
}
16+
17+
// Site header elements
18+
getSiteHeaderMainText() {
19+
return cy.get('#main-header-text');
20+
}
21+
22+
getSiteHeaderSecondaryText() {
23+
return cy.get('#secondary-header-text');
24+
}
25+
26+
getSiteHeaderImage() {
27+
return cy.get('#site-header-image');
28+
}
29+
30+
// Login Page Settings
31+
LoginPage = {
32+
getMainTextInput: () => cy.get('#mainTextLoginPage'),
33+
getSecondaryTextInput: () => cy.get('#secondaryTextLoginPage'),
34+
getImageUploadBtn: () => cy.get('#loginPageImageUploadBtn'),
35+
getMainTextVisibilityToggleBtn: () => cy.get('#loginPageMainTextVisibilityToggler'),
36+
getSecondaryTextVisibilityToggleBtn: () => cy.get('#loginPageSecondaryTextVisibilityToggler'),
37+
getImageVisibilityToggler: () => cy.get('#loginPageImageVisibilityToggler'),
38+
getResetBtn: () => cy.get('#loginPageReset'),
39+
40+
reset: () => {
41+
cy.get('#loginPageReset').should('be.visible').should('be.enabled').click();
42+
cy.get('#spinner-animation').should('not.exist');
43+
}
44+
};
45+
46+
// Site Header Settings
47+
SiteHeader = {
48+
getMainTextInput: () => cy.get('#headerSettingsMainText'),
49+
getSecondaryTextInput: () => cy.get('#headerSettingsSecondaryText'),
50+
getImageUploadBtn: () => cy.get('#siteHeaderUploadBtn'),
51+
getMainTextVisibilityToggleBtn: () => cy.get('#siteHeaderMainTextToggler'),
52+
getSecondaryTextVisibilityToggleBtn: () => cy.get('#siteHeaderSecondaryTextToggler'),
53+
getImageVisibilityToggler: () => cy.get('#siteHeaderImageVisibilityToggler'),
54+
getResetBtn: () => cy.get('#siteHeaderReset'),
55+
56+
reset: () => {
57+
cy.get('#siteHeaderReset').should('be.visible').should('be.enabled').click();
58+
cy.get('#spinner-animation').should('not.exist');
59+
}
60+
};
61+
}
62+
63+
const applicationSettingsPage = new ApplicationSettings();
64+
export default applicationSettingsPage;
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import loginPage from '../Login.page';
2+
import applicationSettingsPage from '../ApplicationSettings.page';
3+
4+
const applicationSettingsConstants = {
5+
LoginPage: {
6+
originalMainText: 'eForm Backend',
7+
customMainText: 'Custom login page main text',
8+
originalSecondaryText: 'No more paper-forms and back-office data entry',
9+
customSecondaryText: 'Custom login page secondary text'
10+
}
11+
};
12+
13+
describe('Application settings - Login page section', () => {
14+
before(() => {
15+
cy.visit('http://localhost:4200');
16+
loginPage.login();
17+
});
18+
19+
it('should change main text', () => {
20+
applicationSettingsPage.Navbar.goToApplicationSettings();
21+
22+
// Wait for login page settings to be visible
23+
applicationSettingsPage.LoginPage.getMainTextInput().should('be.visible', { timeout: 240000 });
24+
25+
// Set custom main text
26+
applicationSettingsPage.LoginPage.getMainTextInput()
27+
.clear()
28+
.type(applicationSettingsConstants.LoginPage.customMainText);
29+
30+
// Save settings
31+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
32+
applicationSettingsPage.save();
33+
34+
// Logout to see changes
35+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
36+
applicationSettingsPage.Navbar.logout();
37+
38+
// Verify main text changed on login page
39+
loginPage.getUsernameInput().should('be.visible', { timeout: 40000 });
40+
loginPage.getLoginButton().should('be.visible');
41+
loginPage.getMainText().should('have.text', applicationSettingsConstants.LoginPage.customMainText);
42+
});
43+
44+
it('should change secondary text', () => {
45+
loginPage.login();
46+
applicationSettingsPage.Navbar.goToApplicationSettings();
47+
48+
// Wait for login page settings to be visible
49+
applicationSettingsPage.LoginPage.getSecondaryTextInput().should('be.visible', { timeout: 240000 });
50+
51+
// Set custom secondary text
52+
applicationSettingsPage.LoginPage.getSecondaryTextInput()
53+
.clear()
54+
.type(applicationSettingsConstants.LoginPage.customSecondaryText);
55+
56+
// Save settings
57+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
58+
applicationSettingsPage.save();
59+
60+
// Logout to see changes
61+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
62+
applicationSettingsPage.Navbar.logout();
63+
64+
// Verify secondary text changed on login page
65+
loginPage.getUsernameInput().should('be.visible', { timeout: 40000 });
66+
loginPage.getLoginButton().should('be.visible');
67+
loginPage.getSecondaryText().should('have.text', applicationSettingsConstants.LoginPage.customSecondaryText);
68+
});
69+
70+
it('should hide main text', () => {
71+
loginPage.login();
72+
applicationSettingsPage.Navbar.goToApplicationSettings();
73+
74+
// Wait for login page settings to be visible
75+
applicationSettingsPage.LoginPage.getMainTextVisibilityToggleBtn().should('be.visible', { timeout: 240000 });
76+
77+
// Toggle main text visibility
78+
applicationSettingsPage.LoginPage.getMainTextVisibilityToggleBtn().click();
79+
80+
// Save settings
81+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
82+
applicationSettingsPage.save();
83+
84+
// Logout to see changes
85+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
86+
applicationSettingsPage.Navbar.logout();
87+
88+
// Verify main text is hidden on login page
89+
loginPage.getUsernameInput().should('be.visible', { timeout: 40000 });
90+
loginPage.getLoginButton().should('be.visible');
91+
loginPage.getMainText().should('not.be.visible');
92+
});
93+
94+
it('should hide secondary text', () => {
95+
loginPage.login();
96+
applicationSettingsPage.Navbar.goToApplicationSettings();
97+
98+
// Wait for login page settings to be visible
99+
applicationSettingsPage.LoginPage.getSecondaryTextVisibilityToggleBtn().should('be.visible', { timeout: 240000 });
100+
101+
// Toggle secondary text visibility
102+
applicationSettingsPage.LoginPage.getSecondaryTextVisibilityToggleBtn().click();
103+
104+
// Save settings
105+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
106+
applicationSettingsPage.save();
107+
108+
// Logout to see changes
109+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
110+
applicationSettingsPage.Navbar.logout();
111+
112+
// Verify secondary text is hidden on login page
113+
loginPage.getUsernameInput().should('be.visible', { timeout: 40000 });
114+
loginPage.getLoginButton().should('be.visible');
115+
loginPage.getSecondaryText().should('not.be.visible');
116+
});
117+
118+
it('should hide image', () => {
119+
loginPage.login();
120+
applicationSettingsPage.Navbar.goToApplicationSettings();
121+
122+
// Wait for login page settings to be visible
123+
applicationSettingsPage.LoginPage.getImageVisibilityToggler().should('be.visible', { timeout: 240000 });
124+
125+
// Toggle image visibility
126+
applicationSettingsPage.LoginPage.getImageVisibilityToggler().click();
127+
128+
// Save settings
129+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
130+
applicationSettingsPage.save();
131+
132+
// Logout to see changes
133+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
134+
cy.wait(1000);
135+
applicationSettingsPage.Navbar.logout();
136+
137+
// Verify image is hidden on login page
138+
loginPage.getLoginButton().should('be.visible');
139+
loginPage.getImage().should('not.be.visible');
140+
});
141+
142+
it('should reset main text', () => {
143+
loginPage.login();
144+
applicationSettingsPage.Navbar.goToApplicationSettings();
145+
146+
// Wait for site header settings to be visible (after reset, we're on the settings page)
147+
applicationSettingsPage.SiteHeader.getMainTextInput().should('be.visible', { timeout: 240000 });
148+
149+
// Reset login page settings
150+
applicationSettingsPage.LoginPage.reset();
151+
152+
// Wait for settings to be visible again
153+
applicationSettingsPage.SiteHeader.getMainTextInput().should('be.visible', { timeout: 240000 });
154+
155+
// Logout to verify reset
156+
applicationSettingsPage.Navbar.logout();
157+
158+
// Verify main text is reset to original on login page
159+
loginPage.getLoginButton().should('be.visible');
160+
loginPage.getMainText().should('have.text', applicationSettingsConstants.LoginPage.originalMainText);
161+
});
162+
});
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import loginPage from '../Login.page';
2+
import applicationSettingsPage from '../ApplicationSettings.page';
3+
4+
describe('Application settings - Site header section', () => {
5+
before(() => {
6+
cy.visit('http://localhost:4200');
7+
loginPage.login();
8+
});
9+
10+
it('should hide image', () => {
11+
applicationSettingsPage.Navbar.goToApplicationSettings();
12+
13+
// Wait for spinner to disappear
14+
cy.get('#spinner-animation').should('not.exist');
15+
16+
// Wait for sign-out dropdown to be visible
17+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
18+
19+
// Toggle site header image visibility
20+
applicationSettingsPage.SiteHeader.getImageVisibilityToggler().should('be.visible').click();
21+
22+
// Save settings
23+
applicationSettingsPage.save();
24+
25+
// Wait for save to complete
26+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
27+
28+
// Navigate to application settings page to refresh
29+
cy.visit('http://localhost:4200/application-settings');
30+
cy.get('#sign-out-dropdown').should('be.visible', { timeout: 40000 });
31+
32+
// Navigate to home page to see changes
33+
cy.visit('http://localhost:4200/');
34+
35+
// Verify image is hidden in site header
36+
applicationSettingsPage.getSiteHeaderImage().should('not.be.visible');
37+
});
38+
});

migration-issues/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ This directory contains detailed specifications for each sub-issue in the wdio t
1111
| 03 | [User Administration](03-user-administration.md) | 🔴 HIGH | 1 | ✅ Complete |
1212
| 04 | [Navigation Menu](04-navigation-menu.md) | 🟡 MEDIUM | 4 | ✅ Complete |
1313
| 05 | [Folders](05-folders.md) | 🟡 MEDIUM | 6 | ✅ Complete |
14-
| 06 | [Application Settings](06-application-settings.md) | 🟡 MEDIUM | 2 | ⏳ Pending |
14+
| 06 | [Application Settings](06-application-settings.md) | 🟡 MEDIUM | 2 | ✅ Complete |
1515
| 07 | [Searchable Lists](07-searchable-lists.md) | 🟡 MEDIUM | 3 | ⏳ Pending |
1616
| 08 | [Selectable Lists](08-selectable-lists.md) | 🟡 MEDIUM | 4 | ⏳ Pending |
1717
| 09 | [Workers](09-workers.md) | 🟡 MEDIUM | 2 | ⏳ Pending |
1818
| 10 | [Profile Settings](10-profile-settings.md) | 🟡 MEDIUM | 1 | ⏳ Pending |
1919
| 11 | [eForm Visual Editor - Create](11-eform-visual-editor-create.md) | 🔴 HIGH | 1 | ⏳ Pending |
20-
| | **TOTAL** | | **28** | **64% Complete** |
20+
| | **TOTAL** | | **28** | **71% Complete** |
2121

2222
## How to Use These Sub-Issues
2323

0 commit comments

Comments
 (0)