Skip to content

Commit

Permalink
Consolidating e2e tests to use new getEntriesAndErrors (#82)
Browse files Browse the repository at this point in the history
* Updating and cleaning up e2e tests

* fixup! Updating and cleaning up e2e tests

---------

Co-authored-by: Andrew Hyndman <[email protected]>
  • Loading branch information
kierrrrra and Andrew Hyndman authored Apr 3, 2024
1 parent 602093a commit 40d72e2
Show file tree
Hide file tree
Showing 51 changed files with 113 additions and 116 deletions.
4 changes: 2 additions & 2 deletions test/e2e/ajax1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500; // see text-mutation.html
Expand All @@ -13,7 +13,7 @@ test.describe('TTVC', () => {
});

// await entryCountIs(page, 1);
const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + AJAX_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/ajax2/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500; // see text-mutation.html
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + AJAX_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/ajax3/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500; // see text-mutation.html
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + AJAX_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/ajax4/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {entryCountIs, getEntries} from '../../util/entries';
import {entryCountIs, getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;

Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
});

await entryCountIs(page, 1, 30000);
const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/ajax5/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {test, expect} from '@playwright/test';

import {entryCountIs, getEntries} from '../../util/entries';
import {entryCountIs, getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;

Expand All @@ -17,7 +17,7 @@ test.describe('TTVC', () => {
// pass
}

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

// ttvc should never be reported
expect(entries.length).toBe(0);
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/bfcache/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 1000;

Expand All @@ -11,7 +11,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

let entries = await getEntries(page);
let {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY);
Expand All @@ -22,7 +22,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

entries = await getEntries(page);
({entries} = await getEntriesAndErrors(page));

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY);
Expand All @@ -31,7 +31,7 @@ test.describe('TTVC', () => {

await page.goBack({waitUntil: 'networkidle'});

entries = await getEntries(page);
({entries} = await getEntriesAndErrors(page));

// note: webkit clears previous values from this list on page restore
expect(entries[entries.length - 1].duration).toBeGreaterThanOrEqual(0);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/composition1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500;
Expand All @@ -13,7 +13,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);
expect(entries.length).toBe(1);

const expectedTtvc = PAGELOAD_DELAY + AJAX_DELAY + SCRIPT_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/composition2/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500;
Expand All @@ -16,7 +16,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);
expect(entries.length).toBe(1);

const expectedTtvc = PAGELOAD_DELAY + SCRIPT_DELAY + AJAX_DELAY + CPU_DELAY + SCRIPT_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/composition3/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {entryCountIs, getEntries} from '../../util/entries';
import {entryCountIs, getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500;
Expand All @@ -15,7 +15,7 @@ test.describe('TTVC', () => {
});

await entryCountIs(page, 1);
const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);
expect(entries.length).toBe(1);

const expectedTtvc = PAGELOAD_DELAY + SCRIPT_DELAY + AJAX_DELAY + CPU_DELAY + SCRIPT_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/composition4/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {entryCountIs, getEntries} from '../../util/entries';
import {entryCountIs, getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const AJAX_DELAY = 500;
Expand All @@ -14,7 +14,7 @@ test.describe('TTVC', () => {
});

await entryCountIs(page, 1);
const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);
expect(entries.length).toBe(1);

const expectedTtvc = PAGELOAD_DELAY + AJAX_DELAY + TIMEOUT_DELAY + AJAX_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cpu1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {entryCountIs, getEntries} from '../../util/entries';
import {entryCountIs, getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const CPU_DELAY = 500;
Expand All @@ -13,7 +13,7 @@ test.describe('TTVC', () => {
});

await entryCountIs(page, 1);
const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + CPU_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/error1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const IMAGE_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + IMAGE_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/error2/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const IMAGE_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
const expectedTtvc = PAGELOAD_DELAY + IMAGE_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/error3/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const SCRIPT_DELAY = 200;
Expand All @@ -14,7 +14,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
const expectedTtvc = PAGELOAD_DELAY + SCRIPT_DELAY;
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/error4/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const SCRIPT_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + SCRIPT_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/error6/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;

Expand All @@ -14,7 +14,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(errors.length).toBe(0);

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/iframe1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const IFRAME_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + IFRAME_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/iframe2/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;
const IFRAME_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + IFRAME_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/iframe3/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 200;

Expand All @@ -11,7 +11,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/images1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 1000;
const IMAGE_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + IMAGE_DELAY);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/images2/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {test, expect} from '@playwright/test';

import {FUDGE} from '../../util/constants';
import {getEntries} from '../../util/entries';
import {getEntriesAndErrors} from '../../util/entries';

const PAGELOAD_DELAY = 1000;
const IMAGE_DELAY = 500;
Expand All @@ -12,7 +12,7 @@ test.describe('TTVC', () => {
waitUntil: 'networkidle',
});

const entries = await getEntries(page);
const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeGreaterThanOrEqual(PAGELOAD_DELAY + IMAGE_DELAY);
Expand Down
Loading

0 comments on commit 40d72e2

Please sign in to comment.