levz0r / gmail-tester

A simple Node.js Gmail client which checks the inbox for message existence
MIT License
256 stars 68 forks source link

Add credentials and token in cypress.config.js into cypress.env file #132

Open NEMETOM opened 1 year ago

NEMETOM commented 1 year ago

Hi All, This is more a question or suggestion rather than a new issue. Given cypress.config.js file, is it possible to define values from token.js and credentials.json in cypress.env file?

const { defineConfig } = require("cypress");
const gmailTester = require("gmail-tester");
const path = require("path");

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      on("task", {
        "gmail:get-messages": async (args) => {
          const messages = await gmailTester.get_messages(
            path.resolve(__dirname, "credentials.json"),
            path.resolve(__dirname, "token.json"),
            args.options
          );
          return messages;
        },
      });
    },
  },
});