Skip to content

Commit

Permalink
Merge pull request #8 from ionutcalara/update-tests
Browse files Browse the repository at this point in the history
Update tests
  • Loading branch information
ionutcalara authored Feb 7, 2022
2 parents b7e2cb7 + 64b51a4 commit c63c7f0
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 3,273 deletions.
76 changes: 52 additions & 24 deletions Testing.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,60 @@
#Testing
#Testing with Cypress

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*
As you can see the plugin is bundled with Cypress testing on this repository. You can use the tests, if you have some experience with testing.

***DO NOT USE IN PRODUCTION, THE TESTS MODIFY SETTINGS AND CREATE ORDERS***

## Requirements

* A hikashop installation is required, in which you need to have the sample theme installed and products displayed on the homepage.
* 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 and the cart module
* You need to have Paylike module installed and configured (**test keys** required)
* You need to have some other currencies configured in store, then set them in `cypress.env.json` file (these will be used to make payments with every currency specified)
* You also need to have a test client account with previous purchases and an admin account for which you set the credentials in the `cypress.env.json` file
* Lastly you need to have the some modules available on frontend
- login form
- hikashop currency switcher
- hikashop cart

## 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="http://joomla.box/hikashop"
ADMIN_PREFIX="administrator"
ENVIRONMENT_CLIENT_USER = client
ENVIRONMENT_CLIENT_PASS = "admin#522"
ENVIRONMENT_USER = "admin"
ENVIRONMENT_PASS = "admin"
`

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="hikashop_quick_test" -vv for the short test
5. Run ./vendor/bin/steward run staging chrome -vv to go trough 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.
1. Run following commands into hikashop plugin folder (as is in this repo)

```bash
npm install cypress --save-dev
```

2. Copy and rename `cypress.env.json.example` file in the root folder and fill the data as explained bellow:
```json
{
"ENV_HTTP_AUTH_ENABLED": false, // if you have HTTP auth when accessing website
"ENV_HTTP_USER": "", // if you have HTTP auth when accessing website
"ENV_HTTP_PASS": "",
"ENV_COOKIE_HASH": "", // name of the cookie (in Joomla it is a hash - it changes after each Joomla/Hikashop setup)
"ENV_STORE_URL": "", // http(s)://baseUrl
"ENV_ADMIN_URL": "", // like http(s)://baseUrl/administrator
"ENV_CLIENT_USER": "", // frontend user
"ENV_CLIENT_PASS": "",
"ENV_ADMIN_USER": "", // admin user
"ENV_ADMIN_PASS": "",
"REMOTE_LOG_URL": "", // if you want to send log information about hikashop/paylike versions
"ENV_CURRENCY_TO_CHANGE_WITH": "USD",
"ENV_CURRENCIES_TO_TEST": ["USD", "EUR"], // currencies used to make payments with in Full test
"ENV_CAPTURE_MODE": "Delayed", // Instant/Delayed (write with capital first letter )
"ENV_STOP_EMAIL": false, // if true => deactivate sending email on order creation / status change
"ENV_LOG_VERSION": false, // if true => send hikashop / paylike modules versions remotely
"ENV_SETTINGS_CHECK": false, // if true => change paylike capture mode as is specified in ENV_CAPTURE_MODE variable
"ENV_CARD_NUMBER": 4100000000000000,
"ENV_CARD_EXPIRY": 1226,
"ENV_CARD_CVV": 654
}
```
3. Start the Cypress testing server.
```bash
npx cypress open
```
4. In the interface, we can choose which test to run
## Getting 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 we'll take a look.
60 changes: 0 additions & 60 deletions TestingWithCypress.md

This file was deleted.

2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
All notable changes to this project will be documented in this file.


## 1.2.0 - 2022-01-11
## 4.3.0 - 2022-01-11
### Changed/Added
- Compatibility with Joomla 4 - removed JRequest class used in 'paylike/paylike.php' file & modified logic

Expand Down
32 changes: 0 additions & 32 deletions composer.json

This file was deleted.

Loading

0 comments on commit c63c7f0

Please sign in to comment.