Use existing e2e environment config file

This commit is contained in:
Emili Castells Guasch 2023-02-27 11:39:30 +01:00
parent 9d460605a8
commit e9eba09ebb
5 changed files with 13 additions and 18 deletions

View file

@ -1 +1,10 @@
PPCP_E2E_WP_DIR=${ROOT_DIR}/.ddev/wordpress
BASEURL="http://example.com"
CUSTOMER_EMAIL="customer@example.com"
CUSTOMER_PASSWORD="password"
CREDIT_CARD_NUMBER="1234567890"
CREDIT_CARD_EXPIRATION="01/2042"
CREDIT_CARD_CVV="123"

View file

@ -1,8 +0,0 @@
BASEURL="http://example.com"
CUSTOMER_EMAIL="customer@example.com"
CUSTOMER_PASSWORD="password"
CREDIT_CARD_NUMBER="1234567890"
CREDIT_CARD_EXPIRATION="01/2042"
CREDIT_CARD_CVV="123"

View file

@ -1,8 +1,4 @@
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
require('dotenv').config();
require('dotenv').config({ path: '.env.e2e' });
const config = {
testDir: './tests/playwright',

View file

@ -3,7 +3,7 @@
## Local Environment Variables
Allows using environment variables inside the tests.
- Duplicate `.env.sample` and rename it as `.env`, set values and add new variables if needed.
- Duplicate `.env.e2e.example` and rename it as `.env.e2e`, set values and add new variables if needed.
## Run Tests
```

View file

@ -1,5 +1,3 @@
require('dotenv').config();
const {test, expect} = require('@playwright/test');
const {
CUSTOMER_EMAIL,
@ -20,7 +18,7 @@ async function fillCheckoutForm(page) {
await page.fill('#billing_email', CUSTOMER_EMAIL);
}
test('PayPal button place order from product page', async ({page}) => {
test('PayPal button place order from Product page', async ({page}) => {
await page.goto('/product/product/');
@ -48,7 +46,7 @@ test('PayPal button place order from product page', async ({page}) => {
await expect(title).toHaveText('Order received');
});
test('ACDC', async ({page}) => {
test('Advanced Credit and Debit Card (ACDC) place order from Checkout page', async ({page}) => {
await page.goto('/product/product/');
await page.locator('.single_add_to_cart_button').click();