Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/dotnet-core-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Wait for MariaDB
run: |
for i in {1..30}; do
if docker exec mariadb-test mysql -uroot -psecretpassword -e "SELECT 1" &>/dev/null; then
if docker exec mariadbtest mysql -uroot -psecretpassword -e "SELECT 1" &>/dev/null; then
echo "MariaDB is ready!"
break
fi
Expand Down Expand Up @@ -95,6 +95,22 @@ jobs:
config-file: cypress.config.ts
working-directory: eform-client
command-prefix: "--"
- name: Wait for application to be ready
run: |
echo "Waiting for application at http://localhost:4200 to be ready..."
for i in {1..60}; do
if curl -f -s http://localhost:4200 >/dev/null; then
echo "Application is ready!"
break
fi
echo "Waiting for application... ($i/60)"
sleep 2
done
# Final check
if ! curl -f -s http://localhost:4200 >/dev/null; then
echo "Application failed to start within 120 seconds"
exit 1
fi
- name: testheadless2${{matrix.test}}
run: cd eform-client && npm run testheadless2${{matrix.test}}
- name: Stop the newly build Docker container
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/dotnet-core-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Wait for MariaDB
run: |
for i in {1..30}; do
if docker exec mariadb-test mysql -uroot -psecretpassword -e "SELECT 1" &>/dev/null; then
if docker exec mariadbtest mysql -uroot -psecretpassword -e "SELECT 1" &>/dev/null; then
echo "MariaDB is ready!"
break
fi
Expand Down Expand Up @@ -96,6 +96,22 @@ jobs:
config-file: cypress.config.ts
working-directory: eform-client
command-prefix: "--"
- name: Wait for application to be ready
run: |
echo "Waiting for application at http://localhost:4200 to be ready..."
for i in {1..60}; do
if curl -f -s http://localhost:4200 >/dev/null; then
echo "Application is ready!"
break
fi
echo "Waiting for application... ($i/60)"
sleep 2
done
# Final check
if ! curl -f -s http://localhost:4200 >/dev/null; then
echo "Application failed to start within 120 seconds"
exit 1
fi
- name: testheadless2${{matrix.test}}
run: cd eform-client && npm run testheadless2${{matrix.test}}
- name: Stop the newly build Docker container
Expand Down
2 changes: 2 additions & 0 deletions eform-client/cypress/e2e/Login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class LoginPage {
loginWithNewPassword() {
this.getUsernameInput().type(loginConstants.username);
this.getPasswordInput().type(loginConstants.newPassword);
cy.intercept('POST', '**/api/templates/index').as('login');
this.getLoginButton().click();
cy.wait('@login', { timeout: 60000 });
cy.get('#newEFormBtn').should('be.visible');
}

Expand Down
3 changes: 2 additions & 1 deletion eform-client/cypress/e2e/Navbar.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export class Navbar {
this.signOutDropdown().click();
cy.wait(500);
this.logoutBtn().click();
cy.wait(500);
// Wait for login page to be fully loaded
cy.get('#loginBtn', { timeout: 10000 }).should('be.visible');
}

public goToProfileSettings() {
Expand Down
8 changes: 2 additions & 6 deletions eform-client/cypress/e2e/PasswordSettings.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ class PasswordSettingsPage extends PageWithNavbarPage {
cy.wait(500);
this.newPasswordConfirmationField().should('be.visible').clear().type(newPassword);
cy.wait(500);
cy.intercept('PUT', '**/api/auth/change-password').as('changePassword');
cy.intercept('POST', '**/api/account/change-password').as('changePassword');
this.saveBtn().should('be.visible').should('be.enabled').click();
cy.wait('@changePassword', { timeout: 10000 });
cy.get('#spinner-animation').should('not.exist');
cy.wait(500);
}

revertToOldPassword(oldPassword = loginConstants.newPassword, newPassword = loginConstants.password) {
Expand All @@ -39,11 +37,9 @@ class PasswordSettingsPage extends PageWithNavbarPage {
cy.wait(500);
this.newPasswordConfirmationField().should('be.visible').clear().type(newPassword);
cy.wait(500);
cy.intercept('PUT', '**/api/auth/change-password').as('changePassword');
cy.intercept('POST', '**/api/account/change-password').as('changePassword');
this.saveBtn().should('be.visible').should('be.enabled').click();
cy.wait('@changePassword', { timeout: 10000 });
cy.get('#spinner-animation').should('not.exist');
cy.wait(500);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,41 @@ describe('Password settings - Change password', function () {
before(() => {
cy.visit('http://localhost:4200');
loginPage.login();
passwordSettingsPage.Navbar.goToPasswordSettings();
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');
});

it('should change password to new password', () => {
it('should change password and revert it back', () => {
// Navigate to password settings
passwordSettingsPage.Navbar.goToPasswordSettings();
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');

// Change password to new password
passwordSettingsPage.setNewPassword();

// Logout
// Logout (waits for login page to load)
passwordSettingsPage.Navbar.logout();
cy.get('#loginBtn').should('be.visible');

// Login with new password
// Login with new password to verify change worked
cy.visit('http://localhost:4200');
loginPage.loginWithNewPassword();

// Verify we're logged in by checking for the new eForm button
cy.get('#newEFormBtn').should('be.visible');
cy.get('#newEFormBtn', { timeout: 10000 }).should('be.visible');

// Navigate to password settings
// Navigate to password settings to revert
passwordSettingsPage.Navbar.goToPasswordSettings();
cy.get('#oldPassword').should('be.visible');
});

it('should revert password back to original', () => {
cy.get('#oldPassword', { timeout: 10000 }).should('be.visible');

// Revert password back to original
passwordSettingsPage.revertToOldPassword();

// Logout
// Logout (waits for login page to load)
passwordSettingsPage.Navbar.logout();
cy.get('#loginBtn').should('be.visible');

// Login with original password
// Login with original password to verify revert worked
cy.visit('http://localhost:4200');
loginPage.login();

// Verify we're logged in
cy.get('#newEFormBtn').should('be.visible');

// Navigate to password settings to verify we can access it
passwordSettingsPage.Navbar.goToPasswordSettings();
cy.get('#oldPassword').should('be.visible');
cy.get('#newEFormBtn', { timeout: 10000 }).should('be.visible');
});
});
30 changes: 30 additions & 0 deletions eform-client/e2e/Page objects/Login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,47 @@ class LoginPage extends Page {
}

public async login(): Promise<void> {
console.log('[LOGIN DEBUG] Starting login process...');
console.log('[LOGIN DEBUG] Current URL:', await browser.getUrl());

await (await this.loginBtn()).waitForDisplayed({ timeout: 60000 });
console.log('[LOGIN DEBUG] Login button is displayed');

// await (await this.usernameInput()).waitForDisplayed({ timeout: 60000 });
await (await this.usernameInput()).setValue(LoginConstants.username);
console.log('[LOGIN DEBUG] Username set');

await (await this.passwordInput()).setValue(LoginConstants.password);
console.log('[LOGIN DEBUG] Password set');

await (await this.loginBtn()).click();
console.log('[LOGIN DEBUG] Login button clicked');
console.log('[LOGIN DEBUG] URL after click:', await browser.getUrl());

// Add pause after login click to allow application to start loading on slow environments
await browser.pause(2000);
console.log('[LOGIN DEBUG] Waited 2 seconds, now looking for newEFormBtn...');
console.log('[LOGIN DEBUG] Current URL:', await browser.getUrl());

// Take screenshot before waiting for newEFormBtn to help debug
try {
const screenshotPath = './errorShots/before-newEFormBtn-wait.png';
await browser.saveScreenshot(screenshotPath);
console.log('[LOGIN DEBUG] Screenshot saved to:', screenshotPath);
} catch (e) {
console.log('[LOGIN DEBUG] Could not save screenshot:', e.message);
}

const newEFormBtn = await $('#newEFormBtn');
// Increased timeout for slow environments - application may take longer to initialize
console.log('[LOGIN DEBUG] Waiting for newEFormBtn to be displayed (120s timeout)...');
await newEFormBtn.waitForDisplayed({timeout: 120000});
console.log('[LOGIN DEBUG] newEFormBtn is displayed');

console.log('[LOGIN DEBUG] Waiting for newEFormBtn to be clickable (120s timeout)...');
await newEFormBtn.waitForClickable({timeout: 120000});
console.log('[LOGIN DEBUG] newEFormBtn is clickable - login complete!');
console.log('[LOGIN DEBUG] Final URL:', await browser.getUrl());
}
public async loginWithNewPassword(): Promise<void> {
await (await this.usernameInput()).waitForDisplayed({ timeout: 60000 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import applicationSettingsPage from '../../Page objects/ApplicationSettings.page
import ApplicationSettingsConstants from '../../Constants/ApplicationSettingsConstants';
import { expect } from 'chai';

describe('Application settings page - site header section', function () {
describe('Application settings page - login page section', function () {
before(async () => {
await loginPage.open('/auth');
await loginPage.login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,36 @@ describe('Password settings', function () {
before(async () => {
loginPage.open('/');
loginPage.login();
myEformsPage.Navbar.goToPasswordSettings();
});

it('should set password to 2Times2WillDo', async () => {
it('should change password and revert it back', async () => {
// Navigate to password settings
myEformsPage.Navbar.goToPasswordSettings();

// Change password to new password
passwordSettings.setNewPassword();

// Logout
passwordSettings.Navbar.logout();

// Login with new password to verify change worked
loginPage.open('/');
loginPage.loginWithNewPassword();

// Navigate to password settings to revert
myEformsPage.Navbar.goToPasswordSettings();
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('My eForms')).equal('My eForms');
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('Device Users')).equal('Device Users');
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('Advanced')).equal('Advanced');
});
it('should revert to old password', async () => {

// Revert password back to original
passwordSettings.revertToOldPassword();

// Logout
passwordSettings.Navbar.logout();

// Login with original password to verify revert worked
loginPage.open('/');
loginPage.login();

// Verify we can access password settings again
myEformsPage.Navbar.goToPasswordSettings();
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('Meine eForms')).equal('Meine eForms');
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('Gerätebenutzer')).equal('Gerätebenutzer');
// expect(myEformsPage.Navbar.verifyHeaderMenuItem('Fortgeschritten')).equal('Fortgeschritten');
});
});
Loading
Loading