-
Notifications
You must be signed in to change notification settings - Fork 3
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 #19 from genuineq/master
Fixes: Gift wrapping cost change in One Page Checkout mode & Decimals update
- Loading branch information
Showing
29 changed files
with
5,009 additions
and
74 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,44 @@ | ||
# to use orbs, must use version >= 2.1 | ||
version: 2.1 | ||
orbs: | ||
# import Cypress orb by specifying an exact version x.y.z | ||
# or the latest version 1.x.x using "@1" syntax | ||
cypress: cypress-io/cypress@1 | ||
workflows: | ||
build: | ||
jobs: | ||
# "cypress" is the name of the imported orb | ||
# "run" is the name of the job defined in Cypress orb | ||
- cypress/run: | ||
name: Run_QUICK_tests | ||
context: | ||
- paylike | ||
spec: cypress/integration/quick_test.js | ||
filters: | ||
branches: | ||
only: | ||
- cypress_tests | ||
- cypress/run: | ||
name: Run_FULL_tests | ||
requires: | ||
- Run_QUICK_tests | ||
context: | ||
- paylike | ||
spec: cypress/integration/full_test.js | ||
filters: | ||
branches: | ||
only: | ||
- cypress_tests | ||
# the following must run after all test passed | ||
# to show latest supported version in repository readme.md file | ||
- cypress/run: | ||
name: Run_LOG_VERSION_remotely | ||
requires: | ||
- Run_FULL_tests | ||
context: | ||
- paylike | ||
spec: cypress/integration/log_version.js | ||
filters: | ||
branches: | ||
only: | ||
- cypress_tests |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.idea | ||
.DS_Store | ||
.DS_Store | ||
node_modules | ||
cypress.env.json |
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,51 @@ | ||
#Testing with Cypress | ||
|
||
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 framework/shop installation is required, in which you need to have the sample theme installed and products displayed on the homepage. | ||
* 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 an account with previous purchases for which you set the credentials in the `cypress.env.json` file | ||
* *For testing purpose, product stock management and sending order emails need to be disabled (if applicable).* | ||
|
||
## Getting started | ||
|
||
1. Run following commands into plugin folder (as 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, // 'true' if you have HTTP auth when accessing website | ||
"ENV_HTTP_USER": "", // if you have HTTP auth when accessing website | ||
"ENV_HTTP_PASS": "", | ||
"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 framework/shop & paylike module versions | ||
"ENV_CURRENCY_TO_CHANGE_WITH": "USD", | ||
"ENV_CURRENCIES_TO_TEST": ["USD", "EUR"], // currencies used to make payments with in Full test | ||
"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. |
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,16 @@ | ||
{ | ||
"ENV_HTTP_AUTH_ENABLED": false, | ||
"ENV_HTTP_USER": "", | ||
"ENV_HTTP_PASS": "", | ||
"ENV_ADMIN_URL": "", | ||
"ENV_CLIENT_USER": "", | ||
"ENV_CLIENT_PASS": "", | ||
"ENV_ADMIN_USER": "", | ||
"ENV_ADMIN_PASS": "", | ||
"REMOTE_LOG_URL": "", | ||
"ENV_CURRENCY_TO_CHANGE_WITH": "USD", | ||
"ENV_CURRENCIES_TO_TEST": ["USD", "EUR"], | ||
"ENV_CARD_NUMBER": 4100000000000000, | ||
"ENV_CARD_EXPIRY": 1226, | ||
"ENV_CARD_CVV": 654 | ||
} |
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 @@ | ||
{} |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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,60 @@ | ||
/// <reference types="cypress" /> | ||
|
||
'use strict'; | ||
|
||
import { TestMethods } from '../support/test_methods.js'; | ||
|
||
describe('paylike plugin full test', () => { | ||
/** | ||
* Login into admin and frontend to store cookies. | ||
*/ | ||
before(() => { | ||
TestMethods.loginIntoClientAccount(); | ||
TestMethods.loginIntoAdminBackend(); | ||
}); | ||
|
||
/** | ||
* Run this on every test case bellow | ||
* - preserve cookies between tests | ||
*/ | ||
beforeEach(() => { | ||
Cypress.Cookies.defaults({ | ||
preserve: (cookie) => { | ||
return true; | ||
} | ||
}); | ||
}); | ||
|
||
let captureModes = ['Instant', 'Delayed']; | ||
let currenciesToTest = Cypress.env('ENV_CURRENCIES_TO_TEST'); | ||
|
||
context(`make payments in "${captureModes[0]}" mode`, () => { | ||
/** Modify Paylike settings. */ | ||
it(`change Paylike capture mode to "${captureModes[0]}"`, () => { | ||
TestMethods.changePaylikeCaptureMode(captureModes[0]); | ||
}); | ||
|
||
/** Make Instant payments */ | ||
for (var currency of currenciesToTest) { | ||
TestMethods.payWithSelectedCurrency(currency, 'refund'); | ||
} | ||
}); | ||
|
||
context(`make payments in "${captureModes[1]}" mode`, () => { | ||
/** Modify Paylike settings. */ | ||
it(`change Paylike capture mode to "${captureModes[1]}"`, () => { | ||
TestMethods.changePaylikeCaptureMode(captureModes[1]); | ||
}); | ||
|
||
for (var currency of currenciesToTest) { | ||
/** | ||
* HARDCODED currency | ||
*/ | ||
if ('USD' == currency || 'RON' == currency) { | ||
TestMethods.payWithSelectedCurrency(currency, 'capture'); | ||
/** In "delayed" mode we check "void" action too. */ | ||
TestMethods.payWithSelectedCurrency(currency, 'void'); | ||
} | ||
} | ||
}); | ||
}); // describe |
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,19 @@ | ||
/// <reference types="cypress" /> | ||
|
||
'use strict'; | ||
|
||
import { TestMethods } from '../support/test_methods.js'; | ||
|
||
describe('paylike plugin version log remotely', () => { | ||
/** | ||
* Go to backend site admin | ||
*/ | ||
before(() => { | ||
TestMethods.loginIntoAdminBackend(); | ||
}); | ||
|
||
/** Send log after full test finished. */ | ||
it('log shop & paylike versions remotely', () => { | ||
TestMethods.logVersions(); | ||
}); | ||
}); // describe |
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,58 @@ | ||
/// <reference types="cypress" /> | ||
|
||
'use strict'; | ||
|
||
import { TestMethods } from '../support/test_methods.js'; | ||
|
||
describe('paylike plugin quick test', () => { | ||
/** | ||
* Login into admin and frontend to store cookies. | ||
*/ | ||
before(() => { | ||
TestMethods.loginIntoClientAccount(); | ||
TestMethods.loginIntoAdminBackend(); | ||
}); | ||
|
||
/** | ||
* Run this on every test case bellow | ||
* - preserve cookies between tests | ||
*/ | ||
beforeEach(() => { | ||
Cypress.Cookies.defaults({ | ||
preserve: (cookie) => { | ||
return true; | ||
} | ||
}); | ||
}); | ||
|
||
let currency = Cypress.env('ENV_CURRENCY_TO_CHANGE_WITH'); | ||
let captureMode = 'Delayed'; | ||
|
||
/** | ||
* Modify Paylike capture mode | ||
*/ | ||
it('modify Paylike settings for capture mode', () => { | ||
TestMethods.changePaylikeCaptureMode(captureMode); | ||
}); | ||
|
||
/** Pay and process order. */ | ||
/** Capture */ | ||
TestMethods.payWithSelectedCurrency(currency, 'capture'); | ||
|
||
/** Refund last created order (previously captured). */ | ||
it('Process last order captured from admin panel to be refunded', () => { | ||
TestMethods.processOrderFromAdmin('refund', currency); | ||
}); | ||
|
||
/** Capture */ | ||
TestMethods.payWithSelectedCurrency(currency, 'capture'); | ||
|
||
/** Partial refund last created order (previously captured). */ | ||
it('Process last order captured from admin panel to be refunded', () => { | ||
TestMethods.processOrderFromAdmin('refund', currency, /*partialAmount*/ true); | ||
}); | ||
|
||
/** Void */ | ||
TestMethods.payWithSelectedCurrency(currency, 'void'); | ||
|
||
}); // describe |
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,22 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
// eslint-disable-next-line no-unused-vars | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
Oops, something went wrong.