-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05d72cf
commit e600030
Showing
20 changed files
with
8,536 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/tests/Cypress/node_modules/ | ||
/tests/Cypress/cypress/screenshots | ||
/tests/Cypress/cypress/videos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
experimentalStudio: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Cypress.Commands.add('loginAsAdmin', () => { | ||
cy.visit('admin#/login'); | ||
cy.get('#sw-field--username').type('admin'); | ||
cy.get('#sw-field--password').type('shopware'); | ||
cy.get('.sw-button').click(); | ||
|
||
cy.url().should('include', 'dashboard'); | ||
}); | ||
|
||
Cypress.Commands.add('goToSettings', () => { | ||
cy.get('[data-testid="sw-icon__regular-cog"]').click({force: true}); | ||
cy.contains('Settings'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Cypress.Commands.add('register', (data) => { | ||
cy.url().should('include', 'checkout/register') | ||
|
||
if (data.asCommercial) { | ||
cy.get('#accountType').select('Commercial'); | ||
} | ||
|
||
cy.get('#personalSalutation').select('Mr.'); | ||
cy.get('#personalFirstName').type('Cypress'); | ||
cy.get('#personalLastName').type('Test'); | ||
if (data.withBirthday) { | ||
cy.get('#personalBirthday').select('1'); | ||
cy.get(':nth-child(5) > :nth-child(2) > .custom-select').select('1'); | ||
cy.get(':nth-child(3) > .custom-select').select('2000'); | ||
} | ||
|
||
if (data.withGender) { | ||
cy.get('#better_payment_customer_gender').select('m'); | ||
} | ||
|
||
// cy.get('.register-personal > .custom-control > .custom-control-label').click(); | ||
// cy.get('#personalGuest').check(); | ||
cy.get('#personalMail').type('[email protected]'); | ||
cy.get('#billingAddressAddressStreet').type('Main street'); | ||
cy.get('#billingAddressAddressZipcode').type('1234567'); | ||
cy.get('#billingAddressAddressCity').type('White city'); | ||
cy.get('#billingAddressAddressCountry').select('Germany'); | ||
cy.get('#billingAddressAddressCountryState').select('Hamburg'); | ||
cy.get('#billingAddressAddressPhoneNumber').type('1234567'); | ||
cy.get('.register-submit > .btn').click(); | ||
}); | ||
|
||
Cypress.Commands.add('buyProduct', () => { | ||
// TODO: improve url and path access, consider below lines | ||
// cy.visit('/'); | ||
// cy.get('.main-navigation-link-text > span').first().click(); | ||
|
||
cy.visit('Clothing/'); | ||
cy.contains('Add to shopping cart').first().click(); | ||
cy.contains('Go to checkout').click(); | ||
}) | ||
|
||
Cypress.Commands.add('selectPaymentMethod', (name) => { | ||
cy.url().should('include', 'checkout/confirm'); | ||
|
||
// show more button in case payment method name is not shown | ||
if (cy.get('.confirm-checkout-collapse-trigger-label')) { | ||
cy.get('.confirm-checkout-collapse-trigger-label').click(); | ||
} | ||
|
||
cy.contains(name).click(); | ||
}) |
14 changes: 14 additions & 0 deletions
14
tests/Cypress/cypress/e2e/administration/installers/custom-field.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
describe('Custom fields are installed', () => { | ||
it('successfully installed customer gender custom field', () => { | ||
cy.loginAsAdmin().goToSettings(); | ||
|
||
// Go to Custom Fields | ||
cy.get('.sw-settings__tab-system').click(); | ||
cy.get('[data-testid="sw-icon__regular-bars-square"]').click(); | ||
|
||
// Check custom field is defined correctly | ||
cy.contains('Better Payment Customer').click(); | ||
cy.contains('Gender').click(); | ||
cy.get('#sw-field--currentCustomField-name').should('have.value', 'better_payment_customer_gender'); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
tests/Cypress/cypress/e2e/administration/installers/payment-method.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe('Payment Methods are installed', () => { | ||
it('successfully installed Payment Methods', () => { | ||
cy.loginAsAdmin().goToSettings(); | ||
|
||
// Go to Payment Methods | ||
cy.get('[data-testid="sw-icon__regular-credit-card"]').click(); | ||
|
||
const paymentMethods = [ | ||
'Invoice', | ||
'Invoice B2B', | ||
'SEPA Direct Debit', | ||
'SEPA Direct Debit B2B', | ||
'Credit Card', | ||
'PayPal', | ||
'Paydirekt', | ||
'Sofort' | ||
]; | ||
|
||
paymentMethods.forEach(paymentMethod => { | ||
cy.contains(paymentMethod + ' | Better Payment'); | ||
// TODO: find a way to check if they are active (active toggle turned on) | ||
}); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
tests/Cypress/cypress/e2e/administration/installers/rule.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
describe('Rules are installed', () => { | ||
it('successfully installed private customer rule', () => { | ||
cy.loginAsAdmin().goToSettings(); | ||
|
||
// Go to Rule Builder | ||
cy.get('[data-testid="sw-icon__regular-rule"]').click(); | ||
|
||
// Search for Private Customer Role | ||
cy.get('.sw-search-bar__input').type('Private Customer'); | ||
cy.contains('Private Customer').click({force: true}); | ||
|
||
// Check rule defined correctly | ||
cy.get('.sw-single-select__selection-text').first().contains('Commercial customer'); | ||
cy.get('.sw-single-select__selection-text').last().contains('No'); | ||
|
||
// Check rule assigned to Payment Methods correctly | ||
cy.get('.sw-settings-rule-detail__tab-item-assignments').click(); | ||
cy.get('.sw-settings-rule-detail-assignments__card-payment_method').scrollIntoView().contains('Invoice'); | ||
cy.get('.sw-settings-rule-detail-assignments__card-payment_method').scrollIntoView().contains('SEPA Direct Debit'); | ||
}); | ||
|
||
it('successfully installed commercial customer rule', () => { | ||
cy.loginAsAdmin().goToSettings(); | ||
|
||
// Go to Rule Builder settings | ||
cy.get('[data-testid="sw-icon__regular-rule"]').click(); | ||
|
||
// Search for Commercial Customer Role | ||
cy.get('.sw-search-bar__input').type('Commercial Customer'); | ||
cy.contains('Commercial Customer').click({force: true}); | ||
|
||
// Check rule defined correctly | ||
cy.get('.sw-single-select__selection-text').first().contains('Commercial customer'); | ||
cy.get('.sw-single-select__selection-text').last().contains('Yes'); | ||
|
||
// Check rule assigned to Payment Methods correctly | ||
cy.get('.sw-settings-rule-detail__tab-item-assignments').click(); | ||
cy.get('.sw-settings-rule-detail-assignments__card-payment_method').scrollIntoView().contains('Invoice B2B'); | ||
cy.get('.sw-settings-rule-detail-assignments__card-payment_method').scrollIntoView().contains('SEPA Direct Debit B2B'); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
tests/Cypress/cypress/e2e/administration/settings/login-signup.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
describe('Log-in & sign-up flags are set', () => { | ||
it('successfully set login & signup flags', () => { | ||
cy.loginAsAdmin().goToSettings(); | ||
|
||
// Go to Log-in & Sign-up | ||
cy.get('[data-testid="sw-icon__regular-sign-in"]').click(); | ||
|
||
cy.get('[name="core.loginRegistration.showPhoneNumberField"]').siblings().first().should('have.css', 'background', 'rgb(24, 158, 255)'); | ||
cy.get('[name="core.loginRegistration.showAccountTypeSelection"]').siblings().first().should('have.css', 'background', 'rgb(24, 158, 255)'); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
tests/Cypress/cypress/e2e/storefront/payment-methods/credit-card.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe('Credit Card test', () => { | ||
it('valid payment', () => { | ||
cy.buyProduct(); | ||
cy.register({ | ||
asCommercial: false, | ||
withBirthday: false, | ||
withGender: false, | ||
}); | ||
cy.selectPaymentMethod('Credit Card'); | ||
|
||
cy.get('#tos').check(); | ||
cy.get('#confirmFormSubmit').click(); | ||
|
||
cy.origin('https://testapi.betterpayment.de', () => { | ||
cy.url().should('include', 'payment'); | ||
cy.contains('Pay Now'); | ||
cy.contains('Cancel'); | ||
}) | ||
}) | ||
}) |
19 changes: 19 additions & 0 deletions
19
tests/Cypress/cypress/e2e/storefront/payment-methods/paydirekt.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('Paydirekt test', () => { | ||
it('valid payment', () => { | ||
cy.buyProduct(); | ||
cy.register({ | ||
asCommercial: false, | ||
withBirthday: false, | ||
withGender: false, | ||
}); | ||
cy.selectPaymentMethod('Paydirekt'); | ||
|
||
cy.get('#tos').check(); | ||
cy.get('#confirmFormSubmit').click(); | ||
|
||
cy.origin('https://sandbox.paydirekt.de', () => { | ||
cy.url().should('include', 'checkout'); | ||
cy.contains('Better Payment Germany'); | ||
}) | ||
}) | ||
}) |
18 changes: 18 additions & 0 deletions
18
tests/Cypress/cypress/e2e/storefront/payment-methods/paypal.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe('PayPal test', () => { | ||
it('valid payment', () => { | ||
cy.buyProduct(); | ||
cy.register({ | ||
asCommercial: false, | ||
withBirthday: false, | ||
withGender: false, | ||
}); | ||
cy.selectPaymentMethod('PayPal'); | ||
|
||
cy.get('#tos').check(); | ||
cy.get('#confirmFormSubmit').click(); | ||
|
||
cy.origin('https://www.sandbox.paypal.com', () => { | ||
cy.url().should('include', 'paypal'); | ||
}) | ||
}) | ||
}) |
21 changes: 21 additions & 0 deletions
21
tests/Cypress/cypress/e2e/storefront/payment-methods/sepa-direct-debit.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe('Paydirekt test', () => { | ||
it('valid private customer payment', () => { | ||
cy.buyProduct(); | ||
cy.register({ | ||
asCommercial: false, | ||
withBirthday: false, | ||
withGender: false, | ||
}); | ||
|
||
cy.selectPaymentMethod('SEPA Direct Debit'); | ||
|
||
// SEPA direct debit specific fields | ||
cy.get('#betterpayment_iban').type('IBAN 1234567'); | ||
cy.get('#betterpayment_bic').type('BIC 1234567'); | ||
cy.get('#agreement').check(); | ||
|
||
cy.get('#tos').check(); | ||
cy.get('#confirmFormSubmit').click(); | ||
|
||
}) | ||
}) |
18 changes: 18 additions & 0 deletions
18
tests/Cypress/cypress/e2e/storefront/payment-methods/sofort.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe('Sofort test', () => { | ||
it('valid payment', () => { | ||
cy.buyProduct(); | ||
cy.register({ | ||
asCommercial: false, | ||
withBirthday: false, | ||
withGender: false, | ||
}); | ||
cy.selectPaymentMethod('Sofort'); | ||
|
||
cy.get('#tos').check(); | ||
cy.get('#confirmFormSubmit').click(); | ||
|
||
cy.origin('https://www.sofort.com', () => { | ||
cy.url().should('include', 'sofort'); | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@shopware-ag/e2e-testsuite-platform/cypress/plugins'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import '../commands/administration' | ||
import '../commands/storefront' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Require test suite commands | ||
require('@shopware-ag/e2e-testsuite-platform/cypress/support'); |
Oops, something went wrong.