Skip to content
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

FEAT: allow passing credentialsJsonPath and tokenJsonPath as objects #497

Open
yafanasiev opened this issue Nov 19, 2024 · 3 comments
Open
Labels
help wanted Extra attention is needed

Comments

@yafanasiev
Copy link

Currently, credentialsJsonPath and tokenJsonPath are expected to be strings containing the file path to respective JSON files. However, the underlying gmail-tester library actually can receive them as objects as well, which would greatly simplify setting up test environment on CI.

I made it work on my project by monkey-patching the validation function:

diff --git a/node_modules/wdio-gmail-service/build/service.js b/node_modules/wdio-gmail-service/build/service.js
index 4737aad..7a6ba46 100644
--- a/node_modules/wdio-gmail-service/build/service.js
+++ b/node_modules/wdio-gmail-service/build/service.js
@@ -13,10 +13,10 @@ export default class GmailService {
         if (!from && !to && !subject) {
             throw new Error('At least one of `from`, `to` or `subject` need to be provided to checkInbox');
         }
-        if (typeof this._credentialsJsonPath !== 'string') {
+        if (!this._credentialsJsonPath) {
             throw new Error('Service option "credentialsJsonPath" not set, but required');
         }
-        if (typeof this._tokenJsonPath !== 'string') {
+        if (!this._tokenJsonPath) {
             throw new Error('Service option "tokenJsonPath" not set, but required');
         }
         const wait_time_sec = this._intervalSec;

But it would be nice to have a proper support for this.

@christian-bromann
Copy link
Contributor

christian-bromann commented Nov 19, 2024

@yafanasiev makes sense, I think we can do a similar change where we rename the parameters to credentials and token and allow them to be either a JSON object or a string to a file.

Any contributions are appreciated!

@christian-bromann christian-bromann added the help wanted Extra attention is needed label Nov 19, 2024
@yafanasiev
Copy link
Author

@christian-bromann I can take a stab at it, but do you want to change the parameters and release new major version or leave the old one for backward compatibility?

@christian-bromann
Copy link
Contributor

I think we can keep the old ones for backwards compatibility but deprecate them. Then I can release this as a minor change. Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants