Skip to content

Commit

Permalink
(core) Fix several flaky tests.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dsagal committed Jul 19, 2021
1 parent 1b760d8 commit 67aca9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/client/models/BillingModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions app/client/ui/BillingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export class BillingPage extends Disposable {
testId('company-address-country')
)
) : null,
] : 'Fetching address...'
] : css.billingHintText('Fetching address...')
);
}

Expand All @@ -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.
Expand Down

0 comments on commit 67aca9c

Please sign in to comment.