Skip to content

Commit

Permalink
Update codebase to use 2 spaces in *.ts and *.json
Browse files Browse the repository at this point in the history
To stick with best practices for JavaScript related languages both the
TypeScript and JSON files are set to use two spaces instead of four.
This is also defined in the `.editorconfig` file so all systems will
handle this the same.
  • Loading branch information
ArjenMiedema committed Oct 28, 2024
1 parent c0fd2e2 commit 6c3766c
Show file tree
Hide file tree
Showing 30 changed files with 627 additions and 620 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{ts,json}]
indent_size = 2
457 changes: 228 additions & 229 deletions tests/base/account.spec.ts

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions tests/base/config/test-toggles.example.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"testForPageErrors": false,
"account": {
"testAccountCreation": false,
"testAccountLogin": true,
"testAccountPasswordChange": true,
"testAccountPageTitles":
{
"all": true,
"ProductReviewsTest": false
}
},
"minicart": {
"testCheckoutButton": true
"testForPageErrors": false,
"account": {
"testAccountCreation": false,
"testAccountLogin": true,
"testAccountPasswordChange": true,
"testAccountPageTitles": {
"all": true,
"ProductReviewsTest": false
}
}
},
"minicart": {
"testCheckoutButton": true
}
}
33 changes: 16 additions & 17 deletions tests/base/config/test-toggles.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"testForPageErrors": false,
"account": {
"testAccountCreation": false,
"testAccountLogin": true,
"testAccountPasswordChange": true,
"testAccountPageTitles":
{
"all": true,
"ProductReviewsTest": false
}
},
"minicart": {
"testMiniCartCheckoutButton": true,
"testMiniCartLink": true,
"testMiniCartQuantity": true,
"testMiniCartDeletion": true
"testForPageErrors": false,
"account": {
"testAccountCreation": false,
"testAccountLogin": true,
"testAccountPasswordChange": true,
"testAccountPageTitles": {
"all": true,
"ProductReviewsTest": false
}
}
},
"minicart": {
"testMiniCartCheckoutButton": true,
"testMiniCartLink": true,
"testMiniCartQuantity": true,
"testMiniCartDeletion": true
}
}
37 changes: 18 additions & 19 deletions tests/base/contact.spec.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
import { test, expect, selectors } from '@playwright/test';
import { PageTester } from './utils/PageTester';
import { Contact } from './utils/Contact';
import {test, expect, selectors} from '@playwright/test';
import {PageTester} from './utils/PageTester';
import {Contact} from './utils/Contact';
import slugs from './fixtures/before/slugs.json';
import contactSelector from './fixtures/during/selectors/contact.json';
import globalSelector from './fixtures/during/selectors/global.json';
import contactValue from './fixtures/during/input-values/contact.json';
import accountExpected from './fixtures/verify/expects/contact.json';

test.describe('Test user flow', () => {
test('Send contactform', async ({page}) => {
const randomNumber = Math.floor(Math.random() * 10000000);
const emailHandle = contactValue.contactEmailHandle;
const emailHost = contactValue.contactEmailHost;
const uniqueEmail = `${emailHandle}${randomNumber}@${emailHost}`;

test('Send contactform', async ({ page }) => {
const randomNumber = Math.floor(Math.random() * 10000000);
const emailHandle = contactValue.contactEmailHandle;
const emailHost = contactValue.contactEmailHost;
const uniqueEmail = `${emailHandle}${randomNumber}@${emailHost}`;
await page.goto(slugs.contactSlug);

await page.goto(slugs.contactSlug);
await page.fill(contactSelector.contactNameSelector, contactValue.contactName);
await page.fill(contactSelector.contactEmailSelector, uniqueEmail);
await page.fill(contactSelector.contactTelephoneSelector, contactValue.contactTelephoneNumber);
await page.fill(contactSelector.contactCommentSelector, contactValue.contactComment);

await page.fill(contactSelector.contactNameSelector, contactValue.contactName);
await page.fill(contactSelector.contactEmailSelector, uniqueEmail);
await page.fill(contactSelector.contactTelephoneSelector, contactValue.contactTelephoneNumber);
await page.fill(contactSelector.contactCommentSelector, contactValue.contactComment);
await page.click(contactSelector.contactButtonSelectorName);

await page.click(contactSelector.contactButtonSelectorName);
const contactFormSuccessNotificationText = accountExpected.contactFormSuccessNotificationText;
await expect(page.locator(`text=${contactFormSuccessNotificationText}`)).toBeVisible();

const contactFormSuccessNotificationText = accountExpected.contactFormSuccessNotificationText;
await expect(page.locator(`text=${contactFormSuccessNotificationText}`)).toBeVisible();

console.log(`Contact form submitted by email address "${uniqueEmail}"`);
});
console.log(`Contact form submitted by email address "${uniqueEmail}"`);
});
});
54 changes: 27 additions & 27 deletions tests/base/fixtures/before/slugs.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"homepageSlug": "/",
"categorySlug": "/women.html",
"simpleProductSlug": "/push-it-messenger-bag.html",
"configurableProductSlug": "/inez-full-zip-jacket.html",
"cartSlug": "/checkout/cart",
"checkoutSlug": "/checkout",
"searchSlug": "/catalogsearch/result/?q=search",
"loginSlug": "/customer/account/login/",
"forgotPasswordSlug": "/customer/account/forgotpassword/",
"accountCreationSlug": "/customer/account/create/",
"accountEditSlug": "/customer/account/edit/",
"afterAccountCreationSlug": "/customer/account/",
"afterLoginSlug": "/customer/account/",
"afterLogoutSlug": "/customer/account/logoutSuccess/",
"changePasswordSlug": "/customer/account/edit/changepass/",
"accountChangeInformationSlug": "/customer/account/edit/",
"accountAddressBookSlug": "/customer/address/",
"accountNewAddressSlug": "/customer/address/new/",
"accountOrderHistorySlug": "/sales/order/history/",
"accountDownloadsSlug": "/downloadable/customer/products/",
"accountWishlistSlug": "/wishlist/",
"accountSavedPaymentMethodsSlug": "vault/cards/listaction/",
"accountReviewsSlug": "/review/customer/",
"accountNewsletterSubscriptionsSlug": "/newsletter/manage/",
"contactSlug": "/contact/",
"productQuantityChangeSlug": "/checkout/cart/configure/id/"
}
"homepageSlug": "/",
"categorySlug": "/women.html",
"simpleProductSlug": "/push-it-messenger-bag.html",
"configurableProductSlug": "/inez-full-zip-jacket.html",
"cartSlug": "/checkout/cart",
"checkoutSlug": "/checkout",
"searchSlug": "/catalogsearch/result/?q=search",
"loginSlug": "/customer/account/login/",
"forgotPasswordSlug": "/customer/account/forgotpassword/",
"accountCreationSlug": "/customer/account/create/",
"accountEditSlug": "/customer/account/edit/",
"afterAccountCreationSlug": "/customer/account/",
"afterLoginSlug": "/customer/account/",
"afterLogoutSlug": "/customer/account/logoutSuccess/",
"changePasswordSlug": "/customer/account/edit/changepass/",
"accountChangeInformationSlug": "/customer/account/edit/",
"accountAddressBookSlug": "/customer/address/",
"accountNewAddressSlug": "/customer/address/new/",
"accountOrderHistorySlug": "/sales/order/history/",
"accountDownloadsSlug": "/downloadable/customer/products/",
"accountWishlistSlug": "/wishlist/",
"accountSavedPaymentMethodsSlug": "vault/cards/listaction/",
"accountReviewsSlug": "/review/customer/",
"accountNewsletterSubscriptionsSlug": "/newsletter/manage/",
"contactSlug": "/contact/",
"productQuantityChangeSlug": "/checkout/cart/configure/id/"
}
4 changes: 2 additions & 2 deletions tests/base/fixtures/before/websites.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"playwrightWebsite": "https://playwright.dev/"
}
"playwrightWebsite": "https://playwright.dev/"
}
36 changes: 18 additions & 18 deletions tests/base/fixtures/during/input-values/account.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"newAccountFirstName": "John",
"newAccountLastName": "Doe",
"newAccountEmailHandle": "test-user",
"newAccountEmailHost": "gmail.com",
"newAddressCompany": "ACME Company",
"newAddressTelephoneNumber": "0600000000",
"newAddressStreetAddress": "Teststraat 1",
"newAddressZipCode": "1234AA",
"newAddressCityName": "Testdam",
"newAddressProvinceValue": "1",
"newChangedAddressFirstName": "Jane",
"newChangedAddressLastName": "Dont",
"newChangedAddressCompany": "Disney Company",
"newChangedAddressTelephoneNumber": "0612345678",
"newChangedAddressStreetAddress": "Straat Der Testen 100",
"newChangedAddressZipCode": "4321 BB",
"newChangedAddressCityName": "Testdorp"
}
"newAccountFirstName": "John",
"newAccountLastName": "Doe",
"newAccountEmailHandle": "test-user",
"newAccountEmailHost": "gmail.com",
"newAddressCompany": "ACME Company",
"newAddressTelephoneNumber": "0600000000",
"newAddressStreetAddress": "Teststraat 1",
"newAddressZipCode": "1234AA",
"newAddressCityName": "Testdam",
"newAddressProvinceValue": "1",
"newChangedAddressFirstName": "Jane",
"newChangedAddressLastName": "Dont",
"newChangedAddressCompany": "Disney Company",
"newChangedAddressTelephoneNumber": "0612345678",
"newChangedAddressStreetAddress": "Straat Der Testen 100",
"newChangedAddressZipCode": "4321 BB",
"newChangedAddressCityName": "Testdorp"
}
12 changes: 6 additions & 6 deletions tests/base/fixtures/during/input-values/contact.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"contactName": "John Doe",
"contactEmailHandle": "test-user",
"contactEmailHost": "gmail.com",
"contactTelephoneNumber": "0600000000",
"contactComment": "Is this my question?"
}
"contactName": "John Doe",
"contactEmailHandle": "test-user",
"contactEmailHost": "gmail.com",
"contactTelephoneNumber": "0600000000",
"contactComment": "Is this my question?"
}
4 changes: 2 additions & 2 deletions tests/base/fixtures/during/input-values/search.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"searchProductName": "Bella Tank"
}
"searchProductName": "Bella Tank"
}
54 changes: 27 additions & 27 deletions tests/base/fixtures/during/selectors/account.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"registrationFirstNameSelector": "#firstname",
"registrationLastNameSelector": "#lastname",
"registrationEmailAddressSelector": "#email_address",
"registrationPasswordSelector": "#password",
"registrationConfirmPasswordSelector": "#password-confirmation",
"registrationCreateAccountButtonSelector": "button[title='Create an Account']",
"loginEmailAddressSelector": "#email",
"loginPasswordSelector": "#pass",
"loginButtonSelectorName": "button[name='send']",
"accountSaveButtonSelector": "button[title='Save']",
"logoutMenuItemPosition": 8,
"accountMenuItemsSelector": ".nav.items .nav.item a",
"changePasswordLabel": "#change-password",
"currentPasswordFieldSelector": "#current-password",
"newPasswordFieldSelector": "#current-password",
"accountAddressSaveButtonSelector": "button[title='Save Address']",
"accountTelephoneSelector": "#telephone",
"accountCompanySelector": "#company",
"accountStreetAddressSelector": "#street_1",
"accountZipSelector": "#zip",
"accountCitySelector": "#city",
"accountProvinceSelector": "select#region_id",
"accountAddAddressButton": "a.action.add",
"accountEditAddressButtons": "a.action.edit",
"accountDeleteAddressButtons": "a.action.delete",
"subscriptionCheckBoxSelector": "#subscription"
}
"registrationFirstNameSelector": "#firstname",
"registrationLastNameSelector": "#lastname",
"registrationEmailAddressSelector": "#email_address",
"registrationPasswordSelector": "#password",
"registrationConfirmPasswordSelector": "#password-confirmation",
"registrationCreateAccountButtonSelector": "button[title='Create an Account']",
"loginEmailAddressSelector": "#email",
"loginPasswordSelector": "#pass",
"loginButtonSelectorName": "button[name='send']",
"accountSaveButtonSelector": "button[title='Save']",
"logoutMenuItemPosition": 8,
"accountMenuItemsSelector": ".nav.items .nav.item a",
"changePasswordLabel": "#change-password",
"currentPasswordFieldSelector": "#current-password",
"newPasswordFieldSelector": "#current-password",
"accountAddressSaveButtonSelector": "button[title='Save Address']",
"accountTelephoneSelector": "#telephone",
"accountCompanySelector": "#company",
"accountStreetAddressSelector": "#street_1",
"accountZipSelector": "#zip",
"accountCitySelector": "#city",
"accountProvinceSelector": "select#region_id",
"accountAddAddressButton": "a.action.add",
"accountEditAddressButtons": "a.action.edit",
"accountDeleteAddressButtons": "a.action.delete",
"subscriptionCheckBoxSelector": "#subscription"
}
12 changes: 6 additions & 6 deletions tests/base/fixtures/during/selectors/contact.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"contactNameSelector": ".form.contact #name",
"contactEmailSelector": ".form.contact #email",
"contactTelephoneSelector": ".form.contact #telephone",
"contactCommentSelector": ".form.contact #comment",
"contactButtonSelectorName": ".form.contact button[type='submit']"
}
"contactNameSelector": ".form.contact #name",
"contactEmailSelector": ".form.contact #email",
"contactTelephoneSelector": ".form.contact #telephone",
"contactCommentSelector": ".form.contact #comment",
"contactButtonSelectorName": ".form.contact button[type='submit']"
}
4 changes: 2 additions & 2 deletions tests/base/fixtures/during/selectors/example.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"getStartedSelectorText": "Get started"
}
"getStartedSelectorText": "Get started"
}
6 changes: 3 additions & 3 deletions tests/base/fixtures/during/selectors/global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"mainColumn": ".column.main",
"successMessages": ".message.success"
}
"mainColumn": ".column.main",
"successMessages": ".message.success"
}
16 changes: 8 additions & 8 deletions tests/base/fixtures/during/selectors/minicart.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"miniCartIconSelector": "#menu-cart-icon",
"miniCartDrawerTitleSelector": "#cart-drawer-title",
"miniCartCheckoutButtonSelector": "a.btn.btn-primary[href$='/checkout/']",
"miniCartCartLinkSelector": "a.underline[href$='/checkout/cart/']",
"miniCartQuantityButtonSelector": "a[href*='checkout/cart/configure/']",
"miniCartDeleteProductButtonSelector": "button[aria-label^='Remove product']",
"miniCartQuantitySelector": "span[x-html='item.qty']"
}
"miniCartIconSelector": "#menu-cart-icon",
"miniCartDrawerTitleSelector": "#cart-drawer-title",
"miniCartCheckoutButtonSelector": "a.btn.btn-primary[href$='/checkout/']",
"miniCartCartLinkSelector": "a.underline[href$='/checkout/cart/']",
"miniCartQuantityButtonSelector": "a[href*='checkout/cart/configure/']",
"miniCartDeleteProductButtonSelector": "button[aria-label^='Remove product']",
"miniCartQuantitySelector": "span[x-html='item.qty']"
}
6 changes: 3 additions & 3 deletions tests/base/fixtures/during/selectors/product-page.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"addToCartButtonSelector": "#product-addtocart-button",
"productQuantityInputSelector": "input[name='qty'][type='number']"
}
"addToCartButtonSelector": "#product-addtocart-button",
"productQuantityInputSelector": "input[name='qty'][type='number']"
}
Loading

0 comments on commit 6c3766c

Please sign in to comment.