Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ecd75f3

Browse files
authoredJan 27, 2025··
Merge pull request #77 from UdL-EPS-SoftArch/test-update-room
update room test
2 parents 4b8bc25 + bfa65a5 commit ecd75f3

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
 

‎e2e/features/Room/UpdateRoom.feature

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Feature: Update an existing Room
2+
Feature: Update Apartment
3+
In order to use the app
4+
As admin
5+
I want to update a Room
6+
7+
Background:
8+
Given I'm in the homepage
9+
And I log in as "owner" with password "password"
10+
And I'm logged in as user "owner"
11+
And The test apartment
12+
When I go to the create room page
13+
And I select the first option for "apartmentSelect"
14+
And I check "isOccupied"
15+
And I check "hasBed"
16+
And I check "hasWindow"
17+
And I check "hasDesk"
18+
And I enter "45" into the "Surface" field
19+
And I click the "Create" button
20+
21+
Scenario: Update the room just created
22+
Given I'm logged in as user "owner"
23+
And I go to the homepage
24+
When I go to the rooms list page
25+
And I click on the edit room button
26+
And I fill some of the room form with different data
27+
And I click the "Update" button
28+
Then I should see the room updated
29+
30+
Scenario: Update the room with not valid data
31+
Given I'm logged in as user "owner"
32+
And I go to the homepage
33+
When I go to the rooms list page
34+
And I click on the edit room button
35+
And I fill some of the room form with different and invalid data
36+
And I click the "Update" button
37+
Then I should see an error message and still be in editing page
38+

‎e2e/steps/Room/update-room.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {When, Then, And} from 'cypress-cucumber-preprocessor/steps';
2+
3+
When('I go to the rooms list page', () => {
4+
cy.get('.nav-link').contains('Rooms').click();
5+
});
6+
7+
And('I go to the homepage', () => {
8+
cy.visit('http://localhost:4200');
9+
});
10+
11+
And(/^I click on the edit room button$/, function () {
12+
cy.get('table tbody tr:last-child button').contains('Edit').click();
13+
});
14+
15+
And('I fill some of the room form with different data', () => {
16+
cy.get('#occupied').check();
17+
cy.get('#hasBed').check();
18+
cy.get('#surface').type('70');
19+
});
20+
21+
And('I click the "Update" button', () => {
22+
cy.get('button').contains('Update').click();
23+
});
24+
25+
Then('I should see the room updated', () => {
26+
cy.url().should('include', '/rooms');
27+
});
28+
29+
And('I fill some of the room form with different and invalid data', () => {
30+
cy.get('#occupied').check();
31+
cy.get('#hasBed').check();
32+
cy.get('#surface').clear();
33+
});
34+
35+
Then('I should see an error message and still be in editing page', () => {
36+
cy.url().should('include', '/room/update');
37+
});

0 commit comments

Comments
 (0)
Please sign in to comment.