-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ionutcalara/master
Add tests
- Loading branch information
Showing
19 changed files
with
5,339 additions
and
4 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,8 @@ | ||
.idea | ||
.DS_Store | ||
.env | ||
.env.production | ||
/vendor | ||
!/*/vendor | ||
logs | ||
git-hooks |
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,45 @@ | ||
language: php | ||
dist: xenial | ||
php: | ||
- 7.2 | ||
addons: | ||
chrome: stable | ||
artifacts: | ||
debug: true | ||
env: | ||
global: | ||
- USE_STEWARD_MASTER=1 | ||
- SELENIUM_SERVER_VERSION="3.8.1" | ||
- CHROMEDRIVER_VERSION="2.40" | ||
matrix: | ||
- BROWSER=chrome | ||
install: | ||
- composer install --no-interaction | ||
- SELENIUM_PATH=$(./vendor/bin/steward install $SELENIUM_SERVER_VERSION --no-interaction) | ||
- echo "Selenium server path:" $SELENIUM_PATH | ||
- if [ "$BROWSER" = "chrome" ]; then mkdir chromedriver; wget -q -t 3 https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip; | ||
unzip chromedriver_linux64 -d chromedriver; fi | ||
- if [ "$BROWSER" = "chrome" ]; then export CHROMEDRIVER_PATH=./chromedriver/chromedriver; | ||
fi | ||
before_script: | ||
- java -jar $SELENIUM_PATH -role hub -enablePassThrough false -log selenium-server.log | ||
& | ||
- until $(echo | nc localhost 4444); do sleep 1; echo Waiting for selenium-server | ||
to start...; done; | ||
- if [ "$BROWSER" = "chrome" ]; then java -Dwebdriver.chrome.driver="$CHROMEDRIVER_PATH" | ||
-jar $SELENIUM_PATH -role node -port 8910 -log selenium-node-1.log -enablePassThrough | ||
false & fi | ||
- sleep 3 | ||
script: | ||
- ./vendor/bin/steward run staging $BROWSER --group="zencart_quick_test" -vv | ||
after_success: | ||
- "./vendor/bin/steward results -vvv" | ||
- ./vendor/bin/steward run staging $BROWSER --group="zencart_full_test" -vv | ||
- "./vendor/bin/steward results -vvv" | ||
- ./vendor/bin/steward run staging $BROWSER --group="zencart_version_log" -vv | ||
- "./vendor/bin/steward results -vvv" | ||
after_script: | ||
- "./vendor/bin/steward results -vvv" | ||
cache: | ||
directories: | ||
- "$HOME/.composer/cache" |
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
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,33 @@ | ||
#Testing | ||
|
||
As you can see the plugin is bundled with selenium testing on this repository. You can use the tests, if you have some experience with testing it could be helpful. | ||
*DO NOT USE IN PRODUCTION, THE TESTS MODIFY SETTINGS AND CREATE ORDERS* | ||
|
||
## Requirements | ||
|
||
* A ZenCart installation is required on ZenCart | ||
* You also need to have a test client account with previous purchases and an admin account for which you set the credentials in the .env file | ||
* Lastly you need to have the currency selector available on the frontend with all the currencies that are tested enabled | ||
* Make sure that the product at /index.php?main_page=product_info&cPath=1_5&products_id=27 has enough stock and is a simple product | ||
|
||
## Getting started | ||
|
||
1. Follow 1 and 2 from the [Steward readme page](https://github.com/lmc-eu/steward#getting-started) | ||
2. Create an env file in the root folder and add the following: | ||
` | ||
ENVIRONMENT_URL="https://zencart.url" | ||
ENVIRONMENT_USER="username" | ||
ENVIRONMENT_PASS="yourpassword" | ||
ENVIRONMENT_CLIENT_USER="client_email" | ||
ENVIRONMENT_CLIENT_PASS="client_pass" | ||
ADMIN_PREFIX="admin251j3cm2b" | ||
` | ||
|
||
3. Start the testing server. See | ||
[Steward readme page](https://github.com/lmc-eu/steward#4-run-your-tests) | ||
4. Run ./vendor/bin/steward run staging chrome --group="zencart_test" -vv for the short test | ||
5. Run ./vendor/bin/steward run staging chrome -vv to go through all the available tests. | ||
|
||
## Problems | ||
|
||
Since this is a frontend test, its not always consistent, due to delays or some glitches regarding overlapping elements. If you can't get over an issue please open an issue and I'll take a look. |
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,32 @@ | ||
{ | ||
"name": "paylike/plugin-zencart", | ||
"description": "Paylike zencart gateway development", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Ionut Calara", | ||
"email": "ionut.calara@gmail.com" | ||
} | ||
], | ||
"prefer-stable": true, | ||
"require": { | ||
"php": "^7.1", | ||
"lmc/steward": "dev-master", | ||
"vlucas/phpdotenv": "^2.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"ZenCart\\": "tests/", | ||
"Config\\": "config/" | ||
}, | ||
"files": [ | ||
"include/currencies.php", | ||
"include/beforeLoad.php" | ||
] | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.2" | ||
} | ||
} | ||
} |
Oops, something went wrong.