Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kuzjka/codeceptjs-remote-maildev-helper
CodeceptJS helper for simplest email check using remote maildev server
https://github.com/kuzjka/codeceptjs-remote-maildev-helper
Last synced: 4 months ago
JSON representation
CodeceptJS helper for simplest email check using remote maildev server
- Host: GitHub
- URL: https://github.com/kuzjka/codeceptjs-remote-maildev-helper
- Owner: kuzjka
- License: mit
- Created: 2020-03-14T08:07:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-12T11:25:34.000Z (almost 2 years ago)
- Last Synced: 2024-08-15T21:54:17.257Z (4 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# codeceptjs-remote-maildev-helper
[CodeceptJS](https://codecept.io) helper for simplest email check using remote maildev server## Installation
```shell script
npm install --save-dev codeceptjs-remote-maildev-helper
```## Running remote server
On the target remote host clone [codeceptjs-remote-maildev](https://github.com/kuzjka/codeceptjs-remote-maildev), install dependencies with npm and start. NodeJS should be installed.
```shell script
git pull https://github.com/kuzjka/codeceptjs-remote-maildev.git
cd codeceptjs-remote-maildev
npm install
npm run serve
```Alternatively, you can use [Docker image](https://hub.docker.com/r/kuzjka/codeceptjs-remote-maildev)
```shell script
docker run --name remote-maildev -d kuzjka/codeceptjs-remote-maildev
```By default, SMTP listens on port 25 and REST API is exposed on 8080.
You can override it with `SMTP_PORT` and `WEB_PORT` environment variables.## CodeceptJS configuration
In codecept.conf.json:
```json
{
//...
"helpers": {
//...
"RemoteMaildevHelper": {
"require": "./node_modules/codeceptjs-remote-maildev-helper",
"host": "123.124.125.126",
"port": "8080"
}
}
}
```Default value for `host` is `localhost`, and for `port` is `8080`.
You may run
```shellscript
npx codeceptjs def .
```
to generate typescript definitions for all installed helpers - this adds code autocompletion to IDEs, which support TypeScript.## Usage
Configure your application to use remote Maildev server (see [Maildev docs](https://github.com/djfarrelly/MailDev/blob/master/README.md#configure-your-project)).
In your CodeceptJS scenario use `I.haveMailbox(address)` to initialize mailbox and `I.grabNextUnreadMail()` to get email object.
For example:
```js
Scenario('test email sending' async (I) => {
I.haveMailbox('[email protected]');I.amOnPage('/sendMeEmail');
I.fillField('email', '[email protected]');
I.click('Send Me Email!');const email = await I.grabNextUnreadMail();
I.say('I have email: ' + email.subject);
});
````I.grabNextUnreadMail()` returns `Promise` like all CodeceptJS grabber methods. It resolves to email object, which is used by Maildev and seems to conform [Mailparser](https://nodemailer.com/extras/mailparser/) specification.
You may register more recipient addresses by adding more `I.haveMailbox()` calls.
## License
[MIT](LICENSE)