Giter VIP home page Giter VIP logo

e2e-testsuite-platform's Issues

Please add delete method

Hi,

could you please add "delete" method to:
e2e-testsuite-platform/cypress/support/service/administration/fixture.service.js

Thanks a lot :)

Axios update

The test-suit currently uses a vulnerable version of axios. See here:

GHSA-cph5-m8f7-6c5x

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

Shopware version and Testsuite version compatibility

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) => {

SearchAdminViaAPI always returns empty array in gitlab CI

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?

Environment variable for API versioning in Shopware

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

package-lock.json modified after first installation

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

uuid version and support index.js require seems not working

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');

BUG: cy.createGuestOrder(product, UserData) & QUESTION: /checkout/register e2e test

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

  • /billingAddress/street
  • /billingAddress/zipcode
  • /billingAddress/city

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.

  • cy.getRandomProductInformationForCheckout()
  • cy.createCustomerFixture()
  • cy.createGuestOrder(product.id, customer) (This was a test)
  • cy.visit('/checkout/register');

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

  • fixtures/customer.json
  • customer-address.json
  • storefront-custumer.json
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')
    });
});

Storefront: The provided CSRF token is not valid

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.

Login Test
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() 
      })
Register Test
    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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.