-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into Cypress-test-bug
- Loading branch information
Showing
23 changed files
with
982 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { login } from './utils.cy'; | ||
describe('Budget Report Component', () => { | ||
beforeEach(() => { | ||
login('[email protected]', '123456'); | ||
cy.url().should('eq', 'http://localhost:4200/'); | ||
cy.visit('/budget-report'); | ||
}); | ||
|
||
it('should display the title correctly', () => { | ||
// Check if the title container exists and has the correct text | ||
cy.get('.title').should('be.visible').and('contain.text', 'Budget Report'); | ||
}); | ||
|
||
|
||
it('should display the table with data', () => { | ||
// Check if the table wrapper exists | ||
cy.get('.table-wrapper').should('be.visible'); | ||
|
||
// Check if the table has at least one row | ||
cy.get('table').find('tr').should('have.length.gt', 1); | ||
|
||
// Check if the table headers are correct | ||
cy.get('table').find('th').should('have.length', 4); | ||
cy.get('table').find('th').eq(0).should('contain.text', 'Building'); | ||
cy.get('table').find('th').eq(1).should('contain.text', 'Condo Fee Revenue'); | ||
cy.get('table').find('th').eq(2).should('contain.text', 'Operation Costs'); | ||
cy.get('table').find('th').eq(3).should('contain.text', 'Profit'); | ||
}); | ||
|
||
it('should display the total row with correct totals', () => { | ||
cy.get('.total-row').should('be.visible'); | ||
|
||
// Check if the total row contains the correct total values | ||
cy.get('.total-condo-fee').should('contain.text', '$0.00'); | ||
cy.get('.total-operation-cost').should('contain.text', '$92.00'); | ||
cy.get('.total-profit').should('contain.text', '-$92.00'); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
import { login } from './utils.cy'; | ||
|
||
describe('Key Registration Component', () => { | ||
beforeEach(() => { | ||
login('[email protected]', 'Mosalah99'); | ||
cy.wait(5000); | ||
cy.visit('/key-registration'); | ||
}); | ||
|
||
|
||
it('should display visit the page', () => { | ||
cy.visit('/key-registration'); | ||
}); | ||
|
||
it('should register Condo key when input is filled and register button is clicked', () => { | ||
// Type a registration key | ||
const registrationKey = 'olxoxbbx02n1712215786582'; | ||
cy.get('input[name="registrationKey"]') | ||
.type(registrationKey) | ||
.should('have.value', registrationKey); | ||
|
||
// Wait for registration type dropdown to be visible and then select a registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.condo', 'Condo').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Successfully registered!'); // Assert the alert message | ||
}); | ||
}); | ||
|
||
it('should register Parking key when input is filled and register button is clicked', () => { | ||
// Type a registration key | ||
const registrationKey = 'zn9ii2r6z3p1712215786584'; | ||
cy.get('input[name="registrationKey"]') | ||
.type(registrationKey) | ||
.should('have.value', registrationKey); | ||
|
||
// Wait for registration type dropdown to be visible and then select a registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.parking', 'Parking').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Successfully registered!'); // Assert the alert message | ||
}); | ||
}); | ||
|
||
it('should register Locker key when input is filled and register button is clicked', () => { | ||
// Type a registration key | ||
const registrationKey = 'gfcaeu208jw1712215786583'; | ||
cy.get('input[name="registrationKey"]') | ||
.type(registrationKey) | ||
.should('have.value', registrationKey); | ||
|
||
// Wait for registration type dropdown to be visible and then select a registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.locker', 'Locker').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Successfully registered!'); // Assert the alert message | ||
}); | ||
}); | ||
|
||
it('should display an error message if input value is empty', () => { | ||
// Click the register button without entering a key | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Input value is empty!'); | ||
}); | ||
}); | ||
|
||
it('should handle empty registration key input', () => { | ||
// Click the register button without entering a key | ||
cy.get('input[name="registrationKey"]').clear(); | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Input value is empty!'); | ||
}); | ||
}); | ||
|
||
it('should handle special characters in registration key input', () => { | ||
// Type a registration key with special characters | ||
const registrationKey = '!@#$%^&*()'; | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Invalid registration key!'); | ||
}); | ||
}); | ||
|
||
it('should display an error message if registration key is invalid for condo registration', () => { | ||
// Type an invalid registration key | ||
const registrationKey = 'invalid-key'; | ||
cy.get('input[name="registrationKey"]').type(registrationKey); | ||
|
||
// Select condo registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.condo', 'Condo').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Invalid registration key!'); | ||
}); | ||
}); | ||
|
||
it('should display an error message if registration key is invalid for parking registration', () => { | ||
// Type an invalid registration key | ||
const registrationKey = 'invalid-key'; | ||
cy.get('input[name="registrationKey"]').type(registrationKey); | ||
|
||
// Select parking registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.parking', 'Parking').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Invalid registration key!'); | ||
}); | ||
}); | ||
|
||
it('should display an error message if registration key is invalid for locker registration', () => { | ||
// Type an invalid registration key | ||
const registrationKey = 'invalid-key'; | ||
cy.get('input[name="registrationKey"]').type(registrationKey); | ||
|
||
// Select locker registration type | ||
cy.get('.registrationType', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click({ force: true }); | ||
cy.contains('.locker', 'Locker').click({ force: true }); // Select the desired registration type | ||
|
||
// Click the register button | ||
cy.contains('button', 'Register').click({ force: true }); | ||
|
||
// Assert error message is shown | ||
cy.on('window:alert', (str) => { | ||
expect(str).to.equal('Invalid registration key!'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ import { login } from './utils.cy'; | |
|
||
const checkBadge = (badgeHidden: boolean, value: string) => { | ||
if (badgeHidden) { | ||
cy.get('.nav-item a.notifications button').should( | ||
cy.get('a.notifications button').should( | ||
'not.have.attr', | ||
'matBadgeHidden' | ||
); | ||
} | ||
cy.get('.nav-item a.notifications button mat-icon') | ||
cy.get('a.notifications button mat-icon') | ||
.invoke('attr', 'data-badge') | ||
.should('equal', value); | ||
}; | ||
|
@@ -21,8 +21,8 @@ describe('Test Notifications', () => { | |
it('Check notification button', () => { | ||
login('[email protected]', '123456'); | ||
|
||
cy.get('.nav-item a.notifications').should('be.visible'); | ||
cy.get('.nav-item a.notifications').click({ force: true }); | ||
cy.get('a.notifications').should('be.visible'); | ||
cy.get('a.notifications').click({ force: true }); | ||
|
||
cy.url().should('eq', 'http://localhost:4200/notifications'); | ||
}); | ||
|
@@ -34,9 +34,9 @@ describe('Test Notifications', () => { | |
it('Check notification bar badge', () => { | ||
login('[email protected]', '123456'); | ||
|
||
cy.get('.nav-item a.notifications').should('be.visible'); | ||
cy.get('a.notifications').should('be.visible'); | ||
|
||
cy.get('.nav-item a.notifications').should('be.visible'); | ||
cy.get('a.notifications').should('be.visible'); | ||
checkBadge(true, '1'); | ||
}); | ||
|
||
|
@@ -50,7 +50,7 @@ describe('Test Notifications', () => { | |
it('Check mark as read', () => { | ||
login('[email protected]', '123456'); | ||
|
||
cy.get('.nav-item a.notifications').click({ force: true }); | ||
cy.get('a.notifications').click({ force: true }); | ||
|
||
cy.wait(2000); | ||
|
||
|
@@ -76,7 +76,7 @@ describe('Test Notifications', () => { | |
it('Check mark as unread', () => { | ||
login('[email protected]', '123456'); | ||
|
||
cy.get('.nav-item a.notifications').click({ force: true }); | ||
cy.get('a.notifications').click({ force: true }); | ||
|
||
cy.wait(2000); | ||
|
||
|
Oops, something went wrong.