Skip to content

Commit

Permalink
Merge pull request #3 from ionutcalara/master
Browse files Browse the repository at this point in the history
Add tests
  • Loading branch information
ionutcalara authored Sep 30, 2020
2 parents 7e4f4dc + 9329e2a commit e522c7f
Show file tree
Hide file tree
Showing 19 changed files with 5,339 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .gitignore
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
45 changes: 45 additions & 0 deletions .travis.yml
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"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ZenCart plugin for Paylike
# ZenCart plugin for Paylike

This plugin is *not* developed or maintained by Paylike but kindly made
available by a user.

Released under the GPL V3 license: https://opensource.org/licenses/GPL-3.0


## Supported Zen Cart versions
## Supported Zen Cart versions [![Last succesfull test](https://log.derikon.ro/api/v1/log/read?tag=zencart&view=svg&label=ZenCart&key=ecommerce&background=FF7A00)](https://log.derikon.ro/api/v1/log/read?tag=cubecart&view=html)

*The plugin has been tested with v1.5.6.a. This release is a beta release, extensive testing please test in a staging environment before you use it in production*
*The plugin has been tested with most versions of Zen Cart at every iteration. We recommend using the latest version of Zen Cart, but if that is not possible for some reason, test the plugin with your Zen Cart version and it would probably function properly.*


## Installation
Expand Down
33 changes: 33 additions & 0 deletions Testing.md
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.
32 changes: 32 additions & 0 deletions composer.json
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"
}
}
}
Loading

0 comments on commit e522c7f

Please sign in to comment.