Skip to content

Commit

Permalink
new tests & pixel statistic call
Browse files Browse the repository at this point in the history
  • Loading branch information
stiegi committed Sep 20, 2022
1 parent 2ae7fae commit e95ad64
Show file tree
Hide file tree
Showing 33 changed files with 1,809 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
- Add option to set Mapp cookie as technically necessary
# 1.0.6
- Fixes for Shopware 6.4: filter eventlistener, landingpage content category, product prices
# 1.0.7
- Add pixel statistics call

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mapp/intelligence",
"description": "Add your Mapp Intelligence account ID and start tracking. The plugin adds the tracking script and data layer for your customer insights dashboard automatically.",
"version": "v1.0.6",
"version": "1.0.7",
"type": "shopware-platform-plugin",
"license": "MIT",
"authors": [
Expand Down Expand Up @@ -42,11 +42,11 @@
"scripts": {
"test:latest": [
"Composer\\Config::disableProcessTimeout",
"bash ./helper/run_test.sh"
"bash ./helper/run_test_v2.sh"
],
"test:latest:keep": [
"Composer\\Config::disableProcessTimeout",
"bash ./helper/run_test.sh -k"
"bash ./helper/run_test_v2.sh -k"
],
"test:6.2": [
"Composer\\Config::disableProcessTimeout",
Expand All @@ -66,7 +66,7 @@
],
"test:jenkins:latest": [
"Composer\\Config::disableProcessTimeout",
"bash ./helper/run_test.sh -j 1"
"bash ./helper/run_test_v2.sh -j 1"
],
"test:jenkins:6.2": [
"Composer\\Config::disableProcessTimeout",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@

describe('MappIntelligencePluginTests: General preparations', () => {


const getSalesChannelId = () => {
return cy.callAdminApi('post', '/search/sales-channel', {
"page":1,"limit":25,"term":"Storefront","total-count-mode":1,
"associations": {
"domains": {
"associations": {
"language": {
"total-count-mode": 1
},
"snippetSet": {
"total-count-mode": 1
},
"currency": {
"total-count-mode": 1
}
},
"total-count-mode": 1
}
}
});
}


it('set Storefront URL', () => {
getSalesChannelId().then(storefront => {
console.log(storefront);
const domainId =storefront.relationships.domains.data[0].id;

cy.callAdminApi('patch', `/sales-channel/${storefront.id}`, {
id: storefront.id,
domains: [{
id: domainId,
url: 'http://docker.vm:8000'
}]
});

})
});

it('create promotion and discount', () => {
cy.createPromotion('MappCoupon', 'mapptest');
});
Expand All @@ -24,11 +64,6 @@ describe('MappIntelligencePluginTests: General preparations', () => {
it('create test landingpage', () => {
let salesChannelId = '';

const getSalesChannelId = () => {
return cy.callAdminApi('post', '/search/sales-channel', {
"page":1,"limit":25,"term":"Storefront","total-count-mode":1
});
}
const getImprint = () => {
return cy.callAdminApi('post', '/search/cms-page', {
"page":1,"limit":25,"term":"Imprint","total-count-mode":1
Expand Down
17 changes: 17 additions & 0 deletions src/Resources/app/storefront/test/e2e_v2/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"viewportHeight": 1080,
"viewportWidth": 1920,
"baseUrl": "http://shopware-test_app_server_1:8000",
"watchForFileChanges": false,
"requestTimeout": 120000,
"defaultCommandTimeout": 120000,
"pageLoadTimeout": 120000,
"salesChannelName": "Storefront",
"video": false,
"screenshotsFolder": "/tests/results",
"reporter": "junit",
"reporterOptions": {
"mochaFile": "/tests/results/my-test-output-[hash].xml",
"jenkinsMode": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"male": {
"firstName": "Testuser1",
"lastName": "Male",
"email": "[email protected]",
"password": "shopware",
"street": "abc street",
"postal": "12345",
"city": "Berlin",
"country": 1,
"gender": 3,
"birthday": {
"day": "1",
"month": "1",
"year": "1970"
}
},
"female": {
"firstName": "Testuser2",
"lastName": "Female",
"email": "[email protected]",
"password": "shopware",
"street": "def street",
"postal": "56789",
"city": "Paris",
"country": 12,
"gender": 2,
"birthday": {
"day": "1",
"month": "1",
"year": "1970"
}
},
"unknown": {
"firstName": "Testuser3",
"lastName": "Unknown",
"email": "[email protected]",
"password": "shopware",
"street": "hij street",
"postal": "54321",
"city": "London",
"country": 2,
"gender": 1,
"birthday": {
"day": "1",
"month": "1",
"year": "1970"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"normal": {
"title": "Mapp Test Product - Normäl",
"productNumber": "mäppnormal",
"price": "1000.99",
"stock": "1000",
"categories": ["mapp-subcategory"],
"saleschannel": "Storefront"
},
"soldout": {
"title": "Mapp Test Product - Soldout",
"productNumber": "mappsoldout",
"price": "99.99",
"stock": "0",
"categories": ["mapp-subcategory"],
"saleschannel": "Storefront"
},
"variant": {
"title": "Mapp Test Product - Variable",
"productNumber": "mappvariable",
"price": "999.99",
"stock": "1000",
"categories": [
"mapp-subcategory"
],
"saleschannel": "Storefront",
"variants": {
"searchTerms": [
{
"category": "color",
"value": "azure"
},
{
"category": "color",
"value": "greenyellow"
},
{
"category": "color",
"value": "darkorange"
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// / <reference types="Cypress" />

describe('MappIntelligencePluginTests: General preparations', () => {


const getSalesChannelId = () => {
return cy.callAdminApi('post', '/search/sales-channel', {
"page":1,"limit":25,"term":"Storefront","total-count-mode":1,
"associations": {
"domains": {
"associations": {
"language": {
"total-count-mode": 1
},
"snippetSet": {
"total-count-mode": 1
},
"currency": {
"total-count-mode": 1
}
},
"total-count-mode": 1
}
}
});
}


it('set Storefront URL', () => {
getSalesChannelId().then(storefront => {
console.log(storefront);
const domainId =storefront.relationships.domains.data[0].id;

cy.callAdminApi('patch', `/sales-channel/${storefront.id}`, {
id: storefront.id,
domains: [{
id: domainId,
url: 'http://docker.vm:8000'
}]
});

})
});

it('create promotion and discount', () => {
cy.createPromotion('MappCoupon', 'mapptest');
});

it('convert imprint to landingpage', () => {
cy.callAdminApi('post', '/search/cms-page', {
"page":1,"limit":25,"term":"Imprint","total-count-mode":1
}).then( imprint => {
cy.callAdminApi('patch', `/cms-page/${imprint.id}`, {
"type":"landingpage"
})
});
});

it('create product categories', () => {
cy.createCategory('MappTestProducts', '111aee2d4ef6484f99e541a03976d865');
cy.createSubCategory('MappSubCategory', 'MappTestProducts', '111aee2d4ef6484f99e541a03976d867');
});

it('create test landingpage', () => {
let salesChannelId = '';

const getImprint = () => {
return cy.callAdminApi('post', '/search/cms-page', {
"page":1,"limit":25,"term":"Imprint","total-count-mode":1
});
}

getSalesChannelId().then(storefront => {
salesChannelId = storefront.id;
}).then(() => {
getImprint().then(imprint => {
console.log(salesChannelId, imprint.id)
cy.callAdminApi('post', '/landing-page', {
"name":"Testlandingpage",
"url":"mapp",
"cmsPageId": imprint.id,
"salesChannels":[
{
"id": salesChannelId
}
]
});
});
});
});

it('create test products', () => {

cy.createProduct({name: 'MappIntelligence-product-äöü', id: '222aee2d4ef6484f99e541a03976d867', stock: 44, productNumber: "MAPP10001",
price: [
{
gross: 495.95,
linked: true,
net: 490.95}
]}, 'MappSubCategory').then(() => {
cy.createProduct({name: 'MappIntelligence-product-soldout', id: '333aee2d4ef6484f99e541a03976d867', stock: 0, productNumber: "MAPP100013",
price: [
{
gross: 1.99,
linked: true,
net: 1}
]}, 'MappSubCategory').then(() => {
cy.createProduct({name: 'MappIntelligence-Variant-product', id: '444aee2d4ef6484f99e541a03976d867', stock: 99, productNumber: "MAPPVAR", color1: "azure", color2: "aliceblue",
price: [
{
gross: 295.95,
linked: true,
net: 290.95}
]}, 'MappSubCategory').then(() => {
cy.wait(10000);
cy.visit('/MappIntelligence-product-aeoeue/MAPP10001', {timeout: 30000});
cy.contains('MappIntelligence-product-äöü').should('be.visible');
cy.visit('/MappIntelligence-Variant-product/MappIntelligence-Variant-product-azure', {timeout: 30000});
cy.contains('MappIntelligence-Variant-product').should('be.visible');
cy.visit('/MappIntelligence-product-soldout/MAPP100013', {timeout: 30000});
cy.contains('MappIntelligence-product-soldout').should('be.visible');
});
});
});
});
});

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// / <reference types="Cypress" />

describe('MappIntelligencePluginTests: Install and Config', () => {

it('configure, check _tiConfig, wts and blacklist', () => {
cy.consentMapp();
let config;
let data;

cy.callAdminApi('post', '/_action/system-config/batch', {
"null":{
"MappIntelligence.config.blacklist":"pageName,pageTitle",
"MappIntelligence.config.consent":true,
"MappIntelligence.config.required":false,
"MappIntelligence.config.tiId":"136699033798929"
}
}).then( () => {
cy.visit('/');
cy.window()
.then((win) => {
config = win._tiConfig;
data = win._ti;
return win;
})
.then((win) => {
expect(config.tiId).to.equal('136699033798929');
expect(win.wts).to.exist;
expect(data).to.exist;
expect(data.pageName).to.not.exist;
expect(data.pageTitle).to.not.exist;
});
});
});

it('deactivate blacklist', () => {
cy.consentMapp();
let data;
cy.callAdminApi('post', '/_action/system-config/batch', {
"null":{
"MappIntelligence.config.blacklist":"",
"MappIntelligence.config.consent":true,
"MappIntelligence.config.required":false,
"MappIntelligence.config.tiId":"136699033798929"
}
}).then( () => {
cy.visit('/');
cy.window()
.then((win) => {
data = win._ti;
})
.then(() => {
expect(data).to.exist;
expect(data.pageName).to.exist;
expect(data.pageTitle).to.exist;
});
});
});
});
Loading

0 comments on commit e95ad64

Please sign in to comment.