-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
Description
What are you trying to achieve?
Using Data Driven Tests with an array of test data which is reading the credentials from an .env-file (passwords, cleartext). I used the CodeceptJS function secret() to hide them and expected to see the tests use the correct password, and that it is only hidden in outputs.
Expected output is:
The test feature --
The scenario | {"username":"Username","password": ***}
'The real password: theLoggedPasswordInCleartext'
I.fillField('somePasswordLocator', '****')
✔ OK in 7ms
The scenario | {"username":"theSecondUsername","password": ***}
'The real password: theLoggedPasswordInCleartext'
I.fillField('somePasswordLocator', '****')
✔ OK in 1ms
What do you get instead?
The passwords are not only hidden in the outputs, but the asterisks are also used within the tests. Which makes logging in impossible.
The test feature --
The scenario | {"username":"Username","password": ***}
'The real password: ****'
I.fillField('somePasswordLocator', '****')
✖
The scenario | {"username":"theSecondUsername","password": ***}
'The real password: ****'
I.fillField('somePasswordLocator', '****')
✖
Testfile
const accounts = new DataTable(['role', 'username', 'password']);
accounts.add([
'ROLE_A',
process.env['FIRST_USERNAME'],
secret(process.env['FIRST_PASSWORD']),
]);
accounts.add([
'ROLE_B',
process.env['SECOND_USERNAME'],
secret(process.env['SECOND_PASSWORD']),
]);
Data(accounts)
.Scenario(
'ScenarioTitle',
({ I, pageObject, current }) => {
I.say("Given I'am logged in");
I.amOnPage('/');
loginPage.**sendForm**(current.username, current.password);
)
loginPageObject
**sendForm**(username, password) {
I.waitForElement(this.fields.username, 10);
I.fillField(this.fields.username, username);
I.fillField(this.fields.password, password);
I.click(this.submitButton);
},
Details
- CodeceptJS version: 3.4.1
- NodeJS Version: v18.17.1
- Operating System: MacOS
Might be related to the changes from this issue:
#3429
Metadata
Metadata
Assignees
Labels
No labels