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
docs: change examples in docs to use for..of and async/await (#14842) #15196
Changes from 3 commits
9de96f7
7f67ace
cde0906
8e8ea5d
4fa15d2
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 |
---|---|---|
|
@@ -25,27 +25,25 @@ var assert = require('assert') | |
|
||
var app = new Application({ | ||
path: '/Applications/MyApp.app/Contents/MacOS/MyApp' | ||
}) | ||
|
||
app.start().then(function () { | ||
// Check if the window is visible | ||
return app.browserWindow.isVisible() | ||
}).then(function (isVisible) { | ||
// Verify the window is visible | ||
assert.strictEqual(isVisible, true) | ||
}).then(function () { | ||
// Get the window's title | ||
return app.client.getTitle() | ||
}).then(function (title) { | ||
// Verify the window's title | ||
assert.strictEqual(title, 'My App') | ||
}).catch(function (error) { | ||
// Log any failures | ||
console.error('Test failed', error.message) | ||
}).then(function () { | ||
}); | ||
|
||
(async () => { | ||
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 wonder if this example would be a little more clear if we made this a named async function instead of an IIFE. Thoughts? 💭 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. Sure that would be better. Will update. |
||
await app.start() | ||
try { | ||
// Check if the window is visible | ||
const isVisible = await app.browserWindow.isVisible() | ||
// Verify the window is visible | ||
assert.strictEqual(isVisible, true) | ||
// Get the window's title | ||
const title = await app.client.getTitle() | ||
// Verify the window's title | ||
assert.strictEqual(title, 'My App') | ||
} catch (error) { | ||
console.error('Test failed', error.message) | ||
} | ||
// Stop the application | ||
return app.stop() | ||
}) | ||
await app.stop() | ||
})() | ||
``` | ||
|
||
## Setting up with WebDriverJs | ||
|
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.
Based on the PR title, I assume this should be
of
:)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.
Whoops!