(core) Fix several flaky tests.

Summary:
- Fix flaky SamplesWS test, which was occasionally clicking a disabled button
- Increase timeout on backupSqliteDatabase test, which sometimes times out
- Fix a little flakiness in ExportSection test.
- Fix flaky Billing test by adjusting behavior slightly.

In Billing, when re-fetching subscription (e.g. on navigating back), we now
unset it while the fetch is pending, so that billing pages show a spinner or
"Fetching..." messages. This also gives tests something to wait for.

Also adjusts Billing styles on the "Fetching..." messages to make them look
different from regular text.

Test Plan: Mainly making exising tests more robust. Billing changes exercised by existing tests.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2920
This commit is contained in:
Dmitry S 2021-07-19 09:58:29 -04:00
parent 1b760d83a9
commit 67aca9ccf6
2 changed files with 5 additions and 2 deletions

View File

@ -239,6 +239,9 @@ export class BillingModelImpl extends Disposable implements BillingModel {
private async _fetchSubscription(forceReload: boolean = false): Promise<void> {
if (forceReload || this.subscription.get() === undefined) {
try {
// Unset while fetching for forceReload, so that the user (and tests) can tell that a
// fetch is pending.
this.subscription.set(undefined);
const sub = await this._billingAPI.getSubscription();
bundleChanges(() => {
this.plans.set(sub.plans);

View File

@ -557,7 +557,7 @@ export class BillingPage extends Disposable {
testId('company-address-country')
)
) : null,
] : 'Fetching address...'
] : css.billingHintText('Fetching address...')
);
}
@ -568,7 +568,7 @@ export class BillingPage extends Disposable {
css.summaryHeader(
css.billingBoldText(`Payment Card`),
),
'Fetching card preview...'
css.billingHintText('Fetching card preview...')
);
} else if (card) {
// There is a card attached to the account.