shopware / e2e-testsuite-platform Goto Github PK
View Code? Open in Web Editor NEWThis package contains the e2e platform test suite for Shopware 6 using Cypress
Home Page: http://shopware.com
License: MIT License
This package contains the e2e platform test suite for Shopware 6 using Cypress
Home Page: http://shopware.com
License: MIT License
Hi,
could you please add "delete" method to:
e2e-testsuite-platform/cypress/support/service/administration/fixture.service.js
Thanks a lot :)
PSH is not there anymore. we should update it
The test-suit currently uses a vulnerable version of axios. See here:
npm audit
-log:
axios <=0.21.1
Severity: high
Incorrect Comparison in axios - https://github.com/advisories/GHSA-cph5-m8f7-6c5x
No fix available
node_modules/axios
@shopware-ag/e2e-testsuite-platform *
Depends on vulnerable versions of axios
node_modules/@shopware-ag/e2e-testsuite-platform
Not too critical since it's only a testing framework, but a dependency update would still be nice.
Related: #191
Hi! Which https://www.npmjs.com/package/@shopware-ag/e2e-testsuite-platform should I use with Shopware 6.3.1.1? When I use 3.0.7 then I bacome an error:
TypeError
Cannot read properties of undefined (reading 'id')
Because this error occurred during a before each hook we are skipping the remaining tests in the current suite: PluginCypressTests: Test ba...
node_modules/@shopware-ag/e2e-testsuite-platform/cypress/support/service/administration/fixture/product.fixture.js:23:1
21 | .then(([manufacturer, tax]) => {
22 | return Object.assign({}, {
> 23 | taxId: tax.id,
| ^
24 | manufacturerId: manufacturer.id
25 | }, userData);
26 | }).then((finalProductData) => {
trying to retrieve the ID of a customer entity from Shopware using the function. It works fine when I run cypress locally, but in CI it always returns an empty object. The baseUrl is the same both locally and on CI. What could the issue be?
In #18 the need for an environment variable for Shopware's API versions came up, see quote:
Personally I'm not a big fan of changing the API version this many times. We can't ensure the project which uses this package supports the hardcoded API version. As a proposal to solve the problem we should come up with an environment / config variable which contains the API version the test platform should use.
This way the project which uses this package can define the version they would like to use instead of constantly bumping up the API version in the URLs itself.
See:
* https://docs.cypress.io/guides/guides/environment-variables.html#Setting
Hi friends,
thx a lot for this project and your testing passion. I want to do more things with this repo now and also contribute and push it to YouTube.
After first installation i see package lock is modified. Maybe a good point for a first PR. Should I add it to gitignore file?
See you
Roland
Please replace or renew the CDN solution for the shopware.css
in this repo!
Suggestion: Copy to and host on Github Pages
After a fresh installation of the test suite, I kept getting the error that the uuid/v4 module cannot be found. After installing uuid 3.3.2 it worked then. Either the version of uuid must be set to 3.3.x or the require in the cypress/support/index.js has to be modified from
const uuid = require('uuid/v4');
To
const { v4: uuidv4 } = require('uuid');
Using cy.createGuestOrder(product, UserData) will give this error in the latest clean build (shopware) version.
sales-channel-api/v1/checkout/guest-order 400 (Bad Request)
VIOLATION::IS_BLANK_ERROR
To fix this problem I hard coded this file:
custom/plugins/x/src/Resources/app/storefront/test/e2e/node_modules/@shopware-ag/e2e-testsuite-platform/cypress/support/service/saleschannel/fixture/order.fixture.js
customerRawData = this.mergeFixtureWithData(customerRawData, {
salutationId: salutation.id,
billingAddress: {
salutationId: salutation.id,
countryId: country.id
}
});
Into
customerRawData = this.mergeFixtureWithData(customerRawData, {
salutationId: salutation.id,
billingAddress: {
salutationId: salutation.id,
countryId: country.id,
street: 'streetname',
zipcode: '1151',
city: 'test'
}
});
Then I get the correct data.
But I don't understand how to do e2e test this page /checkout/register
1.)
I thought these were the right steps.
But when I do this, I cart is still empty without products.
2.)
Or do I need to use some posts (this give the same empty cart problem)
cy.storefrontApiRequest('POST', 'checkout/cart').then((result) => {
3.)
Or do I use cypress old school by navigate to the random product url, and search for the "add to cart" button, and than go to the checkout/register page
The full test code at the moment.
It would be cool if someone can give a working example.
I'm using 3 fixtures
describe(`Test custom cart`, () => {
beforeEach(() => {
cy.getRandomProductInformationForCheckout().then((product) => {
/* randomProductInformation
gross: undefined
id: "e81792a4772d4058bd0d546cdc7f3b3e"
listingPrice: undefined
name: "Synergistic Silk Balkan Beef"
net: undefined
url: "/detail/e81792a4772d4058bd0d546cdc7f3b3e"
*/
// This is a empty cart.
// cy.storefrontApiRequest('POST', 'checkout/cart').then((result) => {
// cy.storefrontApiRequest('POST', 'checkout/cart/product/' + product.id, {}, {
// type: 'product',
// referencedId: product.id,
// stackable: true
// }).then((result) => {
//
// /* result
// affiliateCode: null
// campaignCode: null
// customerComment: null
// deliveries: [{…}]
// errors: []
// extensions: []
// lineItems: [{…}]
// modified: false
// name: "8a243080f92e4c719546314b577cf82b"
// price: {netPrice: 571.43, totalPrice: 680, calculatedTaxes: Array(1), taxRules: Array(1), positionPrice: 680, …}
// token: "UukzY0WR2wiBRQR8pWakoCvILrrfci2i"
// transactions: [{…}]
// */
// cy.visit('/checkout/register');
// })
// })
// this is a empty cart
cy.createCustomerFixture().then((customer) => {
/* customer
attributes: {groupId: "cfbd5018d38d41d8adca10d94fc8bdd6", defaultPaymentMethodId: "ad2b1901d4794969b31cb9b4f887f931", salesChannelId: "9ee6c53d577b456c9aaaea01f9227fbc", languageId: "2fbb5fe2e29a4d70aa5854ce7ce3e20b", lastPaymentMethodId: null, …}
id: "c4b9353fca2e43819d7b16b9c7c8baa6"
links: {self: "http://shopware-address-lookup.nl.shopware/api/v1/customer/c4b9353fca2e43819d7b16b9c7c8baa6"}
meta: null
relationships: {group: {…}, defaultPaymentMethod: {…}, salesChannel: {…}, language: {…}, lastPaymentMethod: {…}, …}
type: "customer"
*/
return customer
}).then((customer) => {
// console.log(randomProductInformation, customer)
cy.createGuestOrder(product.id, customer).then( (guestOrder) => {
// console.log(guestOrder)
/* guestOrder
data: {orderNumber: "10066", currencyId: "b7d2554b0ce847cd82f3ac9bd1c0dfca", currencyFactor: 1, salesChannelId: "9ee6c53d577b456c9aaaea01f9227fbc", billingAddressId: "6e0ca916373d42c3a0e6efcd9efd6c57", …}
sw-context-token: "FZf3EIG1BJf7cHUEUwgxzjN00dF9CcER"
*/
cy.visit('/checkout/register');
});
})
})
});
it('Check things', () => {
console.log('oke')
});
});
I am trying to login the user within the storefront to buy a product.
But I am getting always The provided CSRF token is not valid
from Shopware.
it('Login', () => {
cy.get('.login-collapse-toggle').click()
cy.get('#loginMail')
.type('[email protected]')
.should('have.value', '[email protected]')
cy.get('#loginPassword')
.type('shopware')
cy.get('.login-form').submit()
})
it('Register test customer', () => {
cy.get('#personalSalutation').select('Mr.')
cy.get('#personalFirstName')
.type('Max')
.should('have.value', 'Max')
cy.get('#personalLastName')
.type('Mustermann')
.should('have.value', 'Mustermann')
cy.get('#personalGuest').check({force: true})
cy.get('#personalMail')
.type('[email protected]')
.should('have.value', '[email protected]')
cy.get('#billingAddressAddressStreet')
.type('Musterstrasse 1')
.should('have.value', 'Musterstrasse 1')
cy.get('#billingAddressAddressZipcode')
.type('12345')
.should('have.value', '12345')
cy.get('#billingAddressAddressCity')
.type('Musterhausen')
.should('have.value', 'Musterhausen')
cy.get('#billingAddressAddressCountry').select('Germany')
cy.get('#billingAddressAddressCountryState').select('Berlin')
cy.get('.register-form').submit()
})
How can i send a form within the storefront without having the CSRF issue?
I also tried to register a user - But still the same problem with the CSRF token.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.