-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lukas Grossmann <[email protected]>
- Loading branch information
Showing
7 changed files
with
234 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*----------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
*-----------------------------------------------------------------------------------------------*/ | ||
import { ViewSection, By, waitForAttributeValue } from 'vscode-extension-tester'; | ||
|
||
export async function collapse(section: ViewSection){ | ||
try { | ||
await section.collapse(); | ||
} catch { | ||
if (await section.isExpanded()) { | ||
const mainPanel = await section.findElement(By.className('pane-header')); | ||
const arrowPanel = await section.findElement(By.className('codicon')); | ||
await arrowPanel.click(); | ||
await section.getDriver().wait(waitForAttributeValue(mainPanel, 'aria-expanded', 'false'), 2_000); | ||
} | ||
} | ||
} |
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,94 @@ | ||
/*----------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE file in the project root for license information. | ||
*-----------------------------------------------------------------------------------------------*/ | ||
import { By, WebElement, WebView } from 'vscode-extension-tester'; | ||
import { WebViewForm } from './WebViewForm'; | ||
|
||
//TODO: Add support for create from git page and from local codebase page | ||
|
||
/** | ||
* @author [email protected] | ||
* Class represents WebView of Create Component form | ||
*/ | ||
|
||
export class CreateComponentWebView extends WebViewForm { | ||
|
||
public constructor() { | ||
super('Create Component'); | ||
} | ||
|
||
private async getCreateFromTemplateButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//div[..//h6[contains(text(),"From Template Project")]]/button')); | ||
} | ||
|
||
private async getCreateFromGitButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//*[@id="root"]/div/div/div[1]/div[2]/div[3]/button')); | ||
} | ||
|
||
private async getCreateFromLocalButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//*[@id="root"]/div/div/div[1]/div[1]/div[3]/button')); | ||
} | ||
|
||
public async createComponentFromTemplate(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
const button = await this.getCreateFromTemplateButton(webView); | ||
await button.click(); | ||
}); | ||
} | ||
|
||
public async createComponentFromGit(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
await (await this.getCreateFromGitButton(webView)).click(); | ||
}); | ||
} | ||
|
||
public async createComponentFromLocalCodebase(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
await (await this.getCreateFromLocalButton(webView)).click(); | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Class represents page that shows up after selecting a devfile | ||
*/ | ||
export class TemplateProjectPage extends WebViewForm{ | ||
|
||
public constructor(name: string) { | ||
super(name); | ||
} | ||
|
||
public async insertProjectFolderPath(path: string): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
const pathField = await this.getProjectFolderPathField(webView); | ||
await pathField.sendKeys(path); | ||
}); | ||
} | ||
|
||
public async clickSelectFolder(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
const button = await this.getSelectFolderButton(webView); | ||
await button.click(); | ||
}) | ||
} | ||
|
||
public async clickCreateComponentButton(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
const button = await this.getCreateComponentButton(webView); | ||
await button.click(); | ||
}); | ||
} | ||
|
||
private async getSelectFolderButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//button[contains(text(), "Select Folder")]')); | ||
} | ||
|
||
private async getProjectFolderPathField(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//div[./label[contains(text(), "Project Folder Path")]]//input')); | ||
} | ||
|
||
private async getCreateComponentButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//span[contains(text(), "Create Component")]')); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ import { By, ModalDialog, WebElement, WebView } from 'vscode-extension-tester'; | |
import { WebViewForm } from './WebViewForm'; | ||
|
||
/** | ||
* @author [email protected] | ||
* @author [email protected], [email protected] | ||
* Class represents Registry Stack item in web View form | ||
*/ | ||
export class RegistryStackItem { | ||
|
@@ -93,3 +93,33 @@ export class RegistryWebViewEditor extends WebViewForm { | |
}); | ||
} | ||
} | ||
|
||
export class RegistryWebViewDevfileWindow extends WebViewForm { | ||
//TODO: Add more functionality to class to cover all elements | ||
|
||
public constructor(name: string) { | ||
super(name) | ||
} | ||
|
||
public async clickListBox(): Promise<void> { | ||
await (await this.getListBox()).click(); | ||
} | ||
|
||
public async getListBox(): Promise<WebElement> { | ||
const listBox = this.enterWebView( async (webView) => { | ||
return await webView.findWebElement(By.xpath('//svg[@data-testid="ArrowDropDownIcon"]')); | ||
}) | ||
return listBox; | ||
} | ||
|
||
public async useDevfile(): Promise<void> { | ||
await this.enterWebView(async (webView) => { | ||
const button = await this.getUseDevfileButton(webView); | ||
await button.click(); | ||
}); | ||
} | ||
|
||
private async getUseDevfileButton(webView: WebView): Promise<WebElement> { | ||
return await webView.findWebElement(By.xpath('//button[contains(text(), "Use Devfile")]')); | ||
} | ||
} |
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