Skip to content

added gmail steps #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions docs/Steps/gmail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
sidebar_position: 8
---

# @qavajs/steps-gmail
Step library to test emails via gmail client

## Installation
`npm install @qavajs/steps-gmail`

## Configuration
```javascript
module.exports = {
default: {
require: ['node_modules/@qavajs/steps-gmail/index.js'],
gmail: {
timeout: 30000, // timeout to wait email delivery
interval: 5000 // interval to check email delivery
}
}
}
```

## Email Steps
--------------
### I log in to gmail as {string}

Login to gmail

| param | type | description |
|:--------------:|:------:|:--------------------------------------------------------------------:|
| credentialsKey | string | memory key that resolves to Gmail auth object (google.auth.fromJSON) |

credentials key should resolve to object like:
```json
{
"type": "authorized_user",
"client_id": "client_id",
"client_secret": "client_secret",
"refresh_token": "refresh_token"
}
```
example:
```gherkin
When I log in to gmail as '$gmailUser'
```

--------------
### I wait email matching {string}

Wait until email matching advanced search syntax query to exist

| param | type | description |
|:-----------:|:------:|:------------------------------------------------------------------------:|
| searchQuery | string | advanced search syntax query https://support.google.com/mail/answer/7190 |

example:
```gherkin
When I wait email matching 'subject:some subject'
```

--------------
### I save email matching {string} as {string}

Save email matching advanced search syntax query to memory as https://nodemailer.com/extras/mailparser/ object
If query returns multiple message only first one will be saved.

| param | type | description |
|:-----------:|:------:|:------------------------------------------------------------------------:|
| searchQuery | string | advanced search syntax query https://support.google.com/mail/answer/7190 |
| memoryKey | string | memory key to save email |

example:
```gherkin
When I save email matching 'subject:some subject' as 'email'
Then I expect '$email.subject' to equal 'some subject'
```