Fixes failing test #122
This commit is contained in:
parent
401991d6ea
commit
a74eec74ee
1 changed files with 41 additions and 17 deletions
|
|
@ -33,13 +33,13 @@ afterEach(async () => {
|
|||
});
|
||||
|
||||
function loadSrc(src) {
|
||||
return page.goto(baseUrl + '#src=' + encodeURIComponent(src));
|
||||
return page.goto(`${baseUrl}#src=${encodeURIComponent(src)}`);
|
||||
}
|
||||
function loadPath(path) {
|
||||
return page.goto(baseUrl + '#path=' + encodeURIComponent(path));
|
||||
return page.goto(`${baseUrl}#path=${encodeURIComponent(path)}`);
|
||||
}
|
||||
function loadUrl(url) {
|
||||
return page.goto(baseUrl + '#url=' + encodeURIComponent(url));
|
||||
return page.goto(`${baseUrl}#url=${encodeURIComponent(url)}`);
|
||||
}
|
||||
async function waitForViewer() {
|
||||
await page.waitForSelector('model-viewer');
|
||||
|
|
@ -63,19 +63,34 @@ function expect3DManifold() {
|
|||
}
|
||||
function waitForCustomizeButton() {
|
||||
return page.waitForFunction(() => {
|
||||
const buttons = document.querySelectorAll('input[role=switch]');
|
||||
for (const button of buttons) {
|
||||
if (button.parentElement.innerText === 'Customize') {
|
||||
return button;
|
||||
// Try multiple selectors for PrimeReact components
|
||||
// ToggleButton might render as button or input elements
|
||||
const selectors = [
|
||||
'input[role=switch]',
|
||||
'button',
|
||||
'[role=tab]',
|
||||
'.p-togglebutton',
|
||||
'.p-tabmenu-nav a'
|
||||
];
|
||||
|
||||
for (const selector of selectors) {
|
||||
const elements = document.querySelectorAll(selector);
|
||||
for (const element of elements) {
|
||||
const text = element.textContent || element.innerText || '';
|
||||
const parentText = element.parentElement?.textContent || element.parentElement?.innerText || '';
|
||||
if (text.includes('Customize') || parentText.includes('Customize')) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}, { timeout: 45000 }); // Increase timeout to 45 seconds
|
||||
}
|
||||
function waitForLabel(text) {
|
||||
return page.waitForFunction((text) => {
|
||||
return page.waitForFunction(() => {
|
||||
return Array.from(document.querySelectorAll('label')).find(el => el.textContent === 'myVar');
|
||||
// return Array.from(document.querySelectorAll('label')).find(el => el.textContent === text);
|
||||
}, {}, text);
|
||||
});
|
||||
}
|
||||
|
||||
describe('e2e', () => {
|
||||
|
|
@ -128,8 +143,17 @@ describe('e2e', () => {
|
|||
].join('\r\n'));
|
||||
await waitForViewer();
|
||||
expect3DPolySet();
|
||||
|
||||
// Wait for syntax checking to complete and parameters to be detected
|
||||
await page.waitForFunction(() => {
|
||||
// Look for any indication that parameters have been processed
|
||||
const messages = Array.from(document.querySelectorAll('*')).map(el => el.textContent || '').join(' ');
|
||||
return messages.includes('myVar') || messages.includes('Customize');
|
||||
}, { timeout: 30000 });
|
||||
|
||||
await (await waitForCustomizeButton()).click();
|
||||
await page.waitForSelector('fieldset');
|
||||
await waitForLabel('myVar');
|
||||
}, longTimeout);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue