mailslurp-examples - javascript-webdriver-io

https://github.com/mailslurp/examples

Table of Contents

javascript-webdriver-io/wdio.conf.js

const config = {
  runner: 'local',
  headless: true,
  path: '/',
  specs: ['test/*.test.js'],
  exclude: [],
  maxInstances: 10,
  capabilities: [
    {
      maxInstances: 5,
      browserName: 'firefox',
       'moz:firefoxOptions': {
          args: ['-headless'],
        },
    }
  ],
  logLevel: 'info',
  bail: 0,
  baseUrl: 'https://playground.mailslurp.com',
  waitforTimeout: 30000,
  connectionRetryTimeout: 90000,
  connectionRetryCount: 3,
  framework: 'mocha',
  services: ['geckodriver'],
  reporters: ['spec'],
  mochaOpts: {
    ui: 'bdd',
    timeout: 60000,
  }
};

exports.config = config;

javascript-webdriver-io/package.json

{
  "scripts": {
    "test": "wdio run wdio.conf.js"
  },
  "dependencies": {
    "@wdio/cli": "^7.14.1",
    "@wdio/local-runner": "^7.14.1",
    "@wdio/mocha-framework": "^7.14.1",
    "@wdio/selenium-standalone-service": "^7.14.1",
    "@wdio/spec-reporter": "^7.14.1",
    "geckodriver": "^2.0.4",
    "mailslurp-client": "^15.0.1",
    "wdio-geckodriver-service": "^2.0.3"
  },
  "devDependencies": {
    "debug": "^4.3.2"
  }
}

javascript-webdriver-io/README.md

# Webdriver.io MailSlurp Example
This example demonstrates use of [MailSlurp](https://www.mailslurp.com) with NodeJS, Webdriver.io (wdio), Selenium and Chrome to test user processes that depend on email.

It tests user sign-up, email confirmation, login, and password reset using the [MailSlurp OAuth2 Playground](https://playground.mailslurp.com) as a dummy application. 

Each test run **generates a real, randomized email address using MailSlurp**, signs up with it and then captures the email confirmation code to enter in the confirmation step. MailSlurp is free for personal use so [sign up](https://www.mailslurp.com) to run the example yourself.

### Run
`npm install`
`API_KEY=your-mailslurp-key npm run test`

### Notes
The version of `chromedriver` in package.json should match the version of Chrome browser that you have installed on your machine. Check your installed version and change the dependency version to match.

javascript-webdriver-io/Makefile

-include ../.env

.PHONY: test

node_modules:
	npm install

test: node_modules
	API_KEY=$(API_KEY) DEBUG='ms*' npm run test