Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit db05632

Browse files
authored
Merge pull request #1531 from magento-pangolin/tmp
[Pangolin] pangolin sprint-develop to mainline - MQE-292 Use "selector" name consistently instead of "locator" - MQE-350 Workshop feedback
2 parents e9b27bc + 5198633 commit db05632

File tree

56 files changed

+262
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+262
-252
lines changed

dev/tests/acceptance/README.md

Lines changed: 80 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,39 @@
88
----
99

1010
# Prerequisites
11+
* **IMPORTANT**: Configure your Magento Store for [Automated Testing](http://devdocs.magento.com/guides/v2.0/mtf/mtf_quickstart/mtf_quickstart_magento.html)
1112
* [PHP v7.x](http://php.net/manual/en/install.php)
1213
* [Composer v1.4.x](https://getcomposer.org/download/)
1314
* [Java](https://www.java.com/en/download/)
14-
* [Selenium Server](http://www.seleniumhq.org/download/)
15+
* [Selenium Server](http://www.seleniumhq.org/download/) - [v2.53.x](http://selenium-release.storage.googleapis.com/index.html?path=2.53/)
1516
* [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/downloads)
1617
* [Allure CLI](https://docs.qameta.io/allure/latest/#_installing_a_commandline)
1718
* [GitHub](https://desktop.github.com/)
18-
* GitHub Repos:
19-
* [CE Tests](https://github.com/magento-pangolin/magento2ce-acceptance-tests)
20-
* [EE Tests](https://github.com/magento-pangolin/magento2ee-acceptance-tests)
21-
* Configure Magento for [Automated Testing](http://devdocs.magento.com/guides/v2.0/mtf/mtf_quickstart/mtf_quickstart_magento.html)
2219

2320
### Recommendations
2421
* We recommend using [PHPStorm 2017](https://www.jetbrains.com/phpstorm/) for your IDE. They recently added support for [Codeception Test execution](https://blog.jetbrains.com/phpstorm/2017/03/codeception-support-comes-to-phpstorm-2017-1/) which is helpful when debugging.
25-
* We also recommend updating your [$PATH to include](https://stackoverflow.com/questions/7703041/editing-path-variable-on-mac) `vendor/bin` so you can easily execute the necessary `robo` and `codecept` commands instead of `vendor/bin/robo` or `vendor/bin/codecept`.
22+
* We also recommend updating your [$PATH to include](https://stackoverflow.com/questions/7703041/editing-path-variable-on-mac) `./vendor/bin` so you can easily execute the necessary `robo` and `codecept` commands instead of `./vendor/bin/robo` or `./vendor/bin/codecept`.
23+
24+
----
25+
26+
# TEMPORARY INSTALLATION INSTRUCTIONS
27+
Due to the current setup of the Framework you will need to do the following:
28+
29+
* `mkdir [DIRECTORY_NAME]`
30+
* `cd [DIRECTORY_NAME]`
31+
* Pull down - [EE](https://github.com/magento-pangolin/magento2ee)
32+
* Pull down - [CE](https://github.com/magento-pangolin/magento2ce)
33+
* `cd magento2ee`
34+
* `php -f dev/tools/build-ee.php -- --command=link --exclude=true`
35+
* Generate a `github-oauth` token: [Instructions](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token)
36+
* `touch magento2ce/dev/tests/acceptance/auth.json`
37+
* `nano magento2ce/dev/tests/acceptance/auth.json`
38+
* Replace `<personal access token>` with the token you generated in GitHub.
39+
* Save your work.
40+
* `cd ../magento2ce`
41+
* `cd dev/tests/acceptance`
42+
* `composer install`
43+
* **PLEASE IGNORE THE "Installation" SECTION THAT FOLLOWS, START WITH THE "Building The Framework" SECTION INSTEAD.**
2644

2745
----
2846

@@ -31,7 +49,7 @@ You can **either** install through composer **or** clone from git repository.
3149
## Git
3250
```
3351
git clone GITHUB_REPO_URL
34-
cd magento2ce-acceptance-tests
52+
cd magento2ce
3553
composer install
3654
```
3755

@@ -50,93 +68,93 @@ Robo is a task runner for PHP that allows you to alias long complex CLI commands
5068
### Example
5169

5270
* Original: `allure generate tests/_output/allure-results/ -o tests/_output/allure-report/`
53-
* Robo: `robo allure1:generate`
71+
* Robo: `./vendor/bin/robo allure1:generate`
5472

5573
## Available Robo Commands
56-
You can see a list of all available Robo commands by calling `robo` directly in the Terminal.
74+
You can see a list of all available Robo commands by calling `./vendor/bin/robo` in the Terminal.
5775

5876
##### Codeception Robo Commands
59-
* `robo`
77+
* `./vendor/bin/robo`
6078
* Lists all available Robo commands.
61-
* `robo clone:files`
79+
* `./vendor/bin/robo clone:files`
6280
* Duplicate the Example configuration files used to customize the Project
63-
* `robo build:project`
81+
* `./vendor/bin/robo build:project`
6482
* Build the Codeception project
65-
* `robo generate:pages`
83+
* `./vendor/bin/robo generate:pages`
6684
* Generate all Page Objects
67-
* `robo generate:tests`
85+
* `./vendor/bin/robo generate:tests`
6886
* Generate all Tests in PHP
69-
* `robo example`
87+
* `./vendor/bin/robo example`
7088
* Run all Tests marked with the @group tag 'example', using the Chrome environment
71-
* `robo chrome`
72-
* Run all Acceptance tests using the Chrome environment
73-
* `robo firefox`
74-
* Run all Acceptance tests using the FireFox environment
75-
* `robo phantomjs`
76-
* Run all Acceptance tests using the PhantomJS environment
77-
* `robo folder ______`
78-
* Run all Acceptance tests located under the Directory Path provided using the Chrome environment
79-
* `robo group ______`
89+
* `./vendor/bin/robo chrome`
90+
* Run all Functional tests using the Chrome environment
91+
* `./vendor/bin/robo firefox`
92+
* Run all Functional tests using the FireFox environment
93+
* `./vendor/bin/robo phantomjs`
94+
* Run all Functional tests using the PhantomJS environment
95+
* `./vendor/bin/robo folder ______`
96+
* Run all Functional tests located under the Directory Path provided using the Chrome environment
97+
* `./vendor/bin/robo group ______`
8098
* Run all Tests with the specified @group tag, excluding @group 'skip', using the Chrome environment
8199

82100
##### Allure Robo Commands
83101
To determine which version of the Allure command you need to use please run `allure --version`.
84102

85-
* `robo allure1:generate`
103+
* `./vendor/bin/robo allure1:generate`
86104
* Allure v1.x.x - Generate the HTML for the Allure report based on the Test XML output
87-
* `robo allure1:open`
105+
* `./vendor/bin/robo allure1:open`
88106
* Allure v1.x.x - Open the HTML Allure report
89-
* `robo allure1:report`
107+
* `./vendor/bin/robo allure1:report`
90108
* Allure v1.x.x - Generate and open the HTML Allure report
91-
* `robo allure2:generate`
109+
* `./vendor/bin/robo allure2:generate`
92110
* Allure v2.x.x - Generate the HTML for the Allure report based on the Test XML output
93-
* `robo allure2:open`
111+
* `./vendor/bin/robo allure2:open`
94112
* Allure v2.x.x - Open the HTML Allure report
95-
* `robo allure2:report`
113+
* `./vendor/bin/robo allure2:report`
96114
* Allure v2.x.x - Generate and open the HTML Allure report
97115

98116
----
99117

100118
# Building The Framework
101-
After installing the dependencies you will want to build the Codeception project in the [Acceptance Test Framework](https://github.com/magento-pangolin/magento2-acceptance-test-framework), which is a dependency of the CE or EE Tests repo. Run `robo build:project` to complete this task.
119+
After installing the dependencies you will want to build the Codeception project in the [Magento 2 Functional Testing Framework](https://github.com/magento-pangolin/magento2-functional-testing-framework), which is a dependency of the CE or EE Tests repo. Run `./vendor/bin/robo build:project` to complete this task.
102120

103-
`robo build:project`
121+
`./vendor/bin/robo build:project`
104122

105123
----
106124

107125
# Configure the Framework
108-
Before you can generate or run the Tests you will need to clone the Example Configuration files and edit them for your specific Store settings. You can edit these files with out the fear of accidentally committing your credentials or other sensitive information as these files are listed in the *.gitignore* file.
109-
Run the following command to generate these files:
126+
Before you can generate or run the Tests you will need to edit the Configuration files and configure them for your specific Store settings. You can edit these files with out the fear of accidentally committing your credentials or other sensitive information as these files are listed in the *.gitignore* file.
110127

111-
`robo setup`
128+
In the `.env` file you will find key pieces of information that are unique to your local Magento setup that will need to be edited before you can generate tests:
129+
* **MAGENTO_BASE_URL**
130+
* **MAGENTO_BACKEND_NAME**
131+
* **MAGENTO_ADMIN_USERNAME**
132+
* **MAGENTO_ADMIN_PASSWORD**
112133

113-
In these files you will find key pieces of information that are unique to your local Magento setup that will need to be edited (ex **MAGENTO_BASE_URL**, **MAGENTO_BACKEND_NAME**, **MAGENTO_ADMIN_USERNAME**, **MAGENTO_ADMIN_PASSWORD**, etc...).
114-
* **tests/acceptance.suite.yml**
134+
##### Additional Codeception settings can be found in the following files:
135+
* **tests/functional.suite.yml**
115136
* **codeception.dist.yml**
116-
* **.env**
117137

118138
----
119139

120140
# Generate PHP files for Tests
121-
All Tests in the Framework are written in XML and need to have the PHP generated for Codeception to run. Run the following command to generate the PHP files into the following directory: `tests/acceptance/Magento/AcceptanceTest/_generated`
141+
All Tests in the Framework are written in XML and need to have the PHP generated for Codeception to run. Run the following command to generate the PHP files in the following directory (If this directory does not exist it will be created): `dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated`
122142

123-
If this directory doesn't exist it will be created.
124-
125-
`robo generate:tests`
143+
`./vendor/bin/robo generate:tests`
126144

127145
----
128146

129147
# Running Tests
130148
## Start the Selenium Server
131-
PLEASE NOTE: You will need to have an instance of the Selenium Server running on your machine before you can execute the Tests.
149+
**PLEASE NOTE**: You will need to have an instance of the Selenium Server running on your machine before you can execute the Tests.
132150

133151
```
134152
cd [LOCATION_OF_SELENIUM_JAR]
135153
java -jar selenium-server-standalone-X.X.X.jar
136154
```
137155

138156
## Run Tests Manually
139-
You can run the Codeception tests directly without using Robo if you'd like. To do so please run `codecept run acceptance` to execute all Acceptance tests that DO NOT include @env tags. IF a Test includes an [@env tag](http://codeception.com/docs/07-AdvancedUsage#Environments) you MUST include the `--env ENV_NAME` flag.
157+
You can run the Codeception tests directly without using Robo if you'd like. To do so please run `./vendor/bin/codecept run functional` to execute all Functional tests that DO NOT include @env tags. IF a Test includes an [@env tag](http://codeception.com/docs/07-AdvancedUsage#Environments) you MUST include the `--env ENV_NAME` flag.
140158

141159
#### Common Codeception Flags:
142160

@@ -150,17 +168,17 @@ You can run the Codeception tests directly without using Robo if you'd like. To
150168

151169
#### Examples
152170

153-
* Run ALL Acceptance Tests without an @env tag: `codecept run acceptance`
154-
* Run ALL Acceptance Tests without the "skip" @group: `codecept run acceptance --skip-group skip`
155-
* Run ALL Acceptance Tests with the @group tag "example" without the "skip" @group tests: `codecept run acceptance --group example --skip-group skip`
171+
* Run ALL Functional Tests without an @env tag: `./vendor/bin/codecept run functional`
172+
* Run ALL Functional Tests without the "skip" @group: `./vendor/bin/codecept run functional --skip-group skip`
173+
* Run ALL Functional Tests with the @group tag "example" without the "skip" @group tests: `./vendor/bin/codecept run functional --group example --skip-group skip`
156174

157175
## Run Tests using Robo
158-
* Run all Acceptance Tests using the @env tag "chrome": `robo chrome`
159-
* Run all Acceptance Tests using the @env tag "firefox": `robo firefox`
160-
* Run all Acceptance Tests using the @env tag "phantomjs": `robo phantomjs`
161-
* Run all Acceptance Tests using the @group tag "example": `robo example`
162-
* Run all Acceptance Tests using the provided @group tag: `robo group GROUP_NAME`
163-
* Run all Acceptance Tests listed under the provided Folder Path: `robo folder tests/acceptance/Magento/AcceptanceTest/MODULE_NAME`
176+
* Run all Functional Tests using the @env tag "chrome": `./vendor/bin/robo chrome`
177+
* Run all Functional Tests using the @env tag "firefox": `./vendor/bin/robo firefox`
178+
* Run all Functional Tests using the @env tag "phantomjs": `./vendor/bin/robo phantomjs`
179+
* Run all Functional Tests using the @group tag "example": `./vendor/bin/robo example`
180+
* Run all Functional Tests using the provided @group tag: `./vendor/bin/robo group GROUP_NAME`
181+
* Run all Functional Tests listed under the provided Folder Path: `./vendor/bin/robo folder dev/tests/acceptance/tests/functional/Magento/FunctionalTest/MODULE_NAME`
164182

165183
----
166184

@@ -180,14 +198,14 @@ You can run the following commands in the Terminal to generate and open an Allur
180198
You can run the following Robo commands in the Terminal to generate and open an Allure report (Run the following terminal command for the Allure version: `allure --version`):
181199

182200
##### Allure v1.x.x
183-
* Build the Report: `robo allure1:generate`
184-
* Open the Report: `robo allure1:open`
185-
* Build/Open the Report: `robo allure1:report`
201+
* Build the Report: `./vendor/bin/robo allure1:generate`
202+
* Open the Report: `./vendor/bin/robo allure1:open`
203+
* Build/Open the Report: `./vendor/bin/robo allure1:report`
186204

187205
##### Allure v2.x.x
188-
* Build the Report: `robo allure2:generate`
189-
* Open the Report: `robo allure2:open`
190-
* Build/Open the Report: `robo allure2:report`
206+
* Build the Report: `./vendor/bin/robo allure2:generate`
207+
* Open the Report: `./vendor/bin/robo allure2:open`
208+
* Build/Open the Report: `./vendor/bin/robo allure2:report`
191209

192210
----
193211

@@ -199,9 +217,9 @@ Due to the interdependent nature of the 2 repos it is recommended to Symlink the
199217
# Troubleshooting
200218
* TimeZone Error - http://stackoverflow.com/questions/18768276/codeception-datetime-error
201219
* TimeZone List - http://php.net/manual/en/timezones.america.php
202-
* System PATH - Make sure you have `vendor/bin/` and `vendor/` listed in your system path so you can run the `codecept` and `robo` commands directly:
220+
* System PATH - Make sure you have `./vendor/bin/`, `vendor/bin/` and `vendor/` listed in your system path so you can run the `codecept` and `robo` commands directly:
203221

204-
`sudo nano /etc/private/paths`
222+
`sudo nano /etc/paths`
205223

206224
* StackOverflow Help: https://stackoverflow.com/questions/7703041/editing-path-variable-on-mac
207225
* Allure `@env error` - Allure recently changed their Codeception Adapter that breaks Codeception when tests include the `@env` tag. A workaround for this error is to revert the changes they made to a function.
@@ -225,4 +243,4 @@ public function _initialize(array $ignoredAnnotations = [])
225243
Model\Provider::setOutputDirectory($outputDirectory);
226244
}
227245
}
228-
```
246+
```

dev/tests/acceptance/RoboFile.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ class RoboFile extends \Robo\Tasks
1313
{
1414
use Robo\Task\Base\loadShortcuts;
1515

16-
/**
17-
* Complete all Project Setup tasks
18-
*/
19-
function setup()
20-
{
21-
$this->_exec('vendor/bin/robo clone:files');
22-
$this->_exec('vendor/bin/codecept build');
23-
}
24-
2516
/**
2617
* Duplicate the Example configuration files used to customize the Project for customization
2718
*/
@@ -33,12 +24,13 @@ function cloneFiles()
3324
}
3425

3526
/**
27+
* Clone the Example configuration files
3628
* Build the Codeception project
3729
*/
3830
function buildProject()
3931
{
4032
$this->cloneFiles();
41-
$this->_exec('vendor/bin/codecept build');
33+
$this->_exec('./vendor/bin/codecept build');
4234
}
4335

4436
/**
@@ -56,47 +48,47 @@ function generateTests()
5648
*/
5749
function chrome()
5850
{
59-
$this->_exec('codecept run functional --env chrome --skip-group skip');
51+
$this->_exec('./vendor/bin/codecept run functional --env chrome --skip-group skip');
6052
}
6153

6254
/**
6355
* Run all Acceptance tests using the FireFox environment
6456
*/
6557
function firefox()
6658
{
67-
$this->_exec('codecept run functional --env firefox --skip-group skip');
59+
$this->_exec('./vendor/bin/codecept run functional --env firefox --skip-group skip');
6860
}
6961

7062
/**
7163
* Run all Acceptance tests using the PhantomJS environment
7264
*/
7365
function phantomjs()
7466
{
75-
$this->_exec('codecept run functional --env phantomjs --skip-group skip');
67+
$this->_exec('./vendor/bin/codecept run functional --env phantomjs --skip-group skip');
7668
}
7769

7870
/**
7971
* Run all Tests with the specified @group tag, excluding @group 'skip', using the Chrome environment
8072
*/
8173
function group($args = '')
8274
{
83-
$this->taskExec('codecept run functional --verbose --steps --env chrome --skip-group skip --group')->args($args)->run();
75+
$this->taskExec('./vendor/bin/codecept run functional --verbose --steps --env chrome --skip-group skip --group')->args($args)->run();
8476
}
8577

8678
/**
8779
* Run all Acceptance tests located under the Directory Path provided using the Chrome environment
8880
*/
8981
function folder($args = '')
9082
{
91-
$this->taskExec('codecept run functional --env chrome')->args($args)->run();
83+
$this->taskExec('./vendor/bin/codecept run functional --env chrome')->args($args)->run();
9284
}
9385

9486
/**
9587
* Run all Tests marked with the @group tag 'example', using the Chrome environment
9688
*/
9789
function example()
9890
{
99-
$this->_exec('codecept run --env chrome --group example --skip-group skip');
91+
$this->_exec('./vendor/bin/codecept run --env chrome --group example --skip-group skip');
10092
}
10193

10294
/**

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Section/AdminLoginFormSection.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="AdminLoginFormSection">
12-
<element name="username" type="input" locator="#username"/>
13-
<element name="password" type="input" locator="#login"/>
14-
<element name="signIn" type="button" locator=".actions .action-primary" timeout="30"/>
12+
<element name="username" type="input" selector="#username"/>
13+
<element name="password" type="input" selector="#login"/>
14+
<element name="signIn" type="button" selector=".actions .action-primary" timeout="30"/>
1515
</section>
1616
</config>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Backend/Section/AdminMessagesSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
-->
88

99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="../../../../../../../../../../magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="AdminMessagesSection">
12-
<element name="test" type="input" locator=".test"/>
12+
<element name="test" type="input" selector=".test"/>
1313
</section>
1414
</config>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<data key="sku" unique="suffix">SimpleProduct</data>
2525
<data key="type_id">simple</data>
2626
<data key="attribute_set_id">4</data>
27-
<data key="name">SimpleProduct</data>
27+
<data key="name" unique="suffix">SimpleProduct</data>
2828
<data key="price">123.00</data>
2929
<data key="visibility">4</data>
3030
<data key="status">1</data>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryBasicFieldSection.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="AdminCategoryBasicFieldSection">
12-
<element name="IncludeInMenu" type="checkbox" locator="input[name='include_in_menu']"/>
13-
<element name="EnableCategory" type="checkbox" locator="input[name='is_active']"/>
14-
<element name="CategoryNameInput" type="input" locator="input[name='name']"/>
12+
<element name="IncludeInMenu" type="checkbox" selector="input[name='include_in_menu']"/>
13+
<element name="EnableCategory" type="checkbox" selector="input[name='is_active']"/>
14+
<element name="CategoryNameInput" type="input" selector="input[name='name']"/>
1515
</section>
1616
</config>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminCategoryMainActionsSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="AdminCategoryMainActionsSection">
12-
<element name="SaveButton" type="button" locator=".page-actions-inner #save" timeout="30"/>
12+
<element name="SaveButton" type="button" selector=".page-actions-inner #save" timeout="30"/>
1313
</section>
1414
</config>

0 commit comments

Comments
 (0)