Skip to content

Commit d786452

Browse files
ozyxunlikelyzero
andauthored
cherry-pick(#7806): chore: re-enable perf/mem tests on PR + fix broken locator in imagery perf test (#7812)
chore: re-enable perf/mem tests on PR + fix broken locator in imagery perf test (#7806) * test: fix broken locator in imagery perf test * Prevent this from happening * make rule explicit * test: maintain `locator()` pattern for contract tests * test(couchdb): try some new techniques to stabilize the test * Revert "test(couchdb): try some new techniques to stabilize the test" This reverts commit 9aa1ea9. * chore: revert to `networkidle` and disable eslint rule * test: add `@network` annotation for tests with real network requests --------- Co-authored-by: Hill, John (ARC-TI)[KBR Wyle Services, LLC] <[email protected]>
1 parent 0413e77 commit d786452

File tree

8 files changed

+45
-28
lines changed

8 files changed

+45
-28
lines changed

.circleci/config.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ executors:
88
- image: mcr.microsoft.com/playwright:v1.45.2-focal
99
environment:
1010
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
11-
PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
12-
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
11+
PERCY_POSTINSTALL_BROWSER: "true" # Needed to store the percy browser in cache deps
12+
PERCY_LOGLEVEL: "debug" # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
1313
PERCY_PARALLEL_TOTAL: 2
1414
ubuntu:
1515
machine:
1616
image: ubuntu-2204:current
1717
docker_layer_caching: true
1818
commands:
1919
build_and_install:
20-
description: 'All steps used to build and install.'
20+
description: "All steps used to build and install."
2121
parameters:
2222
node-version:
2323
type: string
@@ -27,7 +27,7 @@ commands:
2727
node-version: << parameters.node-version >>
2828
- node/install-packages
2929
generate_and_store_version_and_filesystem_artifacts:
30-
description: 'Track important packages and files'
30+
description: "Track important packages and files"
3131
steps:
3232
- run: |
3333
[[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
@@ -38,7 +38,7 @@ commands:
3838
- store_artifacts:
3939
path: /tmp/artifacts/
4040
generate_e2e_code_cov_report:
41-
description: 'Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test'
41+
description: "Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test"
4242
parameters:
4343
suite:
4444
type: string
@@ -102,7 +102,7 @@ jobs:
102102
node-version: lts/hydrogen
103103
- when: #Only install chrome-beta when running the 'full' suite to save $$$
104104
condition:
105-
equal: ['full', <<parameters.suite>>]
105+
equal: ["full", <<parameters.suite>>]
106106
steps:
107107
- run: npx playwright install chrome-beta
108108
- run:
@@ -259,6 +259,8 @@ workflows:
259259
- visual-a11y:
260260
name: visual-a11y-ci
261261
suite: ci
262+
- perf-test
263+
- mem-test
262264

263265
the-nightly: #These jobs do not run on PRs, but against master at night
264266
jobs:
@@ -282,7 +284,7 @@ workflows:
282284
- e2e-couchdb
283285
triggers:
284286
- schedule:
285-
cron: '0 0 * * *'
287+
cron: "0 0 * * *"
286288
filters:
287289
branches:
288290
only:

e2e/.eslintrc.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ module.exports = {
2020
'playwright/no-get-by-title': 'error',
2121
'playwright/prefer-comparison-matcher': 'error'
2222
}
23+
},
24+
{
25+
// Disable no-raw-locators for .contract.perf.spec.js files until https://github.com/grafana/xk6-browser/issues/1226
26+
files: ['**/*.contract.perf.spec.js'],
27+
rules: {
28+
'playwright/no-raw-locators': 'off'
29+
}
2330
}
2431
]
2532
};

e2e/tests/functional/forms.e2e.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ test.describe('Persistence operations @addInit', () => {
130130
});
131131
});
132132

133-
test.describe('Persistence operations @couchdb', () => {
133+
test.describe('Persistence operations @couchdb @network', () => {
134134
test.use({ failOnConsoleError: false });
135135
test('Editing object properties should generate a single persistence operation', async ({
136136
page
@@ -170,7 +170,7 @@ test.describe('Persistence operations @couchdb', () => {
170170
})
171171
.toEqual(1);
172172
});
173-
test('Can create an object after a conflict error @couchdb @2p', async ({
173+
test('Can create an object after a conflict error @couchdb @network @2p', async ({
174174
page,
175175
openmctConfig
176176
}) => {

e2e/tests/functional/plugins/displayLayout/displayLayout.e2e.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ test.describe('Display Layout', () => {
429429
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
430430
});
431431

432-
test('When multiple plots are contained in a layout, we only ask for annotations once @couchdb', async ({
432+
test('When multiple plots are contained in a layout, we only ask for annotations once @couchdb @network', async ({
433433
page
434434
}) => {
435435
await setFixedTimeMode(page);

e2e/tests/functional/plugins/notebook/notebookWithCouchDB.e2e.spec.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,26 @@
2424
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks with CouchDB.
2525
*/
2626

27+
/**
28+
* Disable no-networkidle eslint rule until we can engineer more deterministic network-event
29+
* driven tests.
30+
*/
31+
/* eslint-disable playwright/no-networkidle */
32+
2733
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
2834
import * as nbUtils from '../../../../helper/notebookUtils.js';
2935
import { expect, test } from '../../../../pluginFixtures.js';
3036

31-
test.describe('Notebook Tests with CouchDB @couchdb', () => {
37+
test.describe('Notebook Tests with CouchDB @couchdb @network', () => {
3238
let testNotebook;
3339

3440
test.beforeEach(async ({ page }) => {
35-
//Navigate to baseURL
36-
await page.goto('./', { waitUntil: 'domcontentloaded' });
41+
// Navigate to baseURL
42+
await page.goto('./', { waitUntil: 'networkidle' });
3743

3844
// Create Notebook
3945
testNotebook = await createDomainObjectWithDefaults(page, { type: 'Notebook' });
40-
await page.goto(testNotebook.url, { waitUntil: 'domcontentloaded' });
46+
await page.goto(testNotebook.url, { waitUntil: 'networkidle' });
4147
});
4248

4349
test('Inspect Notebook Entry Network Requests', async ({ page }) => {
@@ -58,7 +64,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
5864
page.getByLabel('Add Page').click()
5965
]);
6066
// Ensures that there are no other network requests
61-
await page.waitForLoadState('domcontentloaded');
67+
await page.waitForLoadState('networkidle');
6268

6369
// Assert that only two requests are made
6470
// Network Requests are:
@@ -77,7 +83,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
7783
// 2) The shared worker event from 👆 POST request
7884
notebookElementsRequests = [];
7985
await nbUtils.enterTextEntry(page, 'First Entry');
80-
await page.waitForLoadState('domcontentloaded');
86+
await page.waitForLoadState('networkidle');
8187
expect(notebookElementsRequests.length).toBeLessThanOrEqual(2);
8288

8389
// Add some tags
@@ -141,7 +147,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
141147
// 4) The shared worker event from 👆 POST request
142148
notebookElementsRequests = [];
143149
await nbUtils.enterTextEntry(page, 'Fourth Entry');
144-
page.waitForLoadState('domcontentloaded');
150+
page.waitForLoadState('networkidle');
145151

146152
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
147153

@@ -153,7 +159,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
153159
// 4) The shared worker event from 👆 POST request
154160
notebookElementsRequests = [];
155161
await nbUtils.enterTextEntry(page, 'Fifth Entry');
156-
page.waitForLoadState('domcontentloaded');
162+
page.waitForLoadState('networkidle');
157163

158164
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
159165

@@ -164,7 +170,7 @@ test.describe('Notebook Tests with CouchDB @couchdb', () => {
164170
// 4) The shared worker event from 👆 POST request
165171
notebookElementsRequests = [];
166172
await nbUtils.enterTextEntry(page, 'Sixth Entry');
167-
page.waitForLoadState('domcontentloaded');
173+
page.waitForLoadState('networkidle');
168174

169175
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
170176
});
@@ -227,7 +233,7 @@ async function addTagAndAwaitNetwork(page, tagName) {
227233
page.locator(`[aria-label="Autocomplete Options"] >> text=${tagName}`).click(),
228234
expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeVisible()
229235
]);
230-
await page.waitForLoadState('domcontentloaded');
236+
await page.waitForLoadState('networkidle');
231237
}
232238

233239
/**
@@ -246,5 +252,5 @@ async function removeTagAndAwaitNetwork(page, tagName) {
246252
)
247253
]);
248254
await expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeHidden();
249-
await page.waitForLoadState('domcontentloaded');
255+
await page.waitForLoadState('networkidle');
250256
}

e2e/tests/functional/search.e2e.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ test.describe('Grand Search', () => {
168168
await expect(page.getByText('No results found')).toBeVisible();
169169
});
170170

171-
test('Validate single object in search result @couchdb', async ({ page }) => {
171+
test('Validate single object in search result @couchdb @network', async ({ page }) => {
172172
// Create a folder object
173173
const folderName = uuid();
174174
await createDomainObjectWithDefaults(page, {
@@ -191,7 +191,7 @@ test.describe('Grand Search', () => {
191191
await expect(searchResults).toContainText(folderName);
192192
});
193193

194-
test('Search results are debounced @couchdb', async ({ page }) => {
194+
test('Search results are debounced @couchdb @network', async ({ page }) => {
195195
test.info().annotations.push({
196196
type: 'issue',
197197
description: 'https://github.com/nasa/openmct/issues/6179'
@@ -221,7 +221,9 @@ test.describe('Grand Search', () => {
221221
await expect(page.getByRole('list', { name: 'Object Results' })).toContainText('Clock A');
222222
});
223223

224-
test('Slowly typing after search debounce will abort requests @couchdb', async ({ page }) => {
224+
test('Slowly typing after search debounce will abort requests @couchdb @network', async ({
225+
page
226+
}) => {
225227
let requestWasAborted = false;
226228
await createObjectsForSearch(page);
227229
page.on('requestfailed', (request) => {

e2e/tests/functional/tree.e2e.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test.describe('Main Tree', () => {
2828
await page.goto('./', { waitUntil: 'domcontentloaded' });
2929
});
3030

31-
test('Creating a child object within a folder and immediately opening it shows the created object in the tree @couchdb', async ({
31+
test('Creating a child object within a folder and immediately opening it shows the created object in the tree @couchdb @network', async ({
3232
page
3333
}) => {
3434
test.info().annotations.push({
@@ -88,7 +88,7 @@ test.describe('Main Tree', () => {
8888
).toBeVisible();
8989
});
9090

91-
test('Creating a child object on one tab and expanding its parent on the other shows the correct composition @couchdb @2p', async ({
91+
test('Creating a child object on one tab and expanding its parent on the other shows the correct composition @couchdb @network @2p', async ({
9292
page
9393
}) => {
9494
test.info().annotations.push({
@@ -187,7 +187,7 @@ test.describe('Main Tree', () => {
187187
]);
188188
});
189189
});
190-
test('Opening and closing an item before the request has been fulfilled will abort the request @couchdb', async ({
190+
test('Opening and closing an item before the request has been fulfilled will abort the request @couchdb @network', async ({
191191
page
192192
}) => {
193193
let requestWasAborted = false;

e2e/tests/performance/contract/imagery.contract.perf.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ test.describe('Performance tests', () => {
164164
await page.evaluate(() => window.performance.mark('background-image-visible'));
165165

166166
// Get Current number of images in thumbstrip
167-
await page.locator('.c-imagery__thumb').waitFor({ state: 'visible' });
167+
await expect(page.locator('.c-imagery__thumb').last()).toBeInViewport();
168168
const thumbCount = await page.locator('.c-imagery__thumb').count();
169169
console.log('number of thumbs rendered ' + thumbCount);
170170
await page.locator('.c-imagery__thumb').last().click();

0 commit comments

Comments
 (0)