I am using the Intern for my functional tests. One such test requires being logged into an admin account:
registerSuite({
name: 'login',
'login': function() {
return this.remote
.get(URL)
.findById('username')
.click()
.pressKeys(USER.ADMIN.USERNAME)
.end()
.findById('password')
.click()
.pressKeys(USER.ADMIN.PASSWORD)
.pressKeys('\n')
.end()
.findByCssSelector('.login-welcome')
.getVisibleText()
.then(function(text) {
assert.strictEqual(text, USER.ADMIN.NAME, 'User should now be logged in');
});
}
});
Now, the problem is that this password is passed in as plain text. Here it is being displayed on BrowserStack:
00:19 | 0 | Send a sequence of key strokes to the active element. | password
It's the same on SauceLabs:
COMMAND: POST keys
PARAMETERS: {"value":["password"]}
The problem lies in the fact that access to these tests aren't restricted--these tests need to be viewed by people in other departments.
Even without that, on the off chance that the password to the testing account is compromised, I don't want the attacker to suddenly get admin access to everything else.
Is there any way to make it so that the password isn't stored / shown as plain text in the commands?
My team is currently entertaining the idea of running a separate script to activate / deactivate these accounts so that they only work while running the functional tests, but I wanted to see if anyone has come up with a better solution.