Skip to content

Commit

Permalink
MQE-2164: Remove terms from MFTF (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyau authored Jun 15, 2020
1 parent 7a7e403 commit bd2eee2
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 128 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ Magento Functional Testing Framework Changelog
* Command verifies and troubleshoots some configuration steps required for running tests
* Please see DevDocs for more details
* `<*Data>` actions now contain `API Endpoint` and `Request Header` artifacts.
* Introduced new `.env` configurations `ENABLE_BROWSER_LOG` and `BROWSER_LOG_BLACKLIST`
* Introduced new `.env` configurations `ENABLE_BROWSER_LOG` and `BROWSER_LOG_BLOCKLIST`
* Configuration enables allure artifacts for browser log entries if they are present after the step.
* Blacklist filters out logs from specific sources.
* Blocklist filters out logs from specific sources.
* Customizability
* Introduced `timeout=""` to `magentoCLI` actions.

Expand Down
2 changes: 1 addition & 1 deletion bin/blacklist.txt → bin/blocklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# #
# THIS FILE CANNOT CONTAIN BLANK LINES #
###################################################################
bin/blacklist.txt
bin/blocklist.txt
dev/tests/static/Magento/Sniffs/Commenting/FunctionCommentSniff.php
dev/tests/static/Magento/Sniffs/Commenting/VariableCommentSniff.php
dev/tests/verification/_generated
4 changes: 2 additions & 2 deletions bin/copyright-check
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@


FILE_EXTENSIONS='.php\|.xml\|.xsd'
BLACKLIST='bin/blacklist.txt'
BLOCKLIST='bin/blocklist.txt'
RESULT=''

# Iterate through the list of tracked files
# that have the expected extensions
# that are not ignored
for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLACKLIST`
for i in `git ls-tree --full-tree -r --name-only HEAD | grep $FILE_EXTENSIONS | grep -v -f $BLOCKLIST`
do
if echo `cat $i` | grep -q -v "Copyright © Magento, Inc. All rights reserved."; then
# Copyright is missing
Expand Down
10 changes: 5 additions & 5 deletions bin/copyright-check.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@echo off
SETLOCAL EnableDelayedExpansion
SET BLACKLIST_FILE=bin/blacklist.txt
SET BLOCKLIST_FILE=bin/blocklist.txt
SET i=0

FOR /F %%x IN ('git ls-tree --full-tree -r --name-only HEAD') DO (
Expand All @@ -12,14 +12,14 @@ FOR /F %%x IN ('git ls-tree --full-tree -r --name-only HEAD') DO (
if "%%~xx"==".xml" set GOOD_EXT=1
if "%%~xx"==".xsd" set GOOD_EXT=1
IF DEFINED GOOD_EXT (
SET BLACKLISTED=
FOR /F "tokens=* skip=5" %%f IN (%BLACKLIST_FILE%) DO (
SET BLOCKLISTED=
FOR /F "tokens=* skip=5" %%f IN (%BLOCKLIST_FILE%) DO (
SET LINE=%%x
IF NOT "!LINE!"=="!LINE:%%f=!" (
SET BLACKLISTED=1
SET BLOCKLISTED=1
)
)
IF NOT DEFINED BLACKLISTED (
IF NOT DEFINED BLOCKLISTED (
FIND "Copyright © Magento, Inc. All rights reserved." %%x >nul
IF ERRORLEVEL 1 (
SET /A i+=1
Expand Down
4 changes: 2 additions & 2 deletions dev/tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
putenv("{$key}=${value}");
}

// Add our test module to the whitelist
putenv('MODULE_WHITELIST=Magento_TestModule');
// Add our test module to the allowlist
putenv('MODULE_ALLOWLIST=Magento_TestModule');

// Define our own set of paths for the tests
defined('FW_BP') || define('FW_BP', PROJECT_ROOT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class IsNullSniff implements Sniff
/**
* @var string
*/
protected $blacklist = 'is_null';
protected $blocklist = 'is_null';

/**
* @inheritdoc
Expand All @@ -29,7 +29,7 @@ public function register()
public function process(File $sourceFile, $stackPtr)
{
$tokens = $sourceFile->getTokens();
if ($tokens[$stackPtr]['content'] === $this->blacklist) {
if ($tokens[$stackPtr]['content'] === $this->blocklist) {
$sourceFile->addError(
"is_null must be avoided. Use strict comparison instead.",
$stackPtr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,12 @@ public function testApplyCustomModuleMethods()
}

/**
* Validate blacklisted modules are removed
* Validate blocklisted modules are removed
* Module paths are sorted according to module name in alphabetically ascending order
*
* @throws \Exception
*/
public function testGetModulePathsBlacklist()
public function testGetModulePathsBlocklist()
{
$this->setMockResolverClass(
false,
Expand Down Expand Up @@ -946,10 +946,10 @@ private function setMockResolverClass(
* @param ModuleResolver $instance
* @param array $mockPaths
* @param array $mockModules
* @param array $mockBlacklist
* @param array $mockBlocklist
* @throws \Exception
*/
private function setMockResolverProperties($instance, $mockPaths = null, $mockModules = null, $mockBlacklist = [])
private function setMockResolverProperties($instance, $mockPaths = null, $mockModules = null, $mockBlocklist = [])
{
$property = new \ReflectionProperty(ModuleResolver::class, 'enabledModulePaths');
$property->setAccessible(true);
Expand All @@ -959,9 +959,9 @@ private function setMockResolverProperties($instance, $mockPaths = null, $mockMo
$property->setAccessible(true);
$property->setValue($instance, $mockModules);

$property = new \ReflectionProperty(ModuleResolver::class, 'moduleBlacklist');
$property = new \ReflectionProperty(ModuleResolver::class, 'moduleBlocklist');
$property->setAccessible(true);
$property->setValue($instance, $mockBlacklist);
$property->setValue($instance, $mockBlocklist);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,47 @@ class NameValidationUtilTest extends MagentoTestCase
*/
public function testCurlyBracesInTestName()
{
$this->validateBlacklistedTestName("{{curlyBraces}}");
$this->validateBlocklistedTestName("{{curlyBraces}}");
}

/**
* Validate name with quotation marks throws exception
*/
public function testQuotesInTestName()
{
$this->validateBlacklistedTestName("\"quotes\"");
$this->validateBlocklistedTestName("\"quotes\"");
}

/**
* Validate name with single quotes throws exception
*/
public function testSingleQuotesInTestName()
{
$this->validateBlacklistedTestName("'singleQuotes'");
$this->validateBlocklistedTestName("'singleQuotes'");
}

/**
* Validate name with parenthesis throws execption
*/
public function testParenthesesInTestName()
{
$this->validateBlacklistedTestName("(parenthesis)");
$this->validateBlocklistedTestName("(parenthesis)");
}

/**
* Validate name with dollar signs throws exception
*/
public function testDollarSignInTestName()
{
$this->validateBlacklistedTestName("\$dollarSign\$");
$this->validateBlocklistedTestName("\$dollarSign\$");
}

/**
* Validate name with spaces throws exception
*/
public function testSpacesInTestName()
{
$this->validateBlacklistedTestName("Test Name With Spaces");
$this->validateBlocklistedTestName("Test Name With Spaces");
}

/**
Expand All @@ -66,7 +66,7 @@ public function testSpacesInTestName()
* @param string $testName
* @return void
*/
private function validateBlacklistedTestName($testName)
private function validateBlocklistedTestName($testName)
{
$this->expectException(XmlException::class);
NameValidationUtil::validateName($testName, "Test");
Expand Down
12 changes: 6 additions & 6 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ Example:
TESTS_MODULE_PATH=~/magento2/dev/tests/acceptance/tests/functional/Magento/FunctionalTest
```

### MODULE_WHITELIST
### MODULE_ALLOWLIST

Use for a new module.
When adding a new directory at `Magento/FunctionalTest`, add the directory name to `MODULE_WHITELIST` to enable the MFTF to process it.
When adding a new directory at `Magento/FunctionalTest`, add the directory name to `MODULE_ALLOWLIST` to enable the MFTF to process it.

Example:

```conf
MODULE_WHITELIST=Magento_Framework,Magento_ConfigurableProductWishlist,Magento_ConfigurableProductCatalogSearch
MODULE_ALLOWLIST=Magento_Framework,Magento_ConfigurableProductWishlist,Magento_ConfigurableProductCatalogSearch
```

### MAGENTO_CLI_COMMAND_PATH
Expand Down Expand Up @@ -331,14 +331,14 @@ Use this if you're having issues with sessions hanging in an MFTF suite.
SELENIUM_CLOSE_ALL_SESSIONS=true
```

### BROWSER_LOG_BLACKLIST
### BROWSER_LOG_BLOCKLIST

Blacklists types of browser log entries from appearing in Allure steps.
Blocklists types of browser log entries from appearing in Allure steps.

Denoted in browser log entry as `"SOURCE": "type"`.

```conf
BROWSER_LOG_BLACKLIST=other,console-api
BROWSER_LOG_BLOCKLIST=other,console-api
```

### WAIT_TIMEOUT
Expand Down
58 changes: 0 additions & 58 deletions etc/codecoverage/index.php

This file was deleted.

10 changes: 0 additions & 10 deletions etc/codecoverage/test.php

This file was deleted.

6 changes: 3 additions & 3 deletions etc/config/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ BROWSER=chrome
#DEFAULT_TIMEZONE=America/Los_Angeles

#*** These properties impact the modules loaded into MFTF, you can point to your own full path, or a custom set of modules located with the core set
MODULE_WHITELIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProductCatalogSearch
MODULE_ALLOWLIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProductCatalogSearch
#CUSTOM_MODULE_PATHS=

#*** Bool property which allows the user to toggle debug output during test execution
Expand All @@ -63,9 +63,9 @@ MODULE_WHITELIST=Magento_Framework,ConfigurableProductWishlist,ConfigurableProdu
#*** Uncomment and set to enable all tests, regardless of passing status, to have all their Allure artifacts.
#VERBOSE_ARTIFACTS=true

#*** Uncomment and set to enable browser log entries on actions in Allure. Blacklist is used to filter logs of a specific "source"
#*** Uncomment and set to enable browser log entries on actions in Allure. Blocklist is used to filter logs of a specific "source"
#ENABLE_BROWSER_LOG=true
#BROWSER_LOG_BLACKLIST=other
BROWSER_LOG_BLOCKLIST=other

#*** Elastic Search version used for test ***#
ELASTICSEARCH_VERSION=7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function afterStep(\Codeception\Event\StepEvent $e)
{
$browserLog = $this->getDriver()->webDriver->manage()->getLog("browser");
if (getenv('ENABLE_BROWSER_LOG') === 'true') {
foreach (explode(',', getenv('BROWSER_LOG_BLACKLIST')) as $source) {
foreach (explode(',', getenv('BROWSER_LOG_BLOCKLIST')) as $source) {
$browserLog = BrowserLogUtil::filterLogsOfType($browserLog, $source);
}
if (!empty($browserLog)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PageObjectHandler implements ObjectHandlerInterface
const PARAMETERIZED = 'parameterized';
const AREA = 'area';
const FILENAME = 'filename';
const NAME_BLACKLIST_ERROR_MSG = "Page names cannot contain non alphanumeric characters.\tPage='%s'";
const NAME_BLOCKLIST_ERROR_MSG = "Page names cannot contain non alphanumeric characters.\tPage='%s'";

/**
* The singleton instance of this class
Expand Down Expand Up @@ -58,7 +58,7 @@ private function __construct()
$pageNameValidator = new NameValidationUtil();
foreach ($parserOutput as $pageName => $pageData) {
if (preg_match('/[^a-zA-Z0-9_]/', $pageName)) {
throw new XmlException(sprintf(self::NAME_BLACKLIST_ERROR_MSG, $pageName));
throw new XmlException(sprintf(self::NAME_BLOCKLIST_ERROR_MSG, $pageName));
}

$filename = $pageData[self::FILENAME] ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ActionObjectExtractor extends BaseObjectExtractor
const ACTION_GROUP_ARGUMENTS = 'arguments';
const ACTION_GROUP_ARG_VALUE = 'value';
const BEFORE_AFTER_ERROR_MSG = "Merge Error - Steps cannot have both before and after attributes.\tStepKey='%s'";
const STEP_KEY_BLACKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters.\tStepKey='%s'";
const STEP_KEY_BLOCKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters.\tStepKey='%s'";
const STEP_KEY_EMPTY_ERROR_MSG = "StepKeys cannot be empty.\tAction='%s'";
const DATA_PERSISTENCE_CUSTOM_FIELD = 'field';
const DATA_PERSISTENCE_CUSTOM_FIELD_KEY = 'key';
Expand Down Expand Up @@ -70,7 +70,7 @@ public function extractActions($testActions, $testName = null)
}

if (preg_match('/[^a-zA-Z0-9_]/', $stepKey)) {
throw new XmlException(sprintf(self::STEP_KEY_BLACKLIST_ERROR_MSG, $actionName));
throw new XmlException(sprintf(self::STEP_KEY_BLOCKLIST_ERROR_MSG, $actionName));
}

$actionAttributes = $this->stripDescriptorTags(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getAnnotationExtractor()
*/
public function extractTestData($testData, $validateAnnotations = true)
{
// validate the test name for blacklisted char (will cause allure report issues) MQE-483
// validate the test name for blocklisted char (will cause allure report issues) MQE-483
NameValidationUtil::validateName($testData[self::NAME], "Test");

$testAnnotations = [];
Expand Down
Loading

0 comments on commit bd2eee2

Please sign in to comment.