-
Notifications
You must be signed in to change notification settings - Fork 80
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
Workbench: cleanup the process shutdown routines #1364
Changes from 4 commits
30153a9
fafd7ee
f04cd1d
18a356e
864a29e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,13 +133,15 @@ beforeEach(() => { | |
|
||
afterEach(async () => { | ||
try { | ||
const pages = await BROWSER.pages(); | ||
await Promise.all(pages.map(page => page.close())); | ||
await BROWSER.close(); | ||
} catch (error) { | ||
console.log(BINARY_PATH); | ||
console.error(error); | ||
// Normally BROWSER.close() will kill this process | ||
ELECTRON_PROCESS.kill(); | ||
} | ||
ELECTRON_PROCESS.removeAllListeners(); | ||
ELECTRON_PROCESS.kill(); | ||
}); | ||
|
||
test('Run a real invest model', async () => { | ||
|
@@ -164,6 +166,7 @@ test('Run a real invest model', async () => { | |
const downloadModal = await page.waitForSelector('.modal-dialog'); | ||
const downloadModalCancel = await downloadModal.waitForSelector( | ||
'aria/[name="Cancel"][role="button"]'); | ||
await page.waitForTimeout(300); // waiting for click handler to be ready | ||
await downloadModalCancel.click(); | ||
// We need to get the modelButton from w/in this list-group because there | ||
// are buttons with the same name in the Recent Jobs container. | ||
|
@@ -232,11 +235,13 @@ test('Check local userguide links', async () => { | |
const downloadModal = await page.waitForSelector('.modal-dialog'); | ||
const downloadModalCancel = await downloadModal.waitForSelector( | ||
'aria/[name="Cancel"][role="button"]'); | ||
await page.waitForTimeout(500); // waiting for click handler to be ready | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason this one is longer than the others? I don't think it's necessary if different click events could need different wait times but would it be convenient to have a constant variable defining these wait values? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why it's different so I've made it the same, and I added a variable. But it's likely each button is different, in terms of when it becomes functional. It seems dependent on whether the javascript containing the click handler's function has loaded yet, or whether the element is visible yet, or otherwise visually blocked somehow. All we know for sure is that the element is present in the DOM (that's what the |
||
await downloadModalCancel.click(); | ||
|
||
const investList = await page.waitForSelector('.invest-list-group'); | ||
const modelButtons = await investList.$$('aria/[role="button"]'); | ||
|
||
await page.waitForTimeout(300); // first btn click does not register w/o this pause | ||
for (const btn of modelButtons) { | ||
await btn.click(); | ||
const link = await page.waitForSelector('text/User\'s Guide'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.