This repository has been archived by the owner on Nov 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c6b566
commit 5c8d2ab
Showing
27 changed files
with
3,762 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
language: php | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
services: | ||
- mysql | ||
|
||
php: | ||
- 5.6 | ||
|
||
env: | ||
- WP_VERSION=latest WP_MULTISITE=0 | ||
|
||
# before_install: | ||
# - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config | ||
# - openssl aes-256-cbc -K $encrypted_ffa6df0139c0_key -iv $encrypted_ffa6df0139c0_iv -in git_key.txt.enc -out git_key -d | ||
|
||
install: | ||
- wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar | ||
|
||
before_script: | ||
- sudo apt-get update | ||
- sudo apt-get install apache2 libapache2-mod-fastcgi | ||
# enable php-fpm | ||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf | ||
- sudo a2enmod rewrite actions fastcgi alias | ||
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini | ||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm | ||
# configure apache virtual hosts | ||
- echo "$(curl -fsSL https://gist.github.com/rahularyan/5b179508f63cebbce486/raw/gistfile1.txt)" | sed -e "s,PATH,`pwd`/www,g" | sudo tee /etc/apache2/sites-available/default > /dev/null | ||
- echo "127.0.0.1 wptest.localhost" | sudo tee -a /etc/hosts | ||
- sudo service apache2 restart | ||
- sudo apt-get install git | ||
- wget http://codeception.com/codecept.phar | ||
- sudo curl -LsS http://codeception.com/codecept.phar -o /usr/local/bin/codecept | ||
- sudo chmod a+x /usr/local/bin/codecept | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- java -jar selenium-server-standalone-2.42.2.jar -port 4444 -Djava.security.egd=file:///dev/urandom switch > /dev/null & | ||
- sleep 5 | ||
- bash tests/bin/install.sh wptest root '' localhost $WP_VERSION | ||
|
||
script: codecept run --steps | ||
|
||
after_failure: | ||
- bash tests/bin/upload.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
actor: Tester | ||
paths: | ||
tests: tests | ||
log: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
settings: | ||
bootstrap: _bootstrap.php | ||
colors: true | ||
memory_limit: 1024M | ||
extensions: | ||
enabled: | ||
- Codeception\Extension\RunFailed | ||
modules: | ||
config: | ||
Db: | ||
dsn: '' | ||
user: '' | ||
password: '' | ||
dump: tests/_data/dump.sql | ||
coverage: | ||
enabled: true | ||
exclude: | ||
- tests/* | ||
- node_modules/* | ||
- build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
// This is global bootstrap for autoloading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Replace this file with actual dump of your database */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* Inherited Methods | ||
* | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class AcceptanceTester extends \Codeception\Actor | ||
{ | ||
use _generated\AcceptanceTesterActions; | ||
|
||
public $admin_username = 'admin'; | ||
public $admin_password = 'admin'; | ||
public $users = array( 'user1', 'user2', 'user3', 'user4' ); | ||
public $questions = array( 'question1' => 'This is question 1' ); | ||
public $answers = array( | ||
'answer1' => 'This is an interesting answer on question 1. Hope this will work.', | ||
'answer2' => 'This is an interesting question again for question 1. Hope this will work as well.', | ||
); | ||
public $comment = array( | ||
'comment1' => 'This is an awesome comment on question1. I like it. Nam hendrerit lacinia vulputate.', | ||
'comment2' => 'This is an awesome comment on answer1. I like it.', | ||
'comment3' => 'This is an awesome comment on answer1 again.. Maann..!! its gonna be super cool.', | ||
); | ||
|
||
/** | ||
* Login a user by user login and password. | ||
* @param string $name User login. | ||
* @param string $password User password. | ||
*/ | ||
public function login($name, $password) { | ||
$this->amOnPage('/wp-login.php' ); | ||
$this->fillField('Username', $name ); | ||
$this->fillField('Password', $password ); | ||
$this->click('Log In' ); | ||
//$this->see('Welcome to WordPress!' ); | ||
} | ||
|
||
/** | ||
* Login as an admin | ||
*/ | ||
public function loginAsAdmin() { | ||
$this->login($this->admin_username, $this->admin_password ); | ||
} | ||
|
||
/** | ||
* Switch logged in user. | ||
* @param string $name User login. | ||
* @param string $password User password. | ||
*/ | ||
public function switch_user( $name, $password ) { | ||
//$this->amOnPage('/wp-admin' ); | ||
//$loutput_button = $I->executeJS('return jQuery(".wp-admin-bar-logout").length > 0'); | ||
//concept_debug($loutput_button); | ||
/*if ( $loutput_button ) { | ||
$this->click( 'Log Out', '.ab-item' ); | ||
}*/ | ||
$this->login( $name, $password ); | ||
} | ||
|
||
public function amOnPluginPage() { | ||
$this->amOnPage('/wp-admin/plugins.php' ); | ||
} | ||
|
||
public function fillTinyMceEditorById($id, $content) { | ||
$this->fillTinyMceEditor('id', $id, $content ); | ||
} | ||
|
||
public function fillTinyMceEditorByName($name, $content) { | ||
$this->fillTinyMceEditor('name', $name, $content ); | ||
} | ||
|
||
private function fillTinyMceEditor($attribute, $value, $content) { | ||
$this->fillRteEditor( | ||
\Facebook\WebDriver\WebDriverBy::xpath( | ||
'//textarea[@' . $attribute . '=\'' . $value . '\']/../div[contains(@class, \'mce-tinymce\')]//iframe' | ||
), | ||
$content | ||
); | ||
} | ||
|
||
private function fillRteEditor($selector, $content) { | ||
$this->executeInSelenium( | ||
function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) | ||
use ($selector, $content) { | ||
$webDriver->switchTo()->frame( | ||
$webDriver->findElement($selector ) | ||
); | ||
|
||
$webDriver->executeScript( | ||
'arguments[0].innerHTML = "' . addslashes($content ) . '"', | ||
[ $webDriver->findElement(\Facebook\WebDriver\WebDriverBy::tagName('body' ) ) ] | ||
); | ||
|
||
$webDriver->switchTo()->defaultContent(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class FunctionalTester extends \Codeception\Actor | ||
{ | ||
use _generated\FunctionalTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Helper; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class Acceptance extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Helper; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class Functional extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Helper; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class Unit extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class UnitTester extends \Codeception\Actor | ||
{ | ||
use _generated\UnitTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
Oops, something went wrong.