HOR-3373
+ Fix web entry login bloqued when session_block configuration is enabled. + Include behat test.
This commit is contained in:
@@ -1,37 +1,15 @@
|
||||
# behat.yml
|
||||
default:
|
||||
context:
|
||||
parameters:
|
||||
base_url: http://processmaker-ip-or-domain/api/1.0/[workspace]/
|
||||
access_token: e79057f4276661bedb6154eed3834f6cbd738853
|
||||
client_id: x-pm-local-client
|
||||
client_secret: 179ad45c6ce2cb97cf1029e212046e81
|
||||
#uploadFilesFolder: /opt/uploadfiles
|
||||
#cd5cff9b2e3ebabf49e276e47e977fab5988c00e
|
||||
login_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/login
|
||||
authentication_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/login/authentication.php
|
||||
oauth_app_url: http://processmaker-ip-or-domain/sys[workspace]/en/neoclassic/oauth2/clientSetupAjax
|
||||
oauth_authorization_url: http://processmaker-ip-or-domain/[workspace]/oauth2/authorize
|
||||
user_name: <your-admin-username>
|
||||
user_password: <your-admin-password>
|
||||
|
||||
# Database connection parameters
|
||||
# To Mysql
|
||||
mys_db_type: mysql
|
||||
mys_db_server: <your-mysql-server-ip>
|
||||
mys_db_name: <your-db-name>
|
||||
mys_db_username: <your-db-username>
|
||||
mys_db_password:<your-db-password>
|
||||
mys_db_port: 3306
|
||||
mys_db_encode: utf8
|
||||
mys_db_description: Mysql connection
|
||||
|
||||
# To SQL Server
|
||||
sqlsrv_db_type: mssql
|
||||
sqlsrv_db_server: <your-myssql-server-ip>
|
||||
sqlsrv_db_name: <your-db-name>
|
||||
sqlsrv_db_username: <your-db-username>
|
||||
sqlsrv_db_password: <your-db-password>
|
||||
sqlsrv_db_port: 1433
|
||||
sqlsrv_db_encode: utf8
|
||||
sqlsrv_db_description: Microsoft SQL Server connection
|
||||
suites:
|
||||
webentry2_features:
|
||||
paths:
|
||||
- %paths.base%/features/webentry2
|
||||
- %paths.base%/features/test
|
||||
contexts:
|
||||
- FeatureContext:
|
||||
parameters:
|
||||
webDriverHost: "http://localhost:4444"
|
||||
browser: "chrome"
|
||||
capabilities:
|
||||
browserName: chrome
|
||||
platform: ANY
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"guzzle/guzzle": "~3.1.1",
|
||||
"behat/behat": "2.4.*@stable"
|
||||
"lmc/steward": "^2.2",
|
||||
"behat/behat": "^3.3",
|
||||
"behat/mink-selenium2-driver": "^1.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
|
||||
2939
composer.lock
generated
2939
composer.lock
generated
File diff suppressed because it is too large
Load Diff
152
features/bootstrap/Browser.php
Normal file
152
features/bootstrap/Browser.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
use Behat\Mink\Session;
|
||||
|
||||
/**
|
||||
* Window
|
||||
*/
|
||||
class Browser extends Session
|
||||
{
|
||||
/**
|
||||
* Time to wait before use after selecting an element.
|
||||
* To avoid click or get information about an element that
|
||||
* is still beeing proceesed by javascript.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $waitForJavascriptProcessing=500;
|
||||
|
||||
/**
|
||||
* Get an element by id.
|
||||
*
|
||||
* @param string $id
|
||||
* @return \Behat\Mink\Element\NodeElement
|
||||
*/
|
||||
public function getElementByXpath($xpath, $wait = true)
|
||||
{
|
||||
$wait ? $this->waitFor($xpath) : null;
|
||||
$found = $this->getDriver()->find($xpath);
|
||||
return $found ? $found[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an element by id.
|
||||
*
|
||||
* @param string $id
|
||||
* @return \Behat\Mink\Element\NodeElement
|
||||
*/
|
||||
public function getElementById($id, $wait = true)
|
||||
{
|
||||
$xpath = "//*[@id=".
|
||||
$this->encodeXpathString($id).
|
||||
"]";
|
||||
$wait ? $this->waitFor($xpath) : null;
|
||||
$found = $this->getDriver()->find($xpath);
|
||||
return $found ? $found[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the elements that contains and specific text.
|
||||
*
|
||||
* @param string $textContent
|
||||
* @return \Behat\Mink\Element\NodeElement[]
|
||||
*/
|
||||
public function getElementsByTextContent(
|
||||
$textContent,
|
||||
$base = '//*',
|
||||
$wait = true
|
||||
) {
|
||||
$xpath = $base.
|
||||
"[contains(., ".
|
||||
$this->encodeXpathString($textContent).
|
||||
")]";
|
||||
$wait ? $this->waitFor($xpath) : null;
|
||||
return $this->getDriver()->find($xpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes and string to be used inside an xpath expression.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function encodeXpathString($string)
|
||||
{
|
||||
if (strpos($string, '"') !== false && strpos($string, "'") !== false) {
|
||||
$parts = preg_split(
|
||||
'/(\'|")/', $string, -1,
|
||||
PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
|
||||
);
|
||||
$encoded = [];
|
||||
foreach ($parts as $str) {
|
||||
$encoded[] = $this->encodeXpathString($str);
|
||||
}
|
||||
return 'concat('.implode(',', $encoded).')';
|
||||
} elseif (strpos($string, '"') !== false) {
|
||||
return "'".$string."'";
|
||||
} else {
|
||||
return '"'.$string.'"';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until elements defined with a xpath expression are present.
|
||||
*
|
||||
* @param string $xpath
|
||||
* @param int $time
|
||||
*/
|
||||
public function waitFor($xpath, $time = 5000)
|
||||
{
|
||||
$jxpath = json_encode($xpath);
|
||||
$condition = 'document.evaluate('.$jxpath.', document, null, XPathResult.ANY_TYPE, null).iterateNext()!==null';
|
||||
$this->wait($time, $condition);
|
||||
//Wait for javascript event handlers
|
||||
$this->wait($this->waitForJavascriptProcessing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last element that match a text.
|
||||
*
|
||||
* @param string $text
|
||||
* @return \Behat\Mink\Element\NodeElement
|
||||
*/
|
||||
public function getElementByTextContent($text, $cssClass = '')
|
||||
{
|
||||
if ($cssClass) {
|
||||
$base = '//*[contains(@class, '.$this->encodeXpathString($cssClass).')]';
|
||||
} else {
|
||||
$base = '//*';
|
||||
}
|
||||
$tags = $this->getElementsByTextContent($text, $base);
|
||||
return $tags ? $tags[count($tags) - 1] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last element that match a text.
|
||||
*
|
||||
* @param string $text
|
||||
* @return \Behat\Mink\Element\NodeElement
|
||||
*/
|
||||
public function getElementByValue($selector, $value)
|
||||
{
|
||||
$base = '//'.$selector;
|
||||
$tags = $this->getDriver()->find($base);
|
||||
$regexp = '/'.str_replace('\*', '.*', preg_quote($value, '/')).'/';
|
||||
foreach ($tags as $tag) {
|
||||
if (preg_match($regexp, $tag->getValue())) {
|
||||
return $tag;
|
||||
}
|
||||
}
|
||||
return $tags ? $tags[count($tags)-1] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Session ID of WebDriver or `null`, when session not started yet.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getWebDriverSessionId()
|
||||
{
|
||||
return $this->getDriver()->getWebDriverSessionId();
|
||||
}
|
||||
}
|
||||
@@ -1,67 +1,248 @@
|
||||
<?php
|
||||
|
||||
use Behat\Behat\Context\ClosuredContextInterface,
|
||||
Behat\Behat\Context\TranslatedContextInterface,
|
||||
Behat\Behat\Context\BehatContext,
|
||||
Behat\Behat\Exception\PendingException;
|
||||
use Behat\Gherkin\Node\PyStringNode,
|
||||
Behat\Gherkin\Node\TableNode;
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\AfterScenarioScope;
|
||||
|
||||
require 'config.php';
|
||||
|
||||
//
|
||||
// Require 3rd-party libraries here:
|
||||
//
|
||||
// require_once 'PHPUnit/Autoload.php';
|
||||
// require_once 'PHPUnit/Framework/Assert/Functions.php';
|
||||
//
|
||||
require_once 'config.php';
|
||||
/**
|
||||
* Features context.
|
||||
* Defines application features from the specific context.
|
||||
*/
|
||||
class FeatureContext extends BehatContext
|
||||
class FeatureContext extends WorkflowTestCase implements Context
|
||||
{
|
||||
/**
|
||||
* Initializes context.
|
||||
* Every scenario gets it's own context object.
|
||||
*
|
||||
* @param array $parameters context parameters (set them up through behat.yml)
|
||||
* @var Browser $browser
|
||||
*/
|
||||
public function __construct(array $parameters)
|
||||
protected $browser;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string $clipboard
|
||||
*/
|
||||
protected $clipboard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array $parameters
|
||||
*/
|
||||
protected $parameters;
|
||||
|
||||
/**
|
||||
* Initializes context.
|
||||
*
|
||||
* Every scenario gets its own context instance.
|
||||
* You can also pass arbitrary arguments to the
|
||||
* context constructor through behat.yml.
|
||||
*/
|
||||
public function __construct($parameters)
|
||||
{
|
||||
// Initialize your context here
|
||||
$this->useContext('RestContext', new RestContext($parameters));
|
||||
$this->parameters = $parameters;
|
||||
}
|
||||
|
||||
/** @AfterScenario */
|
||||
public function after(AfterScenarioScope $scope)
|
||||
{
|
||||
//Close the browser if it was opened.
|
||||
$this->closeTheBrowser();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^I run "([^"]*)"$/
|
||||
* @Given a new workspace
|
||||
*/
|
||||
public function iRun($command)
|
||||
public function aNewWorkspace()
|
||||
{
|
||||
exec($command, $result);
|
||||
$this->output = $result;
|
||||
|
||||
$this->setupDB();
|
||||
$this->installLicense(__DIR__.'/../resources/license_*.dat');
|
||||
$this->config(['CFG_UID' => 'getStarted', 'CFG_VALUE' => '1']);
|
||||
$this->setTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY',
|
||||
'ID_INVALID_VALUE_CAN_NOT_BE_EMPTY({0})');
|
||||
$this->setTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED',
|
||||
'ID_UNDEFINED_VALUE_IS_REQUIRED({0})');
|
||||
$this->setTranslation('ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST',
|
||||
'ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST({0})');
|
||||
$this->setTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES',
|
||||
'ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES({0},{1})');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^I should see the file "([^"]*)"$/
|
||||
* @Then Config env.ini with :arg1
|
||||
*/
|
||||
public function iShouldSeeTheFile($fileName)
|
||||
public function configEnvIniWith($arg1)
|
||||
{
|
||||
if (!in_array($fileName, $this->output)) {
|
||||
throw new Exception('File named ' . $fileName . ' not found!');
|
||||
$args = explode("=", $arg1);
|
||||
$name = trim($args[0]);
|
||||
$value = isset($args[1]) ? trim($args[1]) : '';
|
||||
$this->setEnvIni($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Config env.ini without :arg1
|
||||
*/
|
||||
public function configEnvIniWithout($arg1)
|
||||
{
|
||||
$this->unsetEnvIni($arg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given Import process :arg1
|
||||
*/
|
||||
public function importProcess($arg1)
|
||||
{
|
||||
$this->import(__DIR__.'/../resources/'.$arg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Go to Processmaker login
|
||||
*/
|
||||
public function goToProcessmakerLogin()
|
||||
{
|
||||
$session = $this->browser;
|
||||
$session->visit($this->getBaseUrl('login/login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Login as :arg1 :arg2
|
||||
*/
|
||||
public function loginAs($arg1, $arg2)
|
||||
{
|
||||
$session = $this->browser;
|
||||
$username = $session->getElementById('form[USR_USERNAME]');
|
||||
$username->setValue('admin');
|
||||
$password = $session->getElementById('form[USR_PASSWORD_MASK]');
|
||||
$password->setValue('admin');
|
||||
$submit = $session->getElementById('form[BSUBMIT]');
|
||||
$submit->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When Inside :arg1
|
||||
*/
|
||||
public function inside($arg1)
|
||||
{
|
||||
$this->browser->switchToIFrame($arg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Copy :arg1 of :arg2
|
||||
*/
|
||||
public function copyOf($arg1, $arg2)
|
||||
{
|
||||
$element = $this->browser->getElementByXpath($arg2);
|
||||
$this->clipboard = $element->getAttribute($arg1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Double click on :arg1
|
||||
*/
|
||||
public function doubleClickOn($arg1)
|
||||
{
|
||||
$process = $this->browser->getElementByTextContent($arg1);
|
||||
$process->doubleClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Right click on :arg1
|
||||
*/
|
||||
public function rightClickOn($arg1)
|
||||
{
|
||||
$this->browser->getElementByTextContent($arg1)->rightClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Click on :arg1 inside :arg2
|
||||
*/
|
||||
public function clickOnInside($arg1, $arg2)
|
||||
{
|
||||
$this->browser->getElementByTextContent($arg1, $arg2)->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Copy value of :arg1 like :arg2
|
||||
*/
|
||||
public function copyValueOfLike($arg1, $arg2)
|
||||
{
|
||||
$this->clipboard = $this->browser->getElementByValue($arg1, $arg2)->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Logout Processmaker
|
||||
*/
|
||||
public function logoutProcessmaker()
|
||||
{
|
||||
$this->browser->visit($this->getBaseUrl('login/login'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then open url copied
|
||||
*/
|
||||
public function openUrlCopied()
|
||||
{
|
||||
$this->browser->visit($this->clipboard);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Verify the page does not redirect to the standard \/login\/login
|
||||
*/
|
||||
public function verifyThePageDoesNotRedirectToTheStandardLoginLogin()
|
||||
{
|
||||
$this->assertEquals($this->clipboard, $this->browser->getCurrentUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Verify the page goes to the WebEntry steps
|
||||
*/
|
||||
public function verifyThePageGoesToTheWebentrySteps()
|
||||
{
|
||||
$this->assertLessThan(count($this->browser->getElementsByTextContent('Next Step')), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then Open a browser
|
||||
*/
|
||||
public function openABrowser()
|
||||
{
|
||||
$this->browser = $this->openBrowser();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then close the browser
|
||||
*/
|
||||
public function closeTheBrowser()
|
||||
{
|
||||
if ($this->browser) {
|
||||
$sessionId = $this->browser->getWebDriverSessionId();
|
||||
$this->browser->wait(1000);
|
||||
$this->browser->stop();
|
||||
echo "Video available at:\n";
|
||||
echo $this->parameters['webDriverHost']."/grid/admin/HubVideoDownloadServlet?sessionId=".$sessionId;
|
||||
$this->browser = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Browser
|
||||
*/
|
||||
private function openBrowser()
|
||||
{
|
||||
$capabilities = $this->parameters['capabilities'];
|
||||
$capabilities['seleniumProtocol'] = "WebDriver";
|
||||
if (empty($capabilities['browserName'])) {
|
||||
$capabilities['browserName'] = 'chrome';
|
||||
}
|
||||
$driver = new \Behat\Mink\Driver\Selenium2Driver(
|
||||
$capabilities['browserName'],
|
||||
$capabilities,
|
||||
$this->parameters['webDriverHost'].'/wd/hub'
|
||||
);
|
||||
$session = new Browser($driver);
|
||||
$session->start();
|
||||
return $session;
|
||||
}
|
||||
|
||||
//
|
||||
// Place your definition and hook methods here:
|
||||
//
|
||||
// /**
|
||||
// * @Given /^I have done something with "([^"]*)"$/
|
||||
// */
|
||||
// public function iHaveDoneSomethingWith($argument)
|
||||
// {
|
||||
// doSomethingWith($argument);
|
||||
// }
|
||||
//
|
||||
public function __destruct()
|
||||
{
|
||||
$this->closeTheBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,3 +10,14 @@ $config = array (
|
||||
'refresh_token' => "ade174976fe77f12ecde7c9e1d8307ac495f443e",
|
||||
);
|
||||
|
||||
call_user_func(function() {
|
||||
$phpunit = new DOMDocument;
|
||||
$phpunit->load(__DIR__.'/../../phpunit.xml');
|
||||
|
||||
foreach($phpunit->getElementsByTagName('php') as $php) {
|
||||
foreach($php->getElementsByTagName('var') as $var) {
|
||||
$GLOBALS[$var->getAttribute("name")] = $var->getAttribute("value");
|
||||
}
|
||||
}
|
||||
});
|
||||
require __DIR__.'/../../tests/bootstrap.php';
|
||||
|
||||
922
features/resources/WebEntryEventTest.pmx
Normal file
922
features/resources/WebEntryEventTest.pmx
Normal file
File diff suppressed because it is too large
Load Diff
25
features/webentry2/webentry2.feature
Normal file
25
features/webentry2/webentry2.feature
Normal file
@@ -0,0 +1,25 @@
|
||||
Feature: WebEntry2
|
||||
PROD-181: As a process architect I want an option to force login on web
|
||||
entry forms so my users can start cases without having to go to the standard
|
||||
home/inbox section and without having to click "New Case."
|
||||
|
||||
Scenario: Test WebEntry2 when session_block=1
|
||||
Given a new workspace
|
||||
Then Import process "WebEntryEventTest.pmx"
|
||||
Then Config env.ini with "session_block=1"
|
||||
Then Open a browser
|
||||
Then Go to Processmaker login
|
||||
Then Login as "admin" "admin"
|
||||
When Inside "frameMain"
|
||||
Then Double click on "WebEntryEvent"
|
||||
Then Right click on "first"
|
||||
Then Click on "Web Entry" inside "menu"
|
||||
Then Click on "Link" inside "tab"
|
||||
Then Copy "href" of "//*[@id='webEntryLink']//a"
|
||||
Then Logout Processmaker
|
||||
Then Open URL copied
|
||||
Then Verify the page does not redirect to the standard /login/login
|
||||
When Inside "iframe"
|
||||
Then Login as "admin" "admin"
|
||||
Then Verify the page goes to the WebEntry steps
|
||||
Then close the browser
|
||||
21
phpunit.xml
21
phpunit.xml
@@ -20,11 +20,7 @@
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
|
||||
<directory suffix=".php">./workflow/engine/classes</directory>
|
||||
<!-- <directory suffix=".php">./workflow/engine/controllers</directory>
|
||||
<directory suffix=".php">./workflow/engine/methods</directory> -->
|
||||
<directory suffix=".php">./workflow/engine/src</directory>
|
||||
<!-- <directory suffix=".php">./gulliver/bin</directory> -->
|
||||
<!-- <directory suffix=".php">./gulliver/system</directory> -->
|
||||
</whitelist>
|
||||
<exclude>
|
||||
<directory>./workflow/engine/classes/model/map</directory>
|
||||
@@ -35,18 +31,19 @@
|
||||
</filter>
|
||||
|
||||
<php>
|
||||
<var name="SYS_SYS" value="os" />
|
||||
<var name="SYS_SYS" value="test" />
|
||||
<var name="SYS_LANG" value="en" />
|
||||
<var name="SYS_SKIN" value="classic" />
|
||||
<var name="SYS_SKIN" value="neoclassic" />
|
||||
<var name="DB_ADAPTER" value="mysql" />
|
||||
<var name="DB_HOST" value="localhost" />
|
||||
<var name="DB_HOST" value="processmaker3" />
|
||||
<var name="DB_NAME" value="wf_test" />
|
||||
<var name="DB_USER" value="root" />
|
||||
<var name="DB_PASS" value="" />
|
||||
<var name="PATH_DB" value="./test_shared/workflow_data/sites/" />
|
||||
<var name="PATH_DATA" value="./test_shared/workflow_data/" />
|
||||
<var name="APP_HOST" value="localhost" />
|
||||
<var name="DB_USER" value="paula" />
|
||||
<var name="DB_PASS" value="68M=muF@Xt,-vcN" />
|
||||
<var name="PATH_DB" value="./shared/sites/" />
|
||||
<var name="PATH_DATA" value="./shared/" />
|
||||
<var name="APP_HOST" value="processmaker3" />
|
||||
<var name="HTTPS" value="off" />
|
||||
<var name="SERVER_PORT" value="8080" />
|
||||
</php>
|
||||
|
||||
<logging>
|
||||
|
||||
@@ -26,6 +26,11 @@ class WorkflowTestCase extends TestCase
|
||||
$pdo->exec(file_get_contents(PATH_RBAC_CORE.'data/mysql/schema.sql'));
|
||||
$pdo->exec(file_get_contents(PATH_CORE.'data/mysql/insert.sql'));
|
||||
$pdo->exec(file_get_contents(PATH_RBAC_CORE.'data/mysql/insert.sql'));
|
||||
$pdo->exec("INSERT INTO `APP_SEQUENCE` (`ID`) VALUES ('1')");
|
||||
$pdo->exec("INSERT INTO `OAUTH_CLIENTS` (`CLIENT_ID`, `CLIENT_SECRET`, `CLIENT_NAME`, `CLIENT_DESCRIPTION`, `CLIENT_WEBSITE`, `REDIRECT_URI`, `USR_UID`) VALUES
|
||||
('x-pm-local-client', '179ad45c6ce2cb97cf1029e212046e81', 'PM Web Designer', 'ProcessMaker Web Designer App', 'www.processmaker.com', 'http://".$_SERVER["HTTP_HOST"].":".$_SERVER['SERVER_PORT']."/sys".SYS_SYS."/en/neoclassic/oauth2/grant', '00000000000000000000000000000001');");
|
||||
$pdo->exec("INSERT INTO `OAUTH_ACCESS_TOKENS` (`ACCESS_TOKEN`, `CLIENT_ID`, `USER_ID`, `EXPIRES`, `SCOPE`) VALUES
|
||||
('39704d17049f5aef45e884e7b769989269502f83', 'x-pm-local-client', '00000000000000000000000000000001', '2017-06-15 17:55:19', 'view_processes edit_processes *');");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,4 +119,81 @@ class WorkflowTestCase extends TestCase
|
||||
}
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set specific env.ini configuration.
|
||||
*
|
||||
* @param type $param
|
||||
* @param type $value
|
||||
*/
|
||||
protected function setEnvIni($param, $value)
|
||||
{
|
||||
$config = file_get_contents(PATH_CONFIG.'env.ini');
|
||||
if (substr($config, -1, 1) !== "\n") {
|
||||
$config.="\n";
|
||||
}
|
||||
$regexp = '/^\s*'.preg_quote($param).'\s*=\s*.*\n$/m';
|
||||
if (preg_match($regexp, $config."\n")) {
|
||||
if ($value === null) {
|
||||
$config = preg_replace($regexp, "", $config);
|
||||
} else {
|
||||
$value1 = is_numeric($value) ? $value : json_encode($value, true);
|
||||
$config = preg_replace($regexp, "$param = $value1\n", $config);
|
||||
}
|
||||
} elseif ($value !== null) {
|
||||
$value1 = is_numeric($value) ? $value : json_encode($value, true);
|
||||
$config.="$param = $value1\n";
|
||||
}
|
||||
file_put_contents(PATH_CONFIG.'env.ini', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset specific env.ini configuration.
|
||||
*
|
||||
* @param type $param
|
||||
*/
|
||||
protected function unsetEnvIni($param)
|
||||
{
|
||||
$this->setEnvIni($param, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installa an licese file.
|
||||
*
|
||||
* @param type $path
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function installLicense($path)
|
||||
{
|
||||
$licenseFile = glob($path);
|
||||
if (!$licenseFile) {
|
||||
throw new \Exception('To continue please put a valid license at features/resources');
|
||||
}
|
||||
G::LoadClass('pmLicenseManager');
|
||||
$licenseManager = new pmLicenseManager();
|
||||
$licenseManager->installLicense($licenseFile[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a PM configuration.
|
||||
*
|
||||
* @return \Configurations
|
||||
*/
|
||||
protected function config($config=[]){
|
||||
$configGetStarted = new \Configuration;
|
||||
$data = array_merge([
|
||||
'OBJ_UID' => '',
|
||||
'PRO_UID' => '',
|
||||
'USR_UID' => '',
|
||||
'APP_UID' => '',
|
||||
], $config);
|
||||
$configGetStarted->create($data);
|
||||
}
|
||||
|
||||
protected function getBaseUrl($url)
|
||||
{
|
||||
return (\G::is_https() ? "https://" : "http://").
|
||||
$GLOBALS["APP_HOST"].':'.$GLOBALS['SERVER_PORT']."/sys".SYS_SYS."/".
|
||||
SYS_LANG."/".SYS_SKIN."/".$url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ define('PATH_SEP', '/');
|
||||
if (!defined('__DIR__')) {
|
||||
define('__DIR__', dirname(__FILE__));
|
||||
}
|
||||
$_SERVER["HTTP_HOST"] = $GLOBALS['APP_HOST'];
|
||||
$_SERVER["HTTP_HOST"] = $GLOBALS['APP_HOST'].
|
||||
($GLOBALS['SERVER_PORT'] === '80' ? '' : ':'.$GLOBALS['SERVER_PORT']);
|
||||
$_SERVER['HTTPS'] = $GLOBALS['HTTPS'];
|
||||
$_SERVER['SERVER_PORT'] = $GLOBALS['SERVER_PORT'];
|
||||
|
||||
// Defining the Home Directory
|
||||
define('PATH_TRUNK', realpath(__DIR__.'/../').PATH_SEP);
|
||||
|
||||
@@ -36,6 +36,10 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
'ID_UNDEFINED_VALUE_IS_REQUIRED({0})');
|
||||
$this->setTranslation('ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST',
|
||||
'ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST({0})');
|
||||
$this->setTranslation('ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES',
|
||||
'ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES({0},{1})');
|
||||
$this->setTranslation('ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY',
|
||||
'ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY({0},{1})');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +62,7 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
$this->assertNotNull($entryEvents[0]['TAS_UID']);
|
||||
$this->assertNull($entryEvents[0]['WE_CUSTOM_TITLE']);
|
||||
$this->assertEquals($entryEvents[0]['WE_AUTHENTICATION'], 'ANONYMOUS');
|
||||
$this->assertEquals($entryEvents[0]['WE_HIDE_INFORMATION_BAR'], '0');
|
||||
$this->assertEquals($entryEvents[0]['WE_HIDE_INFORMATION_BAR'], '1');
|
||||
$this->assertEquals($entryEvents[0]['WE_CALLBACK'], 'PROCESSMAKER');
|
||||
$this->assertNull($entryEvents[0]['WE_CALLBACK_URL']);
|
||||
$this->assertEquals($entryEvents[0]['WE_LINK_GENERATION'], 'DEFAULT');
|
||||
@@ -76,7 +80,7 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
$this->assertCount(3, $entryEvents);
|
||||
$this->assertNull($entryEvents[0]['WE_CUSTOM_TITLE']);
|
||||
$this->assertEquals($entryEvents[0]['WE_AUTHENTICATION'], 'ANONYMOUS');
|
||||
$this->assertEquals($entryEvents[0]['WE_HIDE_INFORMATION_BAR'], '0');
|
||||
$this->assertEquals($entryEvents[0]['WE_HIDE_INFORMATION_BAR'], '1');
|
||||
$this->assertEquals($entryEvents[0]['WE_CALLBACK'], 'PROCESSMAKER');
|
||||
$this->assertNull($entryEvents[0]['WE_CALLBACK_URL']);
|
||||
$this->assertEquals($entryEvents[0]['WE_LINK_GENERATION'], 'DEFAULT');
|
||||
@@ -158,7 +162,6 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
$processUid,
|
||||
$entryEvents,
|
||||
[
|
||||
'WEE_URL' => $this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
|
||||
'WE_TYPE' => "MULTIPLE",
|
||||
'WE_CUSTOM_TITLE' => $this->customTitle,
|
||||
'WE_AUTHENTICATION' => 'ANONYMOUS',
|
||||
@@ -213,14 +216,11 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
$this->assertCount(1, $entryEvents);
|
||||
$rows = $this->getCombinationsFor([
|
||||
'WE_LINK_GENERATION' => ['DEFAULT', 'ADVANCED'],
|
||||
'WEE_URL' => [
|
||||
$this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
|
||||
null
|
||||
],
|
||||
'WEE_STATUS' => ['ENABLED', null],
|
||||
'WE_TYPE' => ['MULTIPLE'],
|
||||
'WE_LINK_SKIN' => [SYS_SKIN, null],
|
||||
'WE_LINK_LANGUAGE' => [SYS_LANG, null],
|
||||
'WE_LINK_SKIN' => [SYS_SKIN],
|
||||
'WE_LINK_LANGUAGE' => [SYS_LANG],
|
||||
'WE_LINK_DOMAIN' => ['domain.localhost'],
|
||||
]);
|
||||
$criteria = new \Criteria();
|
||||
$criteria->add(\BpmnEventPeer::PRJ_UID, $processUid);
|
||||
@@ -323,12 +323,11 @@ class WebEntryEventTest extends \WorkflowTestCase
|
||||
|
||||
$rows = $this->getCombinationsFor([
|
||||
'WE_LINK_GENERATION' => ['DEFAULT', 'ADVANCED'],
|
||||
'WEE_URL' => [
|
||||
$this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
|
||||
null
|
||||
],
|
||||
'DYN_UID' => $dynaformIds,
|
||||
'USR_UID' => [null, $this->adminUid, static::SKIP_VALUE],
|
||||
'WE_LINK_SKIN' => [SYS_SKIN],
|
||||
'WE_LINK_LANGUAGE' => [SYS_LANG],
|
||||
'WE_LINK_DOMAIN' => [$this->domain],
|
||||
]);
|
||||
foreach ($rows as $row) {
|
||||
try {
|
||||
|
||||
@@ -210,7 +210,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
||||
if (localStorage.weData) {
|
||||
try {
|
||||
weData = JSON.parse(localStorage.weData);
|
||||
if (weData.TAS_UID!==tasUid) {
|
||||
if (weData.TAS_UID!==tasUid || !weData.APPLICATION || !weData.INDEX) {
|
||||
//TAS_UID is different, reset.
|
||||
resetLocalData();
|
||||
}
|
||||
@@ -265,7 +265,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
||||
return new Promise(function (logged, failure) {
|
||||
if (!isLogged) {
|
||||
log("login");
|
||||
open('../login/login?u=' + encodeURIComponent(location.pathname + '/../../webentry/logged'))
|
||||
open('../login/login?inIFrame=1&u=' + encodeURIComponent(location.pathname + '/../../webentry/logged'))
|
||||
.then(function (userInformation) {
|
||||
logged(userInformation);
|
||||
})
|
||||
@@ -411,7 +411,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
||||
//This code is to prevent error at back history
|
||||
//in Firefox
|
||||
$("#iframe").hide();
|
||||
$("#iframe").attr("src", "../login/login");
|
||||
$("#iframe").attr("src", "../login/login?inIFrame=1");
|
||||
logout(false, function() {
|
||||
resolve(callbackUrl);
|
||||
});
|
||||
|
||||
@@ -534,6 +534,12 @@ class WebEntryEvent
|
||||
unset($arrayData["PRJ_UID"]);
|
||||
unset($arrayData["WEE_WE_UID"]);
|
||||
unset($arrayData["WEE_WE_TAS_UID"]);
|
||||
if (empty($arrayData["WE_LINK_SKIN"])) {
|
||||
unset($arrayData["WE_LINK_SKIN"]);
|
||||
}
|
||||
if (empty($arrayData["WE_LINK_LANGUAGE"])) {
|
||||
unset($arrayData["WE_LINK_LANGUAGE"]);
|
||||
}
|
||||
|
||||
if (!isset($arrayData["WEE_DESCRIPTION"])) {
|
||||
$arrayData["WEE_DESCRIPTION"] = "";
|
||||
@@ -678,7 +684,8 @@ class WebEntryEvent
|
||||
$task = new \Tasks();
|
||||
|
||||
//Task - Step for WE_TYPE=SINGLE
|
||||
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"] && $arrayData["WE_TYPE"]==='SINGLE') {
|
||||
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"] &&
|
||||
((isset($arrayData["WE_TYPE"]) && $arrayData["WE_TYPE"]==='SINGLE') || ($arrayWebEntryEventData["WE_TYPE"]==='SINGLE'))) {
|
||||
//Delete
|
||||
$step = new \Step();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ SELECT LANG_ID, LANG_NAME FROM langOptions
|
||||
<JS type="javascript"><![CDATA[
|
||||
|
||||
//validate iframe login
|
||||
if(inIframe()) {
|
||||
if(inIframe() && (window.location.search.indexOf("inIFrame=1")===-1)) {
|
||||
if (PM.Sessions.getCookie('PM-TabPrimary') !== '101010010'
|
||||
&& (window.location.pathname.indexOf("login/login") !== -1
|
||||
|| window.location.pathname.indexOf("sysLogin") !== -1)) {
|
||||
|
||||
@@ -30,7 +30,7 @@ SELECT LANG_ID, LANG_NAME FROM langOptions
|
||||
<JS type="javascript"><![CDATA[
|
||||
|
||||
//validate iframe login
|
||||
if(inIframe()) {
|
||||
if(inIframe() && (window.location.search.indexOf("inIFrame=1")===-1)) {
|
||||
if (PM.Sessions.getCookie('PM-TabPrimary') !== '101010010'
|
||||
&& (window.location.pathname.indexOf("login/login") !== -1
|
||||
|| window.location.pathname.indexOf("sysLogin") !== -1)) {
|
||||
|
||||
Reference in New Issue
Block a user