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

Add UI tests for the suggestion panel #660

Merged
merged 10 commits into from
Jan 5, 2025
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions ui-tests/tests/ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,86 @@ test.describe('UI Test', () => {
}
});
});

test.describe('Suggestion Panel test', () => {
test(`Test Delete Suggestion`, async ({ page }) => {
await page.goto();

const fileName = 'test.jcad';
const fullPath = `examples/${fileName}`;
await page.notebook.openByPath(fullPath);
await page.notebook.activate(fullPath);
await page.locator('div.jpcad-Spinner').waitFor({ state: 'hidden' });

// Activate Right Panel
await page.locator('li#tab-key-1-7').click();
await page.getByTitle('Create new fork').click();
await page.locator('div.jp-Dialog-buttonLabel[aria-label="Ok"]').click();

// Select cone
await page
.locator('[data-test-id="react-tree-root"]')
.getByText('Cone 1')
.click();

await page.locator('input#root_Height').click();
await page.locator('input#root_Height').fill('20');

await page
.locator('div.jp-Dialog-buttonLabel', {
hasText: 'Submit'
})
.click();

await page.getByTitle('Delete suggestion').click();
await page.locator('div.jp-Dialog-buttonLabel[aria-label="Ok"]').click();

let main = await page.$('#jp-main-split-panel');
if (main) {
expect(await main.screenshot()).toMatchSnapshot({
name: `JCAD-Delete-Suggestion.png`
});
}
});

test(`Test Accept Suggestion`, async ({ page }) => {
await page.goto();

const fileName = 'test.jcad';
const fullPath = `examples/${fileName}`;
await page.notebook.openByPath(fullPath);
await page.notebook.activate(fullPath);
await page.locator('div.jpcad-Spinner').waitFor({ state: 'hidden' });

// Activate Right Panel
await page.locator('li#tab-key-1-7').click();
await page.getByTitle('Create new fork').click();
await page.locator('div.jp-Dialog-buttonLabel[aria-label="Ok"]').click();

// Select cone
await page
.locator('[data-test-id="react-tree-root"]')
.getByText('Cone 1')
.click();

await page.locator('input#root_Height').click();
await page.locator('input#root_Height').fill('20');

await page
.locator('div.jp-Dialog-buttonLabel', {
hasText: 'Submit'
})
.click();

await page.getByTitle('Accept suggestion').click();
await page.locator('div.jp-Dialog-buttonLabel[aria-label="Ok"]').click();

let main = await page.$('#jp-main-split-panel');
if (main) {
expect(await main.screenshot()).toMatchSnapshot({
name: `JCAD-Accept-Suggestion.png`
});
}
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading