Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow test data toggle to be clicked #7479

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ test.describe('Basic Condition Set Use', () => {
}) => {
const exampleTelemetry = await createExampleTelemetryObject(page);

await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();
await page.goto(conditionSet.url);
// Change the object to edit mode
await page.getByLabel('Edit Object').click();
Expand Down Expand Up @@ -378,4 +378,83 @@ test.describe('Basic Condition Set Use', () => {
await page.goto(conditionSet.url);
await expect(outputValue).toHaveText('---');
});

test('ConditionSet has correct outputs when test data is enabled', async ({ page }) => {
const exampleTelemetry = await createExampleTelemetryObject(page);

await page.getByLabel('Show selected item in tree').click();
await page.goto(conditionSet.url);
// Change the object to edit mode
await page.getByLabel('Edit Object').click();

// Create two conditions
await page.locator('#addCondition').click();
await page.locator('#addCondition').click();
await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');

// Add Telemetry to ConditionSet
const sineWaveGeneratorTreeItem = page
.getByRole('tree', {
name: 'Main Tree'
})
.getByRole('treeitem', {
name: exampleTelemetry.name
});
const conditionCollection = page.locator('#conditionCollection');
await sineWaveGeneratorTreeItem.dragTo(conditionCollection);

// Modify First Criterion
const firstCriterionTelemetry = page.locator(
'[aria-label="Criterion Telemetry Selection"] >> nth=0'
);
firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name });
const firstCriterionMetadata = page.locator(
'[aria-label="Criterion Metadata Selection"] >> nth=0'
);
firstCriterionMetadata.selectOption({ label: 'Sine' });
const firstCriterionComparison = page.locator(
'[aria-label="Criterion Comparison Selection"] >> nth=0'
);
firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0');
await firstCriterionInput.fill('0');

// Modify Second Criterion
const secondCriterionTelemetry = page.locator(
'[aria-label="Criterion Telemetry Selection"] >> nth=1'
);
await secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name });

const secondCriterionMetadata = page.locator(
'[aria-label="Criterion Metadata Selection"] >> nth=1'
);
await secondCriterionMetadata.selectOption({ label: 'Sine' });

const secondCriterionComparison = page.locator(
'[aria-label="Criterion Comparison Selection"] >> nth=1'
);
await secondCriterionComparison.selectOption({ label: 'is less than' });

const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1');
await secondCriterionInput.fill('0');

// Enable test data
await page.getByLabel('Apply Test Data').nth(1).click();
const testDataTelemetry = page.locator('[aria-label="Test Data Telemetry Selection"] >> nth=0');
await testDataTelemetry.selectOption({ label: exampleTelemetry.name });

const testDataMetadata = page.locator('[aria-label="Test Data Metadata Selection"] >> nth=0');
await testDataMetadata.selectOption({ label: 'Sine' });

const testInput = page.locator('[aria-label="Test Data Input"] >> nth=0');
await testInput.fill('0');

// Validate that the condition set is evaluating and outputting
// the correct value when the underlying telemetry subscription is active.
let outputValue = page.locator('[aria-label="Current Output Value"]');
await expect(outputValue).toHaveText('false');

await page.goto(exampleTelemetry.url);
});
});
16 changes: 8 additions & 8 deletions e2e/tests/functional/plugins/notebook/notebook.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await page
.getByRole('treeitem', { name: overlayPlot.name })
Expand All @@ -332,7 +332,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, 'Entry to drop into');
await page
Expand Down Expand Up @@ -377,7 +377,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);

Expand All @@ -404,7 +404,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);

Expand All @@ -421,7 +421,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);

Expand All @@ -438,7 +438,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, `This should be a link: ${INVALID_TEST_LINK} is it?`);

Expand All @@ -455,7 +455,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);

Expand Down Expand Up @@ -483,7 +483,7 @@ test.describe('Notebook entry tests', () => {
await page.goto(notebookObject.url);

// Reveal the notebook in the tree
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

await nbUtils.enterTextEntry(
page,
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/functional/recentObjects.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ test.describe('Recent Objects', () => {

// Navigate to the clock and reveal it in the tree
await page.goto(clock.url);
await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

// Right click the clock and create an alias using the "link" context menu action
const clockTreeItem = page
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/functional/tree.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test.describe('Main Tree', () => {
type: 'Folder'
});

await page.getByTitle('Show selected item in tree').click();
await page.getByLabel('Show selected item in tree').click();

const clock = await createDomainObjectWithDefaults(page, {
type: 'Clock',
Expand Down
17 changes: 13 additions & 4 deletions src/plugins/condition/components/TestData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<div class="c-cs__header-label c-section__label">Test Data</div>
</div>
<div v-if="expanded" class="c-cs__content">
<div class="c-cs__test-data__controls c-cdef__controls" :disabled="!telemetry.length">
<div :class="['c-cs__test-data__controls c-cdef__controls', { disabled: !telemetry.length }]">

Check warning on line 34 in src/plugins/condition/components/TestData.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/condition/components/TestData.vue#L34

Added line #L34 was not covered by tests
<label class="c-toggle-switch">
<input type="checkbox" :checked="isApplied" @change="applyTestData" />
<span class="c-toggle-switch__slider"></span>
<span class="c-toggle-switch__slider" aria-label="Apply Test Data"></span>
<span class="c-toggle-switch__label">Apply Test Data</span>
</label>
</div>
Expand All @@ -47,7 +47,11 @@
<span class="c-cs-test__label">Set</span>
<span class="c-cs-test__controls">
<span class="c-cdef__control">
<select v-model="testInput.telemetry" @change="updateMetadata(testInput)">
<select
v-model="testInput.telemetry"

Check warning on line 51 in src/plugins/condition/components/TestData.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/condition/components/TestData.vue#L51

Added line #L51 was not covered by tests
aria-label="Test Data Telemetry Selection"
@change="updateMetadata(testInput)"
>

Check warning on line 54 in src/plugins/condition/components/TestData.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/condition/components/TestData.vue#L54

Added line #L54 was not covered by tests
<option value="">- Select Telemetry -</option>
<option
v-for="(telemetryOption, index) in telemetry"
Expand All @@ -59,7 +63,11 @@
</select>
</span>
<span v-if="testInput.telemetry" class="c-cdef__control">
<select v-model="testInput.metadata" @change="updateTestData">
<select
v-model="testInput.metadata"
aria-label="Test Data Metadata Selection"

Check warning on line 68 in src/plugins/condition/components/TestData.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/condition/components/TestData.vue#L68

Added line #L68 was not covered by tests
@change="updateTestData"
>
<option value="">- Select Field -</option>
<option
v-for="(option, index) in telemetryMetadataOptions[getId(testInput.telemetry)]"
Expand All @@ -76,6 +84,7 @@
placeholder="Enter test input"
type="text"
class="c-cdef__control__input"
aria-label="Test Data Input"
@change="updateTestData"
/>
</span>
Expand Down
Loading