Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronPlave committed Dec 31, 2024
1 parent 8b5ee9e commit 6ff68bb
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 20 deletions.
19 changes: 10 additions & 9 deletions e2e-tests/fixtures/Plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class Plan {
}

async fillActivityPresetName(presetName: string) {
await this.panelActivityForm.getByRole('button', { name: 'Set Preset' }).click();
await this.panelActivityForm.getByRole('combobox', { name: 'None' }).click();
await this.panelActivityForm.locator('.dropdown-header').waitFor({ state: 'attached' });
await this.panelActivityForm.getByPlaceholder('Enter preset name').click();
await this.panelActivityForm.getByPlaceholder('Enter preset name').fill(presetName);
Expand Down Expand Up @@ -372,22 +372,23 @@ export class Plan {
}

async selectActivityAnchorByIndex(index: number) {
await this.panelActivityForm.getByRole('button', { name: 'Set Anchor' }).click();
const anchorCollapse = this.panelActivityForm.getByRole('group', { name: 'Anchor-collapse' });
await anchorCollapse.getByRole('combobox').click();

await this.panelActivityForm.getByRole('menuitem').nth(index).waitFor({ state: 'attached' });
const anchorMenuName = await this.panelActivityForm.getByRole('menuitem').nth(index)?.innerText();
await this.panelActivityForm.getByRole('menuitem').nth(index).click();
await this.panelActivityForm.getByRole('menuitem').nth(index).waitFor({ state: 'detached' });
await anchorCollapse.getByRole('menuitem').nth(index).waitFor({ state: 'attached' });
const anchorMenuName = await anchorCollapse.getByRole('menuitem').nth(index)?.innerText();
await anchorCollapse.getByRole('menuitem').nth(index).click();
await anchorCollapse.getByRole('menuitem').nth(index).waitFor({ state: 'detached' });

await this.page.waitForFunction(
anchorMenuName => document.querySelector('.anchor-form .selected-display-value')?.innerHTML === anchorMenuName,
anchorMenuName,
);
await expect(this.panelActivityForm.getByRole('textbox', { name: anchorMenuName })).toBeVisible();
await expect(anchorCollapse.getByRole('combobox', { name: anchorMenuName })).toBeVisible();
}

async selectActivityPresetByName(presetName: string) {
await this.panelActivityForm.getByRole('combobox', { name: 'Set Preset' }).click();
await this.panelActivityForm.locator('div[name="Set Preset"]').click();

await this.panelActivityForm.getByRole('menuitem', { name: presetName }).waitFor({ state: 'attached' });
await this.panelActivityForm.getByRole('menuitem', { name: presetName }).click();
Expand All @@ -413,7 +414,7 @@ export class Plan {
document.querySelector('.activity-preset-input-container .selected-display-value')?.innerHTML === presetName,
presetName,
);
await expect(this.panelActivityForm.getByRole('textbox', { name: presetName })).toBeVisible();
await expect(this.panelActivityForm.getByRole('combobox', { name: presetName })).toBeVisible();
}

async selectSimulationTemplateByName(templateName: string) {
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/tests/plan-activities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test.describe.serial('Plan Activities', () => {
() => document.querySelector('.anchor-form .selected-display-value')?.innerHTML === 'To Plan',
);

await expect(plan.panelActivityForm.getByRole('textbox', { name: 'To Plan' })).toBeVisible();
await expect(plan.panelActivityForm.getByRole('combobox', { name: 'To Plan' })).toBeVisible();
});

test('Deleting multiple activity directives but only 1 has a remaining anchored dependent should prompt for just the one with a remaining dependent', async () => {
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/tests/plan-activity-presets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ test.beforeAll(async ({ baseURL, browser }) => {

await plan.selectActivityPresetByName('None');

await expect(plan.panelActivityForm.getByRole('textbox', { name: 'None' })).toBeVisible();
await expect(plan.panelActivityForm.getByRole('combobox', { name: 'None' })).toBeVisible();
});

test.afterAll(async () => {
Expand All @@ -72,18 +72,18 @@ test.afterAll(async () => {
test.describe.serial('Plan Activity Presets', () => {
test(`Setting a preset to a directive should update the parameter values`, async () => {
await plan.selectActivityPresetByName('Preset 1');
await expect(page.getByRole('textbox', { name: 'Preset 1' })).toBeVisible();
await expect(page.getByRole('combobox', { name: 'Preset 1' })).toBeVisible();
});

test(`Removing an activity preset from a directive should reflect that it is no longer present`, async () => {
await plan.selectActivityPresetByName('None');
await expect(page.getByRole('textbox', { name: 'None' })).toBeVisible();
await expect(page.getByRole('combobox', { name: 'None' })).toBeVisible();
});

test('Deleting an activity preset should remove it from the list of presets', async () => {
await plan.selectActivityPresetByName('Preset 1');

await page.getByRole('button', { name: 'Set Preset' }).click();
await page.getByRole('combobox', { name: 'Preset 1' }).click();

await page.getByRole('button', { name: 'Delete preset' }).waitFor({ state: 'attached' });
await page.getByRole('button', { name: 'Delete preset' }).click();
Expand All @@ -96,6 +96,6 @@ test.describe.serial('Plan Activity Presets', () => {
() => document.querySelector('.activity-preset-input-container .selected-display-value')?.innerHTML === 'None',
);

await expect(page.getByRole('textbox', { name: 'None' })).toBeVisible();
await expect(page.getByRole('combobox', { name: 'None' })).toBeVisible();
});
});
8 changes: 4 additions & 4 deletions e2e-tests/tests/plan-simulation-templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test.beforeAll(async ({ baseURL, browser }) => {

await plan.selectSimulationTemplateByName('None');

expect(page.getByRole('textbox', { name: 'None' })).toBeVisible();
expect(page.getByRole('combobox', { name: 'None' })).toBeVisible();
});

test.afterAll(async () => {
Expand All @@ -75,13 +75,13 @@ test.describe.serial('Plan Simulation Templates', async () => {
test(`Setting a simulation template to a simulation should update the parameter values`, async () => {
await plan.selectSimulationTemplateByName('Template 1');

expect(plan.panelSimulation.getByRole('textbox', { name: 'Template 1' })).toBeVisible();
expect(plan.panelSimulation.getByRole('combobox', { name: 'Template 1' })).toBeVisible();
});

test(`Removing an simulation template from a simulation should reflect that it is no longer present`, async () => {
await plan.selectSimulationTemplateByName('None');

expect(page.getByRole('textbox', { name: 'None' })).toBeVisible();
expect(page.getByRole('combobox', { name: 'None' })).toBeVisible();
});

test('Deleting an simulation template should remove it from the list of templates', async () => {
Expand All @@ -98,6 +98,6 @@ test.describe.serial('Plan Simulation Templates', async () => {

await page.waitForFunction(() => document.querySelector('.selected-display-value')?.innerHTML === 'None');

expect(page.getByRole('textbox', { name: 'None' })).toBeVisible();
expect(page.getByRole('combobox', { name: 'None' })).toBeVisible();
});
});
6 changes: 6 additions & 0 deletions e2e-tests/tests/timeline-view-editing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,14 @@ test.describe.serial('Timeline View Editing', () => {
await modal.getByRole('button', { name: 'Remove Types' }).click();
expect(await resultingTypesList.locator('.activity-type-result').count()).toEqual(allActivityTypesCount);

// Give the layer a new name
await modal.locator('input[name="layer-name"]').fill('Foo');

// Close the modal
await modal.getByRole('button', { name: 'close' }).click();

// Expect name to match given name
expect(await activityLayerEditor.locator('.timeline-layer-editor').first()).toHaveText('Foo');
});

test('Change activity layer settings', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collapse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$: expanded = defaultExpanded;
</script>

<div class={collapseClasses} class:error role="group">
<div class={collapseClasses} class:error role="group" aria-label="{title}-collapse">
<button
on:contextmenu|preventDefault={contextMenu?.show}
tabindex={!collapsible ? -1 : 0}
Expand Down
1 change: 1 addition & 0 deletions src/components/activity/ActivityAnchorForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
placeholder="To Plan"
searchPlaceholder="Search Directives"
selectTooltip="Set Anchor"
name="Set Anchor"
selectedOptionValues={typeof anchorId === 'number' ? [anchorId] : []}
{updatePermissionError}
on:change={onSelectAnchor}
Expand Down
1 change: 1 addition & 0 deletions src/components/ui/EditableDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
{planReadOnly}
{searchPlaceholder}
selectedOptionValues={selectedOptionValue !== undefined ? [selectedOptionValue] : []}
name={selectTooltip}
{selectTooltip}
{selectTooltipPlacement}
{showPlaceholderOption}
Expand Down

0 comments on commit 6ff68bb

Please sign in to comment.