diff --git a/src/mailosaurCommands.d.ts b/src/mailosaurCommands.d.ts index 464f2ab..9032b49 100644 --- a/src/mailosaurCommands.d.ts +++ b/src/mailosaurCommands.d.ts @@ -312,6 +312,10 @@ declare global { serverId: string ): Cypress.Chainable; + mailosaurGetServerPassword( + serverId: string + ): Cypress.Chainable; + mailosaurUpdateServer( server: Server ): Cypress.Chainable; diff --git a/src/mailosaurCommands.js b/src/mailosaurCommands.js index ec4e1d1..679f254 100644 --- a/src/mailosaurCommands.js +++ b/src/mailosaurCommands.js @@ -6,6 +6,7 @@ class MailosaurCommands { 'mailosaurListServers', 'mailosaurCreateServer', 'mailosaurGetServer', + 'mailosaurGetServerPassword', 'mailosaurUpdateServer', 'mailosaurDeleteServer', 'mailosaurListMessages', @@ -48,6 +49,11 @@ class MailosaurCommands { return this.request.get(`api/servers/${serverId}`); } + mailosaurGetServerPassword(serverId) { + return this.request.get(`api/servers/${serverId}/password`) + .then((result) => (result.value)); + } + mailosaurUpdateServer(server) { return this.request.put(`api/servers/${server.id}`, server); } diff --git a/test/react-app/cypress/integration/servers.spec.js b/test/react-app/cypress/integration/servers.spec.js index a700c7f..b0f120c 100644 --- a/test/react-app/cypress/integration/servers.spec.js +++ b/test/react-app/cypress/integration/servers.spec.js @@ -29,11 +29,18 @@ describe('Mailosaur server commands', () => { it('.mailosaurGetServer should retrieve an existing server', (done) => { cy.mailosaurGetServer(createdServer.id).then((server) => { retrievedServer = server; - expect(retrievedServer.id).to.equal(createdServer.id); - expect(retrievedServer.name).to.equal(createdServer.name); - expect(retrievedServer.users).to.be.an('array'); - expect(retrievedServer.messages).to.be.a('number'); - done(); + expect(retrievedServer.id).to.equal(createdServer.id); + expect(retrievedServer.name).to.equal(createdServer.name); + expect(retrievedServer.users).to.be.an('array'); + expect(retrievedServer.messages).to.be.a('number'); + done(); + }); + }); + + it('.mailosaurGetServerPassword should retrieve password of an existing server', (done) => { + cy.mailosaurGetServerPassword(createdServer.id).then((password) => { + expect(password).to.have.lengthOf.at.least(8); + done(); }); });