You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: mftf/2.3/credentials.md
+60-10Lines changed: 60 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,72 @@
3
3
4
4
# Credentials
5
5
6
-
When you need to use credentials in your tests such as an integration token, you can do it whithout exposing the sensitive data in your XML tests.
6
+
When you test functionality that involves external services such as UPS, FedEx, PayPal, SignifyD, use the MFTF credentials feature to hide sensitive data like integration tokens, API keys, etc.
7
7
8
+
## Define sensitive data in `.credentials`
8
9
10
+
The MFTF creates a sample file for credentials during [initial setup]: `magento2/dev/tests/acceptance/.credentials.example`.
11
+
The file contains a list of fields for credentials you may need.
9
12
10
-
1. Why people would need credentials in the MFTF?
13
+
To make the file with credentials visible for the MFTF, copy the `.credentials.example` to ``.credentials` while you are in the `<magentoroot>/dev/tests/acceptance/` directory:
14
+
15
+
```bash
16
+
cd dev/tests/acceptance/
17
+
```
18
+
19
+
```bash
20
+
cp .credentials.example .credentials
21
+
```
22
+
23
+
Verify whether the file is excluded from tracking by `.gitignore` (unless you need this behavior):
24
+
25
+
```bash
26
+
git check-ignore .credentials
27
+
```
28
+
29
+
The command outputs the path if the file is excluded:
30
+
31
+
```terminal
32
+
.credentials
33
+
```
34
+
35
+
Open the file, uncomment the fields you want to use, and add your values:
36
+
37
+
```config
38
+
carriers/usps/userid=test_user
39
+
carriers/usps/password=Lmgxvrq89uPwECeV
40
+
41
+
#carriers_dhl_id_us=
42
+
#carriers_dhl_password_us=
43
+
....
44
+
```
45
+
46
+
## Use credentials in test
47
+
48
+
Access data defined in the `.credentials` file using the [`fillField`][] action with the `userInput` attribute defined in the `{{_CREDS.<your data key>}}` format.
When you need to use credentials in your tests such as integration token, you can do it without exposing the sensitive data in your XML tests.
58
+
59
+
The MFTF enables you to store credentials for external services in the `.credentials` file which is
60
+
The template file is `.credentials.example`.
61
+
62
+
63
+
64
+
1. When do I need people would need credentials in the MFTF?
11
65
- Credentials are used for when you need to input an integration token or other security credential via a `fillField`.
12
66
- You shouldn't have security tokens checked in to any repo, so storing it in a DATA.xml file is a bad idea
13
67
- Furthermore, if you used data.xml, the Allure Report would show your security token like:
14
68
I fill field "SECURITYTOKEN".
15
69
- Use of {{_CREDS.TOKEN}} turns a `fillField` action into `fillSecretField` which scrubs the allure report.
16
70
17
-
2. What functionality does the MFTF credentials feauture cover?
71
+
2. What functionality does the MFTF credentials feature cover?
18
72
- How to store credentials
19
73
- build:project copies over .credentials.example, copy and remove the `.example`
20
74
- Store new credentials in a new line as `KEY=VALUE`
@@ -26,21 +80,17 @@ When you need to use credentials in your tests such as an integration token, you
26
80
- Credentials should only every be used if you have the need to connect to some external integration for your test
27
81
- Credentials should NOT be used to store stuff like Username/Password in your sandbox test environment; should be limited to tokens and passwords that would propose a security risk.
28
82
29
-
3. How to setup cerdentials?
83
+
4. How to setup credentials?
30
84
- build:project copies over .credentials.example, copy and remove the `.example`
31
85
- Store new credentials in a new line as
32
86
- KEY=VALUE
33
87
- You CANNOT check in the .credentials file
34
88
- For Magneto Devs, DevOps is still working on the solution of how to store credentials to be used in a build enviroment
35
89
- For outside Devs, they can store the credentials and build their own .credentials file as part of build steps
36
90
37
-
4. Examples of daily routine tasks using credentials in the MFTF.
91
+
5. Examples of daily routine tasks using credentials in the MFTF.
38
92
- In my test, I am wanting to test a Payment Method integration. This requires me to add a Payment via the Configuration page in the admin backend.
39
93
- I need to use the credentials to my Sandbox Environment, but I don't want those visible in the Allure Report:
0 commit comments