-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Isolate each test with a different `extest` process.
- Loading branch information
Showing
21 changed files
with
1,746 additions
and
1,704 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,92 +1,93 @@ | ||
import { By, EditorView, WebElement, Workbench } from "vscode-extension-tester"; | ||
import { getWebviewByLocator, sleep } from "./uiTestHelper"; | ||
import { By, EditorView, WebElement } from "vscode-extension-tester"; | ||
import { | ||
getWebviewByLocator, | ||
sleep, | ||
workbenchExecuteCommand, | ||
} from "./uiTestHelper"; | ||
import { config, expect } from "chai"; | ||
|
||
config.truncateThreshold = 0; | ||
export function contentCreatorUiTest(): void { | ||
describe("Test Ansible playbook project scaffolding", () => { | ||
let workbench: Workbench; | ||
let createButton: WebElement; | ||
let editorView: EditorView; | ||
|
||
before(async () => { | ||
workbench = new Workbench(); | ||
editorView = new EditorView(); | ||
if (editorView) { | ||
await editorView.closeAllEditors(); | ||
} | ||
}); | ||
describe("Test Ansible playbook project scaffolding", () => { | ||
let createButton: WebElement; | ||
let editorView: EditorView; | ||
|
||
async function testWebViewElements( | ||
command: string, | ||
editorTitle: string, | ||
namespaceName: string, | ||
collectionName: string, | ||
) { | ||
await workbench.executeCommand(command); | ||
await sleep(4000); | ||
before(async () => { | ||
editorView = new EditorView(); | ||
if (editorView) { | ||
await editorView.closeAllEditors(); | ||
} | ||
}); | ||
|
||
await new EditorView().openEditor(editorTitle); | ||
const webview = await getWebviewByLocator( | ||
By.xpath("//vscode-text-field[@id='namespace-name']"), | ||
); | ||
async function testWebViewElements( | ||
command: string, | ||
editorTitle: string, | ||
namespaceName: string, | ||
collectionName: string, | ||
) { | ||
await workbenchExecuteCommand(command); | ||
await sleep(4000); | ||
|
||
const namespaceTextField = await webview.findWebElement( | ||
By.xpath("//vscode-text-field[@id='namespace-name']"), | ||
); | ||
expect(namespaceTextField, "namespaceTextField should not be undefined") | ||
.not.to.be.undefined; | ||
await namespaceTextField.sendKeys(namespaceName); | ||
await new EditorView().openEditor(editorTitle); | ||
const webview = await getWebviewByLocator( | ||
By.xpath("//vscode-text-field[@id='namespace-name']"), | ||
); | ||
|
||
const collectionTextField = await webview.findWebElement( | ||
By.xpath("//vscode-text-field[@id='collection-name']"), | ||
); | ||
expect(collectionTextField, "collectionTextField should not be undefined") | ||
.not.to.be.undefined; | ||
await collectionTextField.sendKeys(collectionName); | ||
const namespaceTextField = await webview.findWebElement( | ||
By.xpath("//vscode-text-field[@id='namespace-name']"), | ||
); | ||
expect(namespaceTextField, "namespaceTextField should not be undefined").not | ||
.to.be.undefined; | ||
await namespaceTextField.sendKeys(namespaceName); | ||
|
||
const overwriteCheckbox = await webview.findWebElement( | ||
By.xpath("//vscode-checkbox[@id='overwrite-checkbox']"), | ||
); | ||
expect(overwriteCheckbox, "overwriteCheckbox should not be undefined").not | ||
.to.be.undefined; | ||
await overwriteCheckbox.click(); | ||
const collectionTextField = await webview.findWebElement( | ||
By.xpath("//vscode-text-field[@id='collection-name']"), | ||
); | ||
expect(collectionTextField, "collectionTextField should not be undefined") | ||
.not.to.be.undefined; | ||
await collectionTextField.sendKeys(collectionName); | ||
|
||
createButton = await webview.findWebElement( | ||
By.xpath("//vscode-button[@id='create-button']"), | ||
); | ||
expect(createButton, "createButton should not be undefined").not.to.be | ||
.undefined; | ||
const overwriteCheckbox = await webview.findWebElement( | ||
By.xpath("//vscode-checkbox[@id='overwrite-checkbox']"), | ||
); | ||
expect(overwriteCheckbox, "overwriteCheckbox should not be undefined").not | ||
.to.be.undefined; | ||
await overwriteCheckbox.click(); | ||
|
||
expect( | ||
await createButton.isEnabled(), | ||
"Create button should be enabled now", | ||
).to.be.true; | ||
createButton = await webview.findWebElement( | ||
By.xpath("//vscode-button[@id='create-button']"), | ||
); | ||
expect(createButton, "createButton should not be undefined").not.to.be | ||
.undefined; | ||
|
||
await createButton.click(); | ||
await webview.switchBack(); | ||
editorView = new EditorView(); | ||
if (editorView) { | ||
await editorView.closeAllEditors(); | ||
} | ||
expect( | ||
await createButton.isEnabled(), | ||
"Create button should be enabled now", | ||
).to.be.true; | ||
|
||
await createButton.click(); | ||
await webview.switchBack(); | ||
editorView = new EditorView(); | ||
if (editorView) { | ||
await editorView.closeAllEditors(); | ||
} | ||
} | ||
|
||
it("Check create-ansible-project webview elements", async () => { | ||
await testWebViewElements( | ||
"Ansible: Create New Playbook Project", | ||
"Create Ansible project", | ||
"test_namespace", | ||
"test_collection", | ||
); | ||
}); | ||
it("Check create-ansible-project webview elements", async () => { | ||
await testWebViewElements( | ||
"Ansible: Create New Playbook Project", | ||
"Create Ansible project", | ||
"test_namespace", | ||
"test_collection", | ||
); | ||
}); | ||
|
||
it("Check create-ansible-collection webview elements", async () => { | ||
await testWebViewElements( | ||
"Ansible: Create New Collection", | ||
"Create Ansible collection", | ||
"test_namespace", | ||
"test_collection", | ||
); | ||
}); | ||
it("Check create-ansible-collection webview elements", async () => { | ||
await testWebViewElements( | ||
"Ansible: Create New Collection", | ||
"Create Ansible collection", | ||
"test_namespace", | ||
"test_collection", | ||
); | ||
}); | ||
} | ||
}); |
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
Oops, something went wrong.