Conversation
lib/plugin/auth.js
Outdated
| const event = require('../event') | ||
| const recorder = require('../recorder') | ||
| const { debug } = require('../output') | ||
| const isAsyncFunction = require('../utils').isAsyncFunction |
There was a problem hiding this comment.
const { isAsyncFunction } = require('../utils')
just a code style I guess to make everything look consistant.
| } | ||
|
|
||
| if (isPlaywrightSession() && test?.opts?.cookies) { | ||
| if (test.opts.user == name) { |
There was a problem hiding this comment.
- Double equals (==) will perform a type conversion when comparing two things, and will handle NaN, -0, and +0 specially to conform to IEEE 754 (so NaN != NaN, and -0 == +0);
- Triple equals (===) will do the same comparison as double equals (including the special handling for NaN, -0, and +0) but without type conversion; if the types differ, false is returned.
i'm not sure if we would try to do strict equality
There was a problem hiding this comment.
I don't think this matters for 2 strings....
| } | ||
|
|
||
| if (!config.saveToFile) return | ||
| const cookieFile = path.join(global.output_dir, `${name}_session.json`) |
There was a problem hiding this comment.
may you think we shall store this output_dir in Store?
There was a problem hiding this comment.
yes, I was thinking about it... Probably we need to switch to this
but it's too much of refactoring to do
| loadCookiesFromFile(config) | ||
| } | ||
|
|
||
| const loginFunction = async name => { |
There was a problem hiding this comment.
I could be wrong but what if user just puts some name that is not defined in config, shall we handle that case?
There was a problem hiding this comment.
Yes, you are right, this should be handled
autoLoginplugin toauthpluginloginAsfunction to work fromBeforeSuiteIn this case cookies can be preloaded into Playwright when creating new browser session for faster access