Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Nov 7, 2021
1 parent ac25d44 commit f730676
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions test/source/tests/gmail.ts
Expand Up @@ -51,7 +51,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
if (params.offline) {
await composeBox.page.setOfflineMode(true); // go offline mode
}
await Util.sleep(5); // the draft isn't being saved if start typing without this delay
await Util.sleep(4); // the draft isn't being saved if start typing without this delay
await composeBox.type('@input-body', content, true);
if (params.offline) {
await ComposePageRecipe.waitWhenDraftIsSavedLocally(composeBox);
Expand Down Expand Up @@ -253,7 +253,7 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
await gmailPage.waitAndClick('#fc_offline_drafts a');
// compose draft 2 should be first in list as drafts are sorted by date descending
const draft = await pageHasSecureDraft(gmailPage, 'compose draft 2');
await Util.sleep(5); // the draft isn't being saved if start typing without this delay
await Util.sleep(4); // the draft isn't being saved if start typing without this delay
await draft.type('@input-body', 'trigger saving a draft to the cloud', true);
await ComposePageRecipe.waitWhenDraftIsSaved(draft);
// after draft 2 is saved to the cloud, it should be removed from offline drafts
Expand Down
17 changes: 2 additions & 15 deletions test/source/tests/page-recipe/compose-page-recipe.ts
Expand Up @@ -8,7 +8,6 @@ import { EvaluateFn } from 'puppeteer';
import { PageRecipe } from './abstract-page-recipe';
import { Util } from '../../util';
import { expect } from 'chai';
import { Page } from 'puppeteer';

type RecipientType = "to" | "cc" | "bcc";
type Recipients = {
Expand Down Expand Up @@ -107,23 +106,11 @@ export class ComposePageRecipe extends PageRecipe {
}

public static waitWhenDraftIsSaved = async (composePageOrFrame: Controllable) => {
try {
await composePageOrFrame.verifyContentIsPresentContinuously('@send-btn-note', 'Saved');
} catch (e) {
console.log('waitWhenDraftIsSaved');
console.log(e);
console.log(await (composePageOrFrame.target as Page).screenshot({ encoding: 'base64' }));
}
await composePageOrFrame.verifyContentIsPresentContinuously('@send-btn-note', 'Saved');
}

public static waitWhenDraftIsSavedLocally = async (composePageOrFrame: Controllable) => {
try {
await composePageOrFrame.verifyContentIsPresentContinuously('@send-btn-note', 'Draft saved locally (offline)');
} catch (e) {
console.log('waitWhenDraftIsSaved');
console.log(e);
console.log(await (composePageOrFrame.target as Page).screenshot({ encoding: 'base64' }));
}
await composePageOrFrame.verifyContentIsPresentContinuously('@send-btn-note', 'Draft saved locally (offline)');
}

public static sendAndClose = async (
Expand Down

0 comments on commit f730676

Please sign in to comment.