Skip to content

Commit

Permalink
NTR - Remove flaky ADCD abort payment test
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisGarding committed Jun 26, 2023
1 parent c2456e0 commit 88b268c
Showing 1 changed file with 0 additions and 81 deletions.
81 changes: 0 additions & 81 deletions Tests/E2E/test/pay_with_acdc.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,85 +91,4 @@ test.describe('Pay with credit card', () => {

await expect(page.locator('.teaser--title')).toHaveText(/Vielen Dank für Ihre Bestellung bei Shopware Demo/);
});

test('Buy a product with a credit card wich is secured and abort the payment process', async({ page }) => {
await loginHelper.login(page);

// Buy Product
await page.goto('genusswelten/edelbraende/9/special-finish-lagerkorn-x.o.-32', { waitUntil: 'load' });
await page.click('.buybox--button');

// Go to checkout
await page.click('.button--checkout');
await expect(page).toHaveURL(/.*checkout\/confirm/);

// Change payment
await page.click('.btn--change-payment');
const selector = await getPaypalPaymentMethodSelector.getSelector(
getPaypalPaymentMethodSelector.paymentMethodNames.SwagPaymentPayPalUnifiedAdvancedCreditDebitCard
);

if (!await page.locator(selector).isChecked()) {
await page.locator(selector).check();
await page.waitForLoadState('load');
}

await page.click('text=Weiter >> nth=1');
await page.waitForLoadState('load');

await page.waitForTimeout(1000);
if (await page.getByText(/Invalides Formular-Token!/).count() > 0) {
await page.goBack();
await page.click('text=Weiter >> nth=1');
await page.waitForLoadState('load');
}

await expect(page.locator('.payment--description')).toHaveText('Kredit- oder Debitkarte');
await page.click('input[name="sAGB"]');

const numberFieldFrame = await page.frameLocator('#braintree-hosted-field-number');
await numberFieldFrame.locator('#credit-card-number').type(credentials.paypalCreditCard);

const expirationDateField = await page.frameLocator('#braintree-hosted-field-expirationDate');
await expirationDateField.locator('#expiration').type('0530');

const cvvField = await page.frameLocator('#braintree-hosted-field-cvv');
await cvvField.locator('#cvv').type('123');

await page.waitForLoadState('load');

await page.waitForTimeout(1000);

await Promise.all([
page.waitForResponse(/.*threeDSLookUp.*/),
page.waitForResponse(/.*three_ds_ddc.*/),
page.waitForResponse(/.*jwt.*/),
page.click('button:has-text("Zahlungspflichtig bestellen")')
]);

const contingencyHandlerIFrame = await page.frameLocator('iframe[title~="payments_sdk_contingency_handler"]');
const threeDSecureIFrame = await contingencyHandlerIFrame.frameLocator('iframe[id="threedsIframeV2"]');
const cardinalStepUpIFrame = await threeDSecureIFrame.frameLocator('iframe[id^="cardinal-stepUpIframe"]');
const cancelForm = await cardinalStepUpIFrame.locator('form[name="cancel"]');

await cookieHelper.acceptCookies(contingencyHandlerIFrame);

const cancelButton = await cancelForm.locator('input[type="submit"]');
await cancelButton.scrollIntoViewIfNeeded();
await page.waitForTimeout(1000);
await cancelButton.click();

const contingencyHandlerWrapper = await page.locator('div[id~="payments-sdk-contingency-handler"]');
await contingencyHandlerWrapper.waitFor({ state: 'detached' });

await expect(page.locator('.step--confirm.is--active')).toBeVisible();

const paypalUnifiedErrorMessageContainer = await page.locator('.paypal-unified--error');
await expect(paypalUnifiedErrorMessageContainer).toBeVisible();

const messageContainer = await page.locator('.paypal-unified--error >> .alert--content');
await messageContainer.scrollIntoViewIfNeeded();

await expect(messageContainer).toHaveText(/.*Während der Sicherheitsüberprüfung Ihrer Kreditkarte ist etwas schief gelaufen. Bitte versuchen Sie es erneut.*/);
});
});

0 comments on commit 88b268c

Please sign in to comment.