Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
unlikelyzero committed Sep 18, 2024
1 parent eb65f10 commit c90d493
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 52 deletions.
29 changes: 18 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: all clone-quickstart setup-quickstart setup-openmct-yamcs sanity-test build-example test-getopensource test-e2e clean
.PHONY: all clone-quickstart install-quickstart start-quickstart install-openmct-yamcs sanity-test build-example test-getopensource test-e2e clean

all: clone-quickstart setup-quickstart setup-openmct-yamcs sanity-test build-example test-getopensource test-e2e
all: clone-quickstart install-quickstart install-openmct-yamcs sanity-test build-example test-getopensource test-e2e

clone-quickstart:
@echo "Running target: clone-quickstart"
Expand All @@ -11,12 +11,22 @@ clone-quickstart:
echo "Directory 'quickstart' already exists."; \
fi

setup-quickstart:
@echo "Running target: setup-quickstart"
cd quickstart/docker && make wait-for-sent
install-quickstart:
@echo "Running target: install-quickstart"
@cd quickstart/docker && $(MAKE) wait-for-sent

setup-openmct-yamcs:
@echo "Running target: setup-openmct-yamcs"
start-quickstart:
@echo "Running target: start-quickstart"
@cd quickstart/docker && $(MAKE) all

restart-quickstart:
@echo "Running target: reset-quickstart"
@cd quickstart/docker && $(MAKE) yamcs-down
@cd quickstart/docker && $(MAKE) simulator-down
@cd quickstart/docker && $(MAKE) all

install-openmct-yamcs:
@echo "Running target: install-openmct-yamcs"
npm install

sanity-test:
Expand All @@ -35,12 +45,9 @@ build-example:
npm run build:example:master || { echo "Failed to run build:example:master"; exit 1; }; \
fi

test-getopensource:
@echo "Running target: test-getopensource"
npm run test:getopensource

test-e2e:
@echo "Running target: test-e2e"
npm run test:getopensource
npm run test:e2e:quickstart:local

clean:
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"build:example": "npm install openmct@unstable --no-save",
"build:example:master": "npm install nasa/openmct#master --no-save",
"build:example:current": "npm install nasa/openmct#$(git rev-parse --abbrev-ref HEAD) --no-save --verbose",
"postbuild:example": "node check-optional-dependencies.js",
"start": "npx webpack serve --config ./.webpack/webpack.dev.js",
"start:coverage": "npx webpack serve --config ./.webpack/webpack.coverage.js",
"postbuild:example": "node check-optional-dependencies.mjs",
"start": "npx webpack serve --config ./.webpack/webpack.dev.mjs",
"start:coverage": "npx webpack serve --config ./.webpack/webpack.coverage.mjs",
"prepare": "npm run build:dist",
"test:getopensource": "sh ./tests/git-opensource-tests.sh",
"posttest:getopensource": "npm install",
"test:e2e:smoke": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.js --project=chromium quickstartSmoke",
"test:e2e:quickstart": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.js --project=chromium tests/e2e/yamcs/",
"test:e2e:quickstart:local": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.js --project=local-chrome tests/e2e/yamcs/",
"test:e2e:watch": "npm test --workspace tests/e2e/opensource -- --ui --config=../playwright-quickstart.config.js",
"test:e2e:smoke": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.mjs --project=chromium quickstartSmoke",
"test:e2e:quickstart": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.mjs --project=chromium tests/e2e/yamcs/",
"test:e2e:quickstart:local": "npm test --workspace tests/e2e/opensource -- --config=../playwright-quickstart.config.mjs --project=local-chrome tests/e2e/yamcs/",
"test:e2e:watch": "npm test --workspace tests/e2e/opensource -- --ui --config=../playwright-quickstart.config.mjs",
"wait-for-yamcs": "wait-on http-get://localhost:8090/ -v"
},
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config = {
baseURL: 'http://localhost:9000/#',
ignoreHTTPSErrors: true,
myItemsFolderName: "My Items",
failOnConsoleError: false
failOnConsoleError: true
},
webServer: {
cwd: '../',
Expand All @@ -28,7 +28,7 @@ const config = {
projects: [
{
name: "chromium",
grepInvert: /@unstable|@snapshot|@localStorage|@addInit/,
grepInvert: /@snapshot|@localStorage|@addInit/,
use: {
browserName: 'chromium',
headless: true,
Expand All @@ -40,7 +40,7 @@ const config = {
// -- Local Browsers --
{
name: "local-chrome",
grepInvert: /@unstable|@snapshot|@localStorage|@addInit/,
grepInvert: /@snapshot|@localStorage|@addInit/,
use: {
browserName: 'chromium',
channel: 'chrome'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

// import { createDomainObjectWithDefaults } from './appActions.js';
import { test, request, expect } from './opensource/pluginFixtures.js';
const { test, request, expect } = await import('./opensource/pluginFixtures.js');

/**
* The name of the "My Items" folder in the domain object tree.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
* This suite verifies the network requests made by the application to ensure correct interaction with YAMCS.
*/

import { test, expect, filterNonFetchRequests } from '../quickstartFixtures.js';
import { test, expect, filterNonFetchRequests } from '../quickstartFixtures.mjs';
import { createDomainObjectWithDefaults, setFixedTimeMode } from '../opensource/appActions.js';

test.describe('Reload action', () => {
let displayLayout;
let batchGet;
let batchGet2;
let battery1tempRequest;
let battery1tempRequestCont;
let battery1voltageRequest;
let battery1voltageRequestCont;
let allNetworkRequests = [];
let displayLayout;
let batchGetResponse;
let battery1tempResponse;
let battery1tempResponseCont;
let battery1voltageResponse;
let battery1voltageResponeCont;
let allNetworkRequests = [];
test.beforeEach(async ({ page }) => {
await page.goto('./', { waitUntil: 'domcontentloaded' });

displayLayout = await createDomainObjectWithDefaults(page, {
type: 'Display Layout'
type: 'Display Layout',
name: 'Display Layout'
});

await createDomainObjectWithDefaults(page, {
type: 'Telemetry Table',
name: 'Alpha Table'
});

//Expand the quickstart myproject twice
//Expand the quickstart myproject twice to get to the telemetry in the tree
await page.getByLabel('Expand myproject folder').click();
await page.getByLabel('Expand myproject folder').click();

Expand All @@ -74,26 +74,32 @@ test.describe('Reload action', () => {
await page.getByLabel('Edit Object', { exact: true }).click();
await page.getByLabel('Collapse myproject folder').first().click();
await page.getByLabel('Expand My Items folder').click();
await page.dragAndDrop(`text='Alpha Table'`, '.l-layout__grid-holder', {

await page.getByLabel('Preview Alpha Table table')
.dragTo(page.getByLabel('Display Layout Layout Grid').locator('div').nth(1), {
targetPosition: { x: 0, y: 0 }
});
await page.dragAndDrop(`text='Beta Table'`, '.l-layout__grid-holder', {

await page.getByLabel('Preview Beta Table table')
.dragTo(page.getByLabel('Display Layout Layout Grid').locator('div').nth(1), {
targetPosition: { x: 0, y: 250 }
});
await page.locator('button[title="Save"]').click();


await page.getByRole('button', { name: 'Save' }).click();
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();


await page.goto(displayLayout.url, { waitUntil: 'networkidle' });
//Set to 1 Minute to reduce the time the opportunity for paginated data
// await page.getByRole('menuitem', { name: /Real-Time/ }).click();

await page.getByLabel('Start offset: 00:30:00').click();
await page.getByLabel('Start offset minutes').fill('1');
await page.getByLabel('Submit time offsets').click();
await page.waitForLoadState('networkidle');
});

test.only('can reload display layout and its telemetry table children', async ({ page }) => {
test('can reload display layout and its telemetry table children', async ({ page }) => {
// Listening for all network requests and pushing them into allNetworkRequests array.
page.on('request', request => allNetworkRequests.push(request));

Expand All @@ -112,17 +118,57 @@ test.describe('Reload action', () => {
await page.waitForLoadState('networkidle');
allNetworkRequests = [];

battery1tempRequest = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Temp**')
battery1tempRequestCont = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Temp**')
batchGet = page.waitForResponse('**/api/processors/myproject/realtime/parameters:batchGet');
//Create response promises
battery1tempResponse = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Temp**')
batchGetResponse = page.waitForResponse('**/api/processors/myproject/realtime/parameters:batchGet');

//Intercept the request to /api/archive/myproject/parameters/myproject/Battery1_Temp
await page.route('**/api/archive/myproject/parameters/myproject/Battery1_Temp', async route => {
const response = await route.fetch();
const json = await response.json();

// Replace every "floatValue" with 1337
json.parameter.forEach(param => {
if (param.rawValue && param.rawValue.type === 'FLOAT') {
param.rawValue.floatValue = 1337;
}
if (param.engValue && param.engValue.type === 'FLOAT') {
param.engValue.floatValue = 1337;
}
});

console.log('Request:', JSON.stringify({
url: route.request().url(),
method: route.request().method(),
headers: route.request().headers(),
postData: route.request().postData()
}, null, 2));

console.log('Response:', JSON.stringify({
status: response.status(),
statusText: response.statusText(),
headers: response.headers(),
body: json
}, null, 2));

// Fulfill using the modified JSON object
await route.fulfill({
status: response.status(),
headers: response.headers(),
contentType: response.headers()['content-type'],
body: JSON.stringify(json)
});
});

//Click on Reload Action on Alpha Table
await page.getByLabel('Alpha Table Frame Controls').getByLabel('View menu items').click();
await page.getByLabel('Reload').click();

await Promise.all([battery1tempResponse, batchGetResponse]);

await page.getByTitle('View menu items').first().click();
await page.getByRole('menuitem', { name: /Reload/ }).click();
await Promise.all([battery1tempRequest, battery1tempRequestCont, batchGet]);
await page.waitForLoadState('networkidle');
expect(allNetworkRequests.length).toBe(2);


const afterReloadAlphaTelemetryValue = await page
.getByLabel('Alpha Table table content')
.getByLabel('value table cell')
Expand All @@ -134,21 +180,24 @@ test.describe('Reload action', () => {
.first()
.getAttribute('title');

//After reload, the telemetry value should be different for Alpha Table
expect(beforeReloadAlphaTelemetryValue).not.toEqual(afterReloadAlphaTelemetryValue);
expect(beforeReloadBetaTelemetryValue).toEqual(afterReloadBetaTelemetryValue);

// expect(beforeReloadBetaTelemetryValue).toEqual(afterReloadBetaTelemetryValue);

await page.waitForLoadState('networkidle');
allNetworkRequests = [];

battery1tempRequest = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Temp**')
battery1voltageRequest = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Voltage**')
batchGet = page.waitForResponse('**/api/processors/myproject/realtime/parameters:batchGet');
batchGet2 = page.waitForResponse('**/api/processors/myproject/realtime/parameters:batchGet');
battery1tempResponse = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Temp**')
battery1voltageResponse = page.waitForResponse('**/api/archive/myproject/parameters/myproject/Battery1_Voltage**')
batchGetResponse = page.waitForResponse('**/api/processors/myproject/realtime/parameters:batchGet');

await page.getByTitle('More actions').click();
await page.getByRole('menuitem', { name: /Reload/ }).click();
await Promise.all([battery1tempRequest, battery1voltageRequest, batchGet, batchGet2]);

await Promise.all([battery1tempResponse, battery1voltageResponse, batchGetResponse]);
await page.waitForLoadState('networkidle');
console.log(JSON.stringify(allNetworkRequests));

expect(allNetworkRequests.length).toBe(3);

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Network Specific Tests for Open MCT and YAMCS connectivity with regard to tabs
*/

import { test, expect, filterNonFetchRequests } from '../quickstartFixtures.js';
import { test, expect, filterNonFetchRequests } from '../quickstartFixtures.mjs';
import { createDomainObjectWithDefaults, setFixedTimeMode } from '../opensource/appActions.js';

test.describe('Tabs View', () => {
Expand Down

0 comments on commit c90d493

Please sign in to comment.