Skip to content

Commit

Permalink
Add server password support
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Apr 21, 2021
1 parent 597b4a1 commit e87bfe5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/mailosaurCommands.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ declare global {
serverId: string
): Cypress.Chainable<Server>;

mailosaurGetServerPassword(
serverId: string
): Cypress.Chainable<string>;

mailosaurUpdateServer(
server: Server
): Cypress.Chainable<Server>;
Expand Down
6 changes: 6 additions & 0 deletions src/mailosaurCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class MailosaurCommands {
'mailosaurListServers',
'mailosaurCreateServer',
'mailosaurGetServer',
'mailosaurGetServerPassword',
'mailosaurUpdateServer',
'mailosaurDeleteServer',
'mailosaurListMessages',
Expand Down Expand Up @@ -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);
}
Expand Down
17 changes: 12 additions & 5 deletions test/react-app/cypress/integration/servers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

Expand Down

0 comments on commit e87bfe5

Please sign in to comment.