aboutsummaryrefslogtreecommitdiff
path: root/e2e/lib
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/lib')
-rw-r--r--e2e/lib/FormOptionPage.ts37
1 files changed, 35 insertions, 2 deletions
diff --git a/e2e/lib/FormOptionPage.ts b/e2e/lib/FormOptionPage.ts
index c49a44f..7d981f4 100644
--- a/e2e/lib/FormOptionPage.ts
+++ b/e2e/lib/FormOptionPage.ts
@@ -8,13 +8,31 @@ export default class FormOptionPage {
this.webdriver = lanthan.getWebDriver();
}
- async setBlacklist(nth: number, value: string): Promise<void> {
+ async setBlacklist(nth: number, url: string): Promise<void> {
let selector = '.form-blacklist-form-row > .column-url';
let inputs = await this.webdriver.findElements(By.css(selector));
if (inputs.length <= nth) {
throw new RangeError('Index out of range to set a blacklist')
}
- await inputs[nth].sendKeys(value);
+ await inputs[nth].sendKeys(url);
+ await this.webdriver.executeScript(`document.querySelectorAll('${selector}')[${nth}].blur()`);
+ }
+
+ async setPartialBlacklist(nth: number, url: string, keys: string): Promise<void> {
+ let selector = '.form-partial-blacklist-form-row > .column-url';
+ let inputs = await this.webdriver.findElements(By.css(selector));
+ if (inputs.length <= nth) {
+ throw new RangeError('Index out of range to set a partial blacklist')
+ }
+ await inputs[nth].sendKeys(url);
+ await this.webdriver.executeScript(`document.querySelectorAll('${selector}')[${nth}].blur()`);
+
+ selector = '.form-partial-blacklist-form-row > .column-keys';
+ inputs = await this.webdriver.findElements(By.css(selector));
+ if (inputs.length <= nth) {
+ throw new RangeError('Index out of range to set a partial blacklist')
+ }
+ await inputs[nth].sendKeys(keys);
await this.webdriver.executeScript(`document.querySelectorAll('${selector}')[${nth}].blur()`);
}
@@ -43,6 +61,13 @@ export default class FormOptionPage {
await this.webdriver.wait(until.elementLocated(By.css(`.form-blacklist-form-row:nth-child(${rows.length + 1})`)));
}
+ async addPartialBlacklist(): Promise<void> {
+ let rows = await this.webdriver.findElements(By.css(`.form-partial-blacklist-form-row`));
+ let button = await this.webdriver.findElement(By.css('.form-partial-blacklist-form .ui-add-button'))
+ await button.click();
+ await this.webdriver.wait(until.elementLocated(By.css(`.form-partial-blacklist-form-row:nth-child(${rows.length + 2})`)));
+ }
+
async removeBlackList(nth: number): Promise<void> {
let buttons = await this.webdriver.findElements(By.css('.form-blacklist-form-row .ui-delete-button'));
if (buttons.length <= nth) {
@@ -51,6 +76,14 @@ export default class FormOptionPage {
await buttons[nth].click()
}
+ async removePartialBlackList(nth: number): Promise<void> {
+ let buttons = await this.webdriver.findElements(By.css('.form-partial-blacklist-form-row .ui-delete-button'));
+ if (buttons.length <= nth) {
+ throw new RangeError('Index out of range to remove partial blacklist')
+ }
+ await buttons[nth].click()
+ }
+
async addSearchEngine(): Promise<void> {
let rows = await this.webdriver.findElements(By.css(`.form-search-form-row > .column-name`));
let button = await this.webdriver.findElement(By.css('.form-search-form > .ui-add-button'))