-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61aa34d
commit 8cd77c0
Showing
1 changed file
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Intermediate Challenge | ||
Create an automated test that reads a message on the admin side of the site. | ||
You’ll need to trigger a message in the first place, login as admin, open that specific message and validate its contents. | ||
*/ | ||
|
||
describe('Intermediate Challenge', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
//Check if logo is visible to ensure the website is loaded | ||
cy.get('img.hotel-logoUrl') | ||
.should('be.visible') | ||
}) | ||
|
||
it('Send a message and Check whether it was received correctly in the backend', () => { | ||
//Variables for the message which will be send via the contact form | ||
let name = cy.faker.name.findName() | ||
let subject = 'CypressTest '+ cy.faker.lorem.word() | ||
let email = cy.faker.internet.email() | ||
|
||
//send a message via the contact form | ||
cy.sendMessage(name, subject, email) | ||
|
||
//# into the admin panel | ||
cy.adminLogin('admin','password') | ||
|
||
//Open Messages | ||
cy.get('i.fa-inbox') | ||
.click() | ||
cy.get('div.messages') | ||
.should('be.visible') | ||
|
||
//Open the message we send before via the contact form --> Identifier is the name and subject of the message | ||
cy.get('div.detail').contains(name) | ||
//we found the right row with the name and now check if this row also contains the right subject | ||
.parents('div.detail') | ||
.contains(subject) | ||
.click() | ||
|
||
//Check if name, subject and email address are correct in the message detail popUp | ||
cy.get('div.message-modal').as('popUpMessage') | ||
.contains(name) | ||
cy.get('@popUpMessage').contains(email) | ||
cy.get('@popUpMessage').contains(subject) | ||
}) | ||
}) |