Fixed Playwright test not awaiting Stripe setup

no issue

The test closed the setup modal to fast, which caused the @task to be cancelled and the save would not complete (portalPlans not saved).
This commit is contained in:
Simon Backx 2023-01-31 11:25:46 +01:00
parent a85c2ad3d6
commit 62ab5073ac
3 changed files with 6 additions and 6 deletions

View File

@ -56,7 +56,7 @@
{{else}}
{{#if (and this.stripeConnectAccountId (not this.saveStripeSettingsTask.isRunning))}}
<button type="button" class="gh-btn gh-btn-large gh-btn-stripe-disconnect" {{on "click" this.openDisconnectStripeModal}}><span>Disconnect</span></button>
<button type="button" class="gh-btn gh-btn-large gh-btn-stripe-disconnect" data-test-button="stripe-disconnect" {{on "click" this.openDisconnectStripeModal}}><span>Disconnect</span></button>
<div class="gh-stripe-connected-container">
<div class="gh-logos-stripe-connect">
<div class="gh-logo-squircle" style="background-image:url(assets/img/orb-squircle.png);"></div>

View File

@ -91,8 +91,7 @@ test.describe('Portal Settings', () => {
await page.goto(portalUrl);
// expect stripe checkout to have opeened
await page.waitForNavigation();
await expect(page).toHaveURL(/^https:\/\/checkout.stripe.com/);
await page.waitForURL(/^https:\/\/checkout.stripe.com/);
});
test('can open portal directly on yearly signup', async ({page}) => {
@ -112,8 +111,7 @@ test.describe('Portal Settings', () => {
await page.goto(portalUrl);
// expect stripe checkout to have opeened
await page.waitForNavigation();
await expect(page).toHaveURL(/^https:\/\/checkout.stripe.com/);
await page.waitForURL(/^https:\/\/checkout.stripe.com/);
});
});
});

View File

@ -1,5 +1,5 @@
const DataGenerator = require('../../utils/fixtures/data-generator');
const {test} = require('@playwright/test');
const {expect, test} = require('@playwright/test');
const ObjectID = require('bson-objectid').default;
const {promisify} = require('util');
const {exec} = require('child_process');
@ -107,6 +107,8 @@ const setupStripe = async (page, stripConnectIntegrationToken) => {
}
await page.getByPlaceholder('Paste your secure key here').first().fill(stripConnectIntegrationToken);
await page.getByRole('button', {name: 'Save Stripe settings'}).click();
// We need to wait for the saving to succeed
await expect(page.locator('[data-test-button="stripe-disconnect"]')).toBeVisible();
await page.locator('[data-test-button="close-stripe-connect"]').click();
};