This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…853) * Include TypeScript library .d.ts files * Add test case to verify typescript completion * Bring in autocompletion test
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Test scripts for QuickOpen | ||
*/ | ||
|
||
import * as assert from "assert" | ||
import * as os from "os" | ||
import * as path from "path" | ||
|
||
const getCompletionElement = () => { | ||
|
||
const elements = document.body.getElementsByClassName("autocompletion") | ||
|
||
if (!elements || !elements.length) { | ||
return null | ||
} else { | ||
return elements[0] | ||
} | ||
} | ||
|
||
export const test = async (oni: any) => { | ||
const dir = os.tmpdir() | ||
const testFileName = `testFile-${new Date().getTime()}.ts` | ||
const tempFilePath = path.join(dir, testFileName) | ||
oni.automation.sendKeys(":e " + tempFilePath) | ||
oni.automation.sendKeys("<cr>") | ||
await oni.automation.sleep(500) | ||
oni.automation.sendKeys("i") | ||
oni.automation.sendKeys("window.a") | ||
|
||
// Wait for completion popup to show | ||
await oni.automation.waitFor(() => getCompletionElement() !== null) | ||
|
||
// Check for 'alert' as an available completion | ||
const completionElement = getCompletionElement() | ||
const textContent = completionElement.textContent | ||
|
||
assert.ok(textContent.indexOf("alert") >= 0, "Verify 'alert' was presented as a completion") | ||
} |