From a6786ef929e318d1c812a86aaf37c13be2eac4e7 Mon Sep 17 00:00:00 2001 From: Sanyi Date: Fri, 28 Jun 2024 17:16:32 +0200 Subject: [PATCH] EMA-145 - Security findings --- dev/testv2/attributes/index.spec.js | 22 ++++++++--------- dev/testv2/config/index.spec.js | 12 +++++----- dev/testv2/customers/list.spec.js | 10 ++++---- .../integration/default-behaviour.spec.js | 20 ++++++++-------- .../marketing-events-customer.spec.js | 18 +++++++------- .../marketing-events-subscription.spec.js | 22 ++++++++--------- .../cypress/integration/web-extend.spec.js | 19 ++++++--------- dev/testv2/cypress/support/e2e.js | 2 +- dev/testv2/events/customer.spec.js | 16 ++++++------- dev/testv2/events/endpoint.spec.js | 16 ++++++------- .../get-inventory-for-products.spec.js | 10 ++++---- dev/testv2/orders/get.spec.js | 14 +++++------ dev/testv2/system-info/get.spec.js | 8 +++---- dev/testv2/tools/setup/setup | 5 +++- dev/testv2/webextend/script.spec.js | 24 +++++++++---------- 15 files changed, 108 insertions(+), 110 deletions(-) diff --git a/dev/testv2/attributes/index.spec.js b/dev/testv2/attributes/index.spec.js index f57f5bc5..a761dd10 100644 --- a/dev/testv2/attributes/index.spec.js +++ b/dev/testv2/attributes/index.spec.js @@ -6,13 +6,13 @@ const websiteId = 1; const mapAttributes = attributes => attributes.map(attribute => ({ code: attribute.code, name: attribute.name })); -describe('Attributes endpoint', function() { - afterEach(async function() {}); +describe('Attributes endpoint', function () { + afterEach(async function () {}); - after(async function() {}); + after(async function () {}); - describe('get', function() { - it('should fetch attributes including extra fields for customer', async function() { + describe('get', function () { + it('should fetch attributes including extra fields for customer', async function () { const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'customer' }); const mappedAttributes = mapAttributes(attributes); @@ -29,7 +29,7 @@ describe('Attributes endpoint', function() { } }); - it('should fetch attributes including extra fields for customer_address', async function() { + it('should fetch attributes including extra fields for customer_address', async function () { const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'customer_address' }); const mappedAttributes = mapAttributes(attributes); @@ -40,7 +40,7 @@ describe('Attributes endpoint', function() { } }); - it('should fetch attributes including extra fields for products', async function() { + it('should fetch attributes including extra fields for products', async function () { const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'product' }); const mappedAttributes = attributes.map(attribute => { return { code: attribute.code, name: attribute.name }; @@ -58,8 +58,8 @@ describe('Attributes endpoint', function() { }); }); - describe('set', function() { - it('should modify customer attribute config for website', async function() { + describe('set', function () { + it('should modify customer attribute config for website', async function () { await this.magentoApi.execute('attributes', 'set', { websiteId, type: 'customer', @@ -76,7 +76,7 @@ describe('Attributes endpoint', function() { expect(config.value).to.equal(JSON.stringify(['hello_attribute'])); }); - it('should modify customer_address attribute config for website', async function() { + it('should modify customer_address attribute config for website', async function () { await this.magentoApi.execute('attributes', 'set', { websiteId, type: 'customer_address', @@ -93,7 +93,7 @@ describe('Attributes endpoint', function() { expect(config.value).to.equal(JSON.stringify(['hello_attribute'])); }); - it('should modify product attribute config for website', async function() { + it('should modify product attribute config for website', async function () { await this.magentoApi.execute('attributes', 'set', { websiteId: 0, type: 'product', diff --git a/dev/testv2/config/index.spec.js b/dev/testv2/config/index.spec.js index 942ef1e9..50bc9405 100644 --- a/dev/testv2/config/index.spec.js +++ b/dev/testv2/config/index.spec.js @@ -21,21 +21,21 @@ const dbKeys = { }; const websiteId = 1; -describe('Config endpoint', function() { - before(async function() { +describe('Config endpoint', function () { + before(async function () { await this.turnOffEverySetting(1); }); - afterEach(async function() { + afterEach(async function () { await this.turnOffEverySetting(1); }); - after(async function() { + after(async function () { await this.setDefaultStoreSettings(); }); - describe('set', function() { - it('should modify config values for website', async function() { + describe('set', function () { + it('should modify config values for website', async function () { await this.magentoApi.execute('config', 'set', { websiteId, config: fullConfig diff --git a/dev/testv2/customers/list.spec.js b/dev/testv2/customers/list.spec.js index 71e73853..a57ff7d8 100644 --- a/dev/testv2/customers/list.spec.js +++ b/dev/testv2/customers/list.spec.js @@ -23,8 +23,8 @@ const customers = [ } ]; -describe('Customers endpoint', function() { - before(async function() { +describe('Customers endpoint', function () { + before(async function () { await this.magentoApi.execute('attributes', 'set', { websiteId: 1, type: 'customer', @@ -35,7 +35,7 @@ describe('Customers endpoint', function() { } }); - after(async function() { + after(async function () { await this.magentoApi.execute('attributes', 'set', { websiteId: 1, type: 'customer', @@ -44,7 +44,7 @@ describe('Customers endpoint', function() { await this.db.raw(`DELETE FROM ${this.getTableName('customer_entity')} where email like "%@customer.net"`); }); - it('returns customers according to page and page_size inlcuding last_page', async function() { + it('returns customers according to page and page_size inlcuding last_page', async function () { const page = 1; const limit = 2; @@ -66,7 +66,7 @@ describe('Customers endpoint', function() { expect(customer).to.have.property('shipping_address'); }); - it('returns extra_fields for customers', async function() { + it('returns extra_fields for customers', async function () { const page = 1; const limit = 1; diff --git a/dev/testv2/cypress/integration/default-behaviour.spec.js b/dev/testv2/cypress/integration/default-behaviour.spec.js index 9ecd3568..ac79406c 100644 --- a/dev/testv2/cypress/integration/default-behaviour.spec.js +++ b/dev/testv2/cypress/integration/default-behaviour.spec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('Default behaviour with everything turned off', function() { +describe('Default behaviour with everything turned off', function () { before(() => { cy.task('setConfig', {}); }); @@ -14,13 +14,13 @@ describe('Default behaviour with everything turned off', function() { cy.task('clearMails'); }); - context('MarketingEvents - Customer', function() { + context('MarketingEvents - Customer', function () { afterEach(() => { cy.task('clearEvents'); cy.logout(); }); - it('should not create customer_password_reset event', function() { + it('should not create customer_password_reset event', function () { const newPassword = 'newPassword1'; cy.loginWithCustomer(this.defaultCustomer); @@ -36,7 +36,7 @@ describe('Default behaviour with everything turned off', function() { }); }); - it('should not create customer_email_changed event', function() { + it('should not create customer_email_changed event', function () { const oldEmail = this.defaultCustomer.email; const newEmail = 'cypress2@default.com'; @@ -52,7 +52,7 @@ describe('Default behaviour with everything turned off', function() { }); }); - it('should not create customer_email_and_password_changed event', function() { + it('should not create customer_email_and_password_changed event', function () { const newEmail = 'cypress5@default.com'; const newPassword = 'newPassword4'; @@ -70,7 +70,7 @@ describe('Default behaviour with everything turned off', function() { }); }); - context('MarketingEvents - Subscription', function() { + context('MarketingEvents - Subscription', function () { const unsubscribe = email => { cy.task('getSubscription', email).then(subscription => { cy.visit(`/newsletter/subscriber/unsubscribe?id=${subscription.subscriber_id}\ @@ -84,8 +84,8 @@ describe('Default behaviour with everything turned off', function() { cy.get('.action.subscribe.primary[type="submit"]').click(); }; - context('guest with double optin off', function() { - it('should not create subscription events', function() { + context('guest with double optin off', function () { + it('should not create subscription events', function () { const guestEmail = 'no-event.doptin-off@guest-cypress.com'; subscribe(guestEmail); @@ -110,7 +110,7 @@ describe('Default behaviour with everything turned off', function() { }); }); - context('guest with double optin on', function() { + context('guest with double optin on', function () { before(() => { cy.task('setDoubleOptin', true); cy.task('flushMagentoCache'); @@ -120,7 +120,7 @@ describe('Default behaviour with everything turned off', function() { cy.task('setDoubleOptin', false); }); - it('should not create subscription events', function() { + it('should not create subscription events', function () { const guestEmail = 'no-event.doptin-on@guest-cypress.com'; subscribe(guestEmail); diff --git a/dev/testv2/cypress/integration/marketing-events-customer.spec.js b/dev/testv2/cypress/integration/marketing-events-customer.spec.js index 75c15864..e4b7c420 100644 --- a/dev/testv2/cypress/integration/marketing-events-customer.spec.js +++ b/dev/testv2/cypress/integration/marketing-events-customer.spec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('Marketing Events', function() { +describe('Marketing Events', function () { beforeEach(() => { cy.task('clearMails'); cy.task('getDefaultCustomer').as('defaultCustomer'); @@ -10,7 +10,7 @@ describe('Marketing Events', function() { cy.logout(); }); - context('magentoSendEmails config is disabled', function() { + context('magentoSendEmails config is disabled', function () { before(() => { cy.task('setConfig', { collectMarketingEvents: 'enabled', @@ -19,7 +19,7 @@ describe('Marketing Events', function() { cy.task('clearEvents'); }); - it('should create customer_password_reset event', function() { + it('should create customer_password_reset event', function () { const newPassword = 'newPassword2'; cy.loginWithCustomer(this.defaultCustomer); @@ -36,7 +36,7 @@ describe('Marketing Events', function() { }); }); - it('should create customer_email_changed event', function() { + it('should create customer_email_changed event', function () { const newEmail = 'cypress3@default.com'; cy.loginWithCustomer(this.defaultCustomer); @@ -53,7 +53,7 @@ describe('Marketing Events', function() { }); }); - it('should create customer_email_and_password_changed event', function() { + it('should create customer_email_and_password_changed event', function () { const newEmail = 'cypress4@default.com'; const newPassword = 'newPassword3'; @@ -72,7 +72,7 @@ describe('Marketing Events', function() { }); }); - context('magentoSendEmails config is enabled', function() { + context('magentoSendEmails config is enabled', function () { before(() => { cy.task('setConfig', { collectMarketingEvents: 'enabled', @@ -81,7 +81,7 @@ describe('Marketing Events', function() { cy.task('clearEvents'); }); - it('should create customer_password_reset event', function() { + it('should create customer_password_reset event', function () { const newPassword = 'newPassword2'; cy.loginWithCustomer(this.defaultCustomer); @@ -98,7 +98,7 @@ describe('Marketing Events', function() { }); }); - it('should create customer_email_changed event', function() { + it('should create customer_email_changed event', function () { const oldEmail = this.defaultCustomer.email; const newEmail = 'cypress3@default.com'; @@ -116,7 +116,7 @@ describe('Marketing Events', function() { }); }); - it('should create customer_email_and_password_changed event', function() { + it('should create customer_email_and_password_changed event', function () { const oldEmail = this.defaultCustomer.email; const newEmail = 'cypress4@default.com'; const newPassword = 'newPassword3'; diff --git a/dev/testv2/cypress/integration/marketing-events-subscription.spec.js b/dev/testv2/cypress/integration/marketing-events-subscription.spec.js index e1bbb4d5..9e36989d 100644 --- a/dev/testv2/cypress/integration/marketing-events-subscription.spec.js +++ b/dev/testv2/cypress/integration/marketing-events-subscription.spec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('Marketing Events', function() { +describe('Marketing Events', function () { const unsubscribe = email => { cy.task('getSubscription', email).then(subscription => { cy.visit(`/newsletter/subscriber/unsubscribe?id=${subscription.subscriber_id}\ @@ -19,7 +19,7 @@ describe('Marketing Events', function() { cy.task('clearEvents'); }); - context('magentoSendEmails config is disabled', function() { + context('magentoSendEmails config is disabled', function () { before(() => { cy.task('setConfig', { collectMarketingEvents: 'enabled', @@ -27,8 +27,8 @@ describe('Marketing Events', function() { }); }); - context('guest with double optin off', function() { - it('should create subscription events', function() { + context('guest with double optin off', function () { + it('should create subscription events', function () { const guestEmail = 'event.doptin-off.sub@guest-cypress.com'; subscribe(guestEmail); @@ -56,7 +56,7 @@ describe('Marketing Events', function() { }); }); - context('guest with double optin on', function() { + context('guest with double optin on', function () { before(() => { cy.task('setDoubleOptin', true); cy.task('flushMagentoCache'); @@ -66,7 +66,7 @@ describe('Marketing Events', function() { cy.task('setDoubleOptin', false); }); - it('should create newsletter_send_confirmation_request_email event', function() { + it('should create newsletter_send_confirmation_request_email event', function () { const guestEmail = 'event.doptin-on.sub@guest-cypress.com'; subscribe(guestEmail); @@ -95,7 +95,7 @@ describe('Marketing Events', function() { }); }); - context('magentoSendEmails config is enabled', function() { + context('magentoSendEmails config is enabled', function () { before(() => { cy.task('setConfig', { collectMarketingEvents: 'enabled', @@ -103,8 +103,8 @@ describe('Marketing Events', function() { }); }); - context('guest with double optin off', function() { - it('should create subscription events', function() { + context('guest with double optin off', function () { + it('should create subscription events', function () { const guestEmail = 'event.doptin-off.sub@guest-cypress.com'; subscribe(guestEmail); @@ -133,7 +133,7 @@ describe('Marketing Events', function() { }); }); - context('guest with double optin on', function() { + context('guest with double optin on', function () { before(() => { cy.task('setDoubleOptin', true); cy.task('flushMagentoCache'); @@ -143,7 +143,7 @@ describe('Marketing Events', function() { cy.task('setDoubleOptin', false); }); - it('should create newsletter_send_confirmation_request_email event', function() { + it('should create newsletter_send_confirmation_request_email event', function () { const guestEmail = 'event.doptin-on.sub@guest-cypress.com'; subscribe(guestEmail); diff --git a/dev/testv2/cypress/integration/web-extend.spec.js b/dev/testv2/cypress/integration/web-extend.spec.js index f21f5919..86efd99d 100644 --- a/dev/testv2/cypress/integration/web-extend.spec.js +++ b/dev/testv2/cypress/integration/web-extend.spec.js @@ -4,7 +4,7 @@ const merchantId = 'merchantId123'; const webTrackingSnippetUrl = Cypress.env('snippetUrl'); const predictUrl = `http://cdn.scarabresearch.com/js/${merchantId}/scarab-v2.js`; -describe('Web extend scripts', function() { +describe('Web extend scripts', function () { before(() => { cy.task('setConfig', { injectSnippet: 'enabled', @@ -24,9 +24,9 @@ describe('Web extend scripts', function() { win.customerStub = cy.stub().as('customerStub'); const testScriptNode = win.document.createElement('script'); - testScriptNode.text = `window.require(['Magento_Customer/js/customer-data'], function(customerData) { + testScriptNode.text = `window.require(['Magento_Customer/js/customer-data'], function (customerData) { window.customerStub(customerData.get('customer')()) - customerData.get('customer').subscribe(function(customer) { + customerData.get('customer').subscribe(function (customer) { window.customerStub(customer); }); });`; @@ -38,7 +38,7 @@ describe('Web extend scripts', function() { cy.logout(); }); - it('should include web-extend scripts', function() { + it('should include web-extend scripts', function () { cy.visit('/'); cy.get('script').then(scripts => { @@ -48,7 +48,7 @@ describe('Web extend scripts', function() { }); }); - it('should include proper customer data', function() { + it('should include proper customer data', function () { cy.loginWithCustomer({ email: 'roni_cost@example.com', password: 'roni_cost3@example.com' }); cy.visit('/fusion-backpack.html'); @@ -60,7 +60,7 @@ describe('Web extend scripts', function() { }); }); - it('should include orderData after ordering as a guest', function() { + it('should include orderData after ordering as a guest', function () { cy.visit('/fusion-backpack.html'); cy.get('.loading-mask').should('not.exist'); @@ -74,10 +74,6 @@ describe('Web extend scripts', function() { cy.get('.action.showcart').click(); cy.get('#top-cart-btn-checkout').click(); - cy.visit('/checkout'); - // cy.wait(6000); - // cy.contains('Email Address').should('be.visible'); - cy.get('#checkout-step-shipping input.input-text[name="username"]').type('guest@cypress.net'); cy.get('#checkout-step-shipping input.input-text[name="firstname"]').type('Guest'); cy.get('#checkout-step-shipping input.input-text[name="lastname"]').type('Da Best'); @@ -91,7 +87,6 @@ describe('Web extend scripts', function() { cy.get('button[data-role="opc-continue"]').click(); cy.get('button[title="Place Order"]').click(); - cy.wait(1000); cy.get('.checkout-success'); cy.window().then(win => { @@ -108,7 +103,7 @@ describe('Web extend scripts', function() { }); }); - it('should include orderData after ordering as a logged in user', function() { + it('should include orderData after ordering as a logged in user', function () { cy.loginWithCustomer({ email: 'roni_cost@example.com', password: 'roni_cost3@example.com' }); cy.visit('/fusion-backpack.html'); diff --git a/dev/testv2/cypress/support/e2e.js b/dev/testv2/cypress/support/e2e.js index 45328341..3ee25381 100644 --- a/dev/testv2/cypress/support/e2e.js +++ b/dev/testv2/cypress/support/e2e.js @@ -41,7 +41,7 @@ Cypress.on('fail', error => { throw error; }); -console.log = function(...args) { +console.log = function (...args) { logs += args.join('\n'); logs += '\n'; }; diff --git a/dev/testv2/events/customer.spec.js b/dev/testv2/events/customer.spec.js index b09e4a7e..63836132 100644 --- a/dev/testv2/events/customer.spec.js +++ b/dev/testv2/events/customer.spec.js @@ -17,8 +17,8 @@ const customer = { ] }; -describe('Customer events', function() { - before(async function() { +describe('Customer events', function () { + before(async function () { await this.magentoApi.execute('attributes', 'set', { websiteId: 1, type: 'customer', @@ -26,12 +26,12 @@ describe('Customer events', function() { }); }); - afterEach(async function() { + afterEach(async function () { await this.db.raw(`DELETE FROM ${this.getTableName('customer_entity')} where email = "yolo99@yolo.net"`); await this.turnOffEverySetting(1); }); - after(async function() { + after(async function () { await this.magentoApi.execute('attributes', 'set', { websiteId: 1, type: 'customer', @@ -39,7 +39,7 @@ describe('Customer events', function() { }); }); - it('"customers/update" is saved in DB if customer is created', async function() { + it('"customers/update" is saved in DB if customer is created', async function () { await this.magentoApi.execute('config', 'set', { websiteId: 1, config: { collectCustomerEvents: 'enabled' } }); await this.createCustomer(customer); @@ -56,7 +56,7 @@ describe('Customer events', function() { expect(event.store_id).to.equal(1); }); - it('"customers/update" is saved in DB if customer is updated', async function() { + it('"customers/update" is saved in DB if customer is updated', async function () { const createdCustomer = await this.createCustomer(customer); await this.magentoApi.execute('config', 'set', { websiteId: 1, config: { collectCustomerEvents: 'enabled' } }); @@ -83,7 +83,7 @@ describe('Customer events', function() { expect(event.store_id).to.equal(1); }); - it('"customers/delete" is saved in DB if customer is deleted', async function() { + it('"customers/delete" is saved in DB if customer is deleted', async function () { const createdCustomer = await this.createCustomer(customer); await this.magentoApi.execute('config', 'set', { websiteId: 1, config: { collectCustomerEvents: 'enabled' } }); @@ -100,7 +100,7 @@ describe('Customer events', function() { expect(event.entity_id).to.eql(createdCustomer.entityId); }); - it('are not saved in DB if collectCustomerEvents is disabled', async function() { + it('are not saved in DB if collectCustomerEvents is disabled', async function () { await this.turnOffEverySetting(1); await this.createCustomer(customer); diff --git a/dev/testv2/events/endpoint.spec.js b/dev/testv2/events/endpoint.spec.js index b1fbb9ef..bb198d45 100644 --- a/dev/testv2/events/endpoint.spec.js +++ b/dev/testv2/events/endpoint.spec.js @@ -33,12 +33,12 @@ const customers = [ } ]; -describe('Events API endpoint', function() { - before(async function() { +describe('Events API endpoint', function () { + before(async function () { await this.magentoApi.execute('config', 'set', { websiteId: 1, config: { collectCustomerEvents: 'enabled' } }); }); - afterEach(async function() { + afterEach(async function () { await this.db.raw( `DELETE FROM ${this.getTableName( 'customer_entity' @@ -46,11 +46,11 @@ describe('Events API endpoint', function() { ); }); - after(async function() { + after(async function () { await this.turnOffEverySetting(1); }); - it('returns number of events defined in page_size and deletes events before since_id', async function() { + it('returns number of events defined in page_size and deletes events before since_id', async function () { for (const customer of customers) { await this.createCustomer(customer); } @@ -75,7 +75,7 @@ describe('Events API endpoint', function() { expect(firstEvent.store_id).to.equal(1); }); - it('returns 406 status if sinceId is higher than max event ID in the events table', async function() { + it('returns 406 status if sinceId is higher than max event ID in the events table', async function () { for (const customer of customers) { await this.createCustomer(customer); } @@ -95,7 +95,7 @@ describe('Events API endpoint', function() { expect(eventsResponse.events.length).to.equal(3); }); - it('does not return 406 status if sinceId is equal to the maximal event ID in the table', async function() { + it('does not return 406 status if sinceId is equal to the maximal event ID in the table', async function () { for (const customer of customers) { await this.createCustomer(customer); } @@ -105,7 +105,7 @@ describe('Events API endpoint', function() { expect(eventsResponse.events.length).to.equal(0); }); - it('does not return 406 status if there are no entries in the events table', async function() { + it('does not return 406 status if there are no entries in the events table', async function () { const eventsResponse = await this.magentoApi.execute('events', 'getSinceId', { sinceId: 1, pageSize: 10 }); expect(eventsResponse.events.length).to.equal(0); diff --git a/dev/testv2/inventory/get-inventory-for-products.spec.js b/dev/testv2/inventory/get-inventory-for-products.spec.js index d47f9671..fa67ed02 100644 --- a/dev/testv2/inventory/get-inventory-for-products.spec.js +++ b/dev/testv2/inventory/get-inventory-for-products.spec.js @@ -1,6 +1,6 @@ 'use strict'; -const createSource = async function(magentoApi) { +const createSource = async function (magentoApi) { return await magentoApi.post({ path: '/index.php/rest/V1/inventory/sources', payload: { @@ -15,7 +15,7 @@ const createSource = async function(magentoApi) { }); }; -const addStockForProductInInventorySource = async function(magentoApi) { +const addStockForProductInInventorySource = async function (magentoApi) { return await magentoApi.post({ path: '/index.php/rest/V1/inventory/source-items', payload: { @@ -35,9 +35,9 @@ const inventorySourceCode = 'custom_source'; const skuWithMultipleSources = '24-WB04'; const skuWithDefaultSource = '24-WB07'; -describe('Product inventory API', function() { +describe('Product inventory API', function () { - before(async function() { + before(async function () { if (this.magentoVersion >= '2.3.0') { await createSource(this.magentoApi); try { @@ -48,7 +48,7 @@ describe('Product inventory API', function() { } }); - it('should return product stock for all inventory sources', async function() { + it('should return product stock for all inventory sources', async function () { if (this.magentoVersion >= '2.3.0') { const { items } = await this.magentoApi.execute('inventory', 'getForProducts', { sku: [skuWithMultipleSources, skuWithDefaultSource] diff --git a/dev/testv2/orders/get.spec.js b/dev/testv2/orders/get.spec.js index da1dd9a2..c341c42c 100644 --- a/dev/testv2/orders/get.spec.js +++ b/dev/testv2/orders/get.spec.js @@ -4,10 +4,10 @@ const { shipOrder, createNewGuestOrder } = require('../helpers/orders'); const orderCount = 4; -describe('Orders endpoint', function() { +describe('Orders endpoint', function () { let localCartItem; - before(async function() { + before(async function () { await this.dbCleaner.clearOrders(); localCartItem = this.localCartItem; @@ -17,11 +17,11 @@ describe('Orders endpoint', function() { } }); - after(async function() { + after(async function () { await this.dbCleaner.clearOrders(); }); - it('should return orders and paging info according to parameters', async function() { + it('should return orders and paging info according to parameters', async function () { const limit = 1; const page = 1; const ordersResponse = await this.magentoApi.execute('orders', 'getSinceId', { @@ -40,7 +40,7 @@ describe('Orders endpoint', function() { expect(ordersResponse.orders[0].store_id).to.equal(1); }); - it('should handle multiple store IDs', async function() { + it('should handle multiple store IDs', async function () { const limit = 1; const page = 1; const ordersResponse = await this.magentoApi.execute('orders', 'getSinceId', { @@ -53,7 +53,7 @@ describe('Orders endpoint', function() { expect(ordersResponse.orderCount).to.be.equal(orderCount); }); - it('should filter for store IDs', async function() { + it('should filter for store IDs', async function () { const limit = 1; const page = 1; const ordersResponse = await this.magentoApi.execute('orders', 'getSinceId', { @@ -66,7 +66,7 @@ describe('Orders endpoint', function() { expect(ordersResponse.orderCount).to.be.equal(0); }); - it('should filter with sinceId', async function() { + it('should filter with sinceId', async function () { const limit = 1; const page = 2; const sinceId = 2; diff --git a/dev/testv2/system-info/get.spec.js b/dev/testv2/system-info/get.spec.js index 5ffbb77f..3b0f34bb 100644 --- a/dev/testv2/system-info/get.spec.js +++ b/dev/testv2/system-info/get.spec.js @@ -1,7 +1,7 @@ 'use strict'; -describe('SystemInfo API', function() { - it('should return system information', async function() { +describe('SystemInfo API', function () { + it('should return system information', async function () { const info = await this.magentoApi.execute('systeminfo', 'get'); @@ -11,13 +11,13 @@ describe('SystemInfo API', function() { expect(info.magento_edition).to.not.be.undefined; }); - it('should return customer DB website scope when configured so', async function() { + it('should return customer DB website scope when configured so', async function () { const info = await this.magentoApi.execute('systeminfo', 'get'); expect(info.is_website_scope).to.be.true; }); - it('should return customer DB website scope when configured so', async function() { + it('should return customer DB website scope when configured so', async function () { await this.db(this.getTableName('core_config_data')).insert( { scope: 'default', path: 'customer/account_share/scope', value: 0 } ); diff --git a/dev/testv2/tools/setup/setup b/dev/testv2/tools/setup/setup index a110c968..4530f52a 100644 --- a/dev/testv2/tools/setup/setup +++ b/dev/testv2/tools/setup/setup @@ -25,5 +25,8 @@ fi mysql -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE -e "UPDATE ${TABLE_PREFIX}oauth_token SET token = 'Almafa456';" +echo "-|| Update cookie lifetime" +bin/magento config:set web/cookie/cookie_lifetime 36000 + echo "-|| Flushing cache" -bin/magento cache:flush \ No newline at end of file +bin/magento cache:flush diff --git a/dev/testv2/webextend/script.spec.js b/dev/testv2/webextend/script.spec.js index d0db9215..e8992403 100644 --- a/dev/testv2/webextend/script.spec.js +++ b/dev/testv2/webextend/script.spec.js @@ -45,8 +45,8 @@ const insertNewCategoryBetween = async (magentoApi, { name, parentId, childId }) }; describe('Webextend scripts', function () { - describe('enabled', function() { - beforeEach(async function() { + describe('enabled', function () { + beforeEach(async function () { await this.magentoApi.execute('config', 'set', { websiteId: 1, config: { @@ -57,7 +57,7 @@ describe('Webextend scripts', function () { }); }); - it('should be in the HTML if injectsnippet is enabled', async function() { + it('should be in the HTML if injectsnippet is enabled', async function () { const emarsysSnippets = await getEmarsysSnippetContents('customer/account/login/'); expect(emarsysSnippets.includes('')).to.be.true; @@ -77,7 +77,7 @@ describe('Webextend scripts', function () { ).to.be.true; }); - it('should include search term', async function() { + it('should include search term', async function () { const emarsysSnippets = await getEmarsysSnippetContents('catalogsearch/result/?q=magento+is+hit'); expect( emarsysSnippets.includes( @@ -87,7 +87,7 @@ describe('Webextend scripts', function () { ).to.be.true; }); - it('should include categories in the right order', async function() { + it('should include categories in the right order', async function () { let parentCategoryId = '11'; let childCategoryId = '12'; @@ -117,7 +117,7 @@ describe('Webextend scripts', function () { ).to.be.true; }); - it('should include product', async function() { + it('should include product', async function () { const emarsysSnippets = await getEmarsysSnippetContents('cassius-sparring-tank.html'); let productHelper = new ProductHelper(this.db, this.magentoEdition, this.magentoVersion); @@ -131,7 +131,7 @@ describe('Webextend scripts', function () { ).to.be.true; }); - it('should include if product is visible child', async function() { + it('should include if product is visible child', async function () { await alterProductVisibility(this.magentoApi, 'MT12-XS-Blue'); const emarsysSnippets = await getEmarsysSnippetContents('cassius-sparring-tank-xs-blue.html'); @@ -139,16 +139,16 @@ describe('Webextend scripts', function () { expect(emarsysSnippets.includes('"isVisibleChild":true')).to.be.true; }); - describe('store is not enabled', function() { - before(async function() { + describe('store is not enabled', function () { + before(async function () { await this.clearStoreSettings(); }); - after(async function() { + after(async function () { await this.setDefaultStoreSettings(); }); - it('should not be in the HTML', async function() { + it('should not be in the HTML', async function () { await this.turnOffEverySetting(1); const emarsysSnippets = await getEmarsysSnippetContents('customer/account/login/'); expect(emarsysSnippets).to.eql(''); @@ -157,7 +157,7 @@ describe('Webextend scripts', function () { }); describe('disabled', function () { - it('should not be in the HTML if injectsnippet setting is disabled', async function() { + it('should not be in the HTML if injectsnippet setting is disabled', async function () { await this.turnOffEverySetting(1); const emarsysSnippets = await getEmarsysSnippetContents('customer/account/login/'); expect(emarsysSnippets).to.eql('');