Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-lli committed Jan 7, 2025
1 parent c5d2c9e commit 786a1e4
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ describe('Select', () => {
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();

await userEvent.keyboard('[Enter]');
expect(screen.queryByRole('listbox')).toBeInTheDocument();
expect(screen.getByRole('listbox')).toBeInTheDocument();
await userEvent.keyboard('[Enter]');
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
await userEvent.keyboard('[Space]');
expect(screen.queryByRole('listbox')).toBeInTheDocument();
expect(screen.getByRole('listbox')).toBeInTheDocument();

const option1 = screen.getByRole('option', { name: 'label' });
const option2 = screen.getByRole('option', { name: 'test' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export namespace ComboboxUtil {
return screen.getByRole('combobox', { name: options.label });
}
if (options?.nth !== undefined) {
return screen.getAllByRole('combobox').at(options.nth)!;
return screen.getAllByRole('combobox')[options.nth];
}
return screen.getByRole('combobox');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/inscription-view/src/test-utils/setupTests.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-explicit-any */
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
Expand All @@ -13,7 +14,6 @@ afterEach(() => cleanup());

//@ts-ignore
global.IntersectionObserver = class IntersectionObserver {
constructor() {}
observe() {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/inscription-view/src/test-utils/test-utils.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type {
ElementData,
ConfigData,
Expand Down
4 changes: 0 additions & 4 deletions playwright/tests/inscription/parts/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class OutputCode extends Output {
}

class OutputEmptyMap extends OutputCode {
constructor(part: Part) {
super(part);
}

override async assertClear() {
await this.mappingSection.expectIsClosed();
await this.codeSection.expectIsClosed();
Expand Down
5 changes: 4 additions & 1 deletion playwright/tests/page-objects/editor/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export class Element extends BaseElement {

async getPosition() {
const transform = await this.element.getAttribute('transform');
const position = transform!.substring(transform!.indexOf('(') + 1, transform!.indexOf(')'));
if (!transform) {
throw new Error('Element has no transform');
}
const position = transform.substring(transform.indexOf('(') + 1, transform.indexOf(')'));
const x = parseInt(position.split(',')[0].trim(), 10);
const y = parseInt(position.split(',')[1].trim(), 10);
return { x: x, y: y };
Expand Down
5 changes: 4 additions & 1 deletion playwright/tests/page-objects/editor/process-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ export class ProcessEditor {
const graph = this.page.locator('#sprotty');
await expect(graph).toBeVisible();
const bounds = await graph.boundingBox();
await graph.click({ position: { x: bounds!.width - 20, y: bounds!.height - 80 } });
if (!bounds) {
throw new Error('Graph has no bounds');
}
await graph.click({ position: { x: bounds.width - 20, y: bounds.height - 80 } });
await expect(this.page.locator('g.selected')).toHaveCount(0);
}

Expand Down

0 comments on commit 786a1e4

Please sign in to comment.