Skip to content

Commit aa1629d

Browse files
authored
Editorial pass
1 parent 5497d21 commit aa1629d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/guides/action-groups.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Action Group Best Practices
22

3-
We should strive to write tests using only action groups. Fortunately we have built up a large set of action groups to get started. We can make use of them and extend them for our own specific needs. In some cases, we may never even need to write action groups of our own. We may be able to simply chain together calls to existing action groups to implement our new test case.
3+
We strive to write tests using only action groups. Fortunately, we have built up a large set of action groups to get started. We can make use of them and extend them for our own specific needs. In some cases, we may never even need to write action groups of our own. We may be able to simply chain together calls to existing action groups to implement our new test case.
44

55
## Why use Action Groups?
66

@@ -23,15 +23,15 @@ Action groups simplify maintainability by reducing duplication. Because they are
2323
</actionGroup>
2424
```
2525

26-
As you may be able to guess, logging in to the admin panel is one of the most used action groups. It is used around 1,500 times at the time of this writing.
26+
Logging in to the admin panel is one of the most used action groups. It is used around 1,500 times at the time of this writing.
2727

28-
Imagine if this wasn't an action group and instead we were to copy and paste these 5 actions so many times. In that scenario, if we need to make a small change it would require a lot of work. But with the action group, we can make the change in one place.
28+
Imagine if this was not an action group and instead we were to copy and paste these 5 actions every time. In that scenario, if a small change was needed, it would require a lot of work. But with the action group, we can make the change in one place.
2929

30-
## How can I extend Action Groups?
30+
## How to extend action groups
3131

32-
Let's continue using `LoginAsAdmin` as our example. I have trimmed away metadata to clearly reveal that this action group performs 5 actions:
32+
Again using `LoginAsAdmin` as our example, we trim away metadata to clearly reveal that this action group performs 5 actions:
3333

34-
```
34+
```xml
3535
<actionGroup name="LoginAsAdmin">
3636
...
3737
<amOnPage url="{{AdminLoginPage.url}}" .../>
@@ -42,29 +42,29 @@ Let's continue using `LoginAsAdmin` as our example. I have trimmed away metadata
4242
</actionGroup>
4343
```
4444

45-
This works against the standard Magento admin panel login page. But let's imagine we're working on a Magento extension that adds a CAPTCHA field to the login page. If we create and activate this extension and then we try to run all existing tests, we can expect almost everything to fail because now we are unable to log in because we did not completely fill out all of the login form. The CAPTCHA field was left unfilled.
45+
This works against the standard Magento admin panel login page. Bu imagine we are working on a Magento extension that adds a CAPTCHA field to the login page. If we create and activate this extension and then run all existing tests, we can expect almost everything to fail because the CAPTCHA field is left unfilled.
4646

47-
We can overcome this by making use of MFTF's extensibility. All we need to do is to provide a "merge" that modifies the existing `LoginAsAdmin` action group. Our simple merge file will look like this:
47+
We can overcome this by making use of MFTF's extensibility. All we need to do is to provide a "merge" that modifies the existing `LoginAsAdmin` action group. Our merge file will look like:
4848

49-
```
49+
```xml
5050
<actionGroup name="LoginAsAdmin">
5151
<fillField selector="{{CaptchaSection.captchaInput}}" before="signIn" .../>
5252
</actionGroup>
5353
```
5454

55-
Because the name of this merge is also `LoginAsAdmin`, the two get merged together and an additional step happens everytime this action group is made use of.
55+
Because the name of this merge is also `LoginAsAdmin`, the two get merged together and an additional step happens everytime this action group is used.
5656

57-
To continue this demonstration, let's imagine someone else is working on a Two Factor Authentication extension and they also provide a merge for the `LoginAsAdmin` action group. Their merge looks similar to what we've already seen. The only difference is that this time we fill a different field:
57+
To continue this example, imagine someone else is working on a 'Two-Factor Authentication' extension and they also provide a merge for the `LoginAsAdmin` action group. Their merge looks similar to what we have already seen. The only difference is that this time we fill a different field:
5858

59-
```
59+
```xml
6060
<actionGroup name="LoginAsAdmin">
6161
<fillField selector="{{TwoFactorSection.twoFactorInput}}" before="signIn" .../>
6262
</actionGroup>
6363
```
6464

6565
Bringing it all together, our resulting `LoginAsAdmin` action group becomes this:
6666

67-
```
67+
```xml
6868
<actionGroup name="LoginAsAdmin">
6969
...
7070
<amOnPage url="{{AdminLoginPage.url}}" .../>
@@ -77,6 +77,6 @@ Bringing it all together, our resulting `LoginAsAdmin` action group becomes this
7777
</actionGroup>
7878
```
7979

80-
Note that no file actually contains these exact contents above, but instead all three files come together to form this action group.
80+
No one file contains this exact content as above, but instead all three files come together to form this action group.
8181

82-
One final thing to be aware of is that this extensibility can be applied in many ways. Obviously we need to use it if we want to affect existing Magento entities like tests, action groups, and data. But something not so obvious is that this can be used within the walls of your own entities in order to make them more maintainable too.
82+
This extensibility can be applied in many ways. We can use it to affect existing Magento entities such as tests, action groups, and data. Not so obvious is that this tehcnique can be used within your own entities to make them more maintainable as well.

0 commit comments

Comments
 (0)