diff options
author | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-09-25 03:22:11 +0000 |
---|---|---|
committer | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-09-25 03:22:11 +0000 |
commit | 8e5e6bfcdd45f9e2cd572e02eb4fad527a0094df (patch) | |
tree | 77e6c1b04e90051f216c960e2cee219bcab7e06c /e2e | |
parent | 5fac5ba664acc06c99ed7ea7ed420695e5966e65 (diff) |
Fix form option page
Diffstat (limited to 'e2e')
-rw-r--r-- | e2e/lib/FormOptionPage.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/e2e/lib/FormOptionPage.ts b/e2e/lib/FormOptionPage.ts index c8ff341..c49a44f 100644 --- a/e2e/lib/FormOptionPage.ts +++ b/e2e/lib/FormOptionPage.ts @@ -1,5 +1,5 @@ import { Lanthan } from 'lanthan'; -import { WebDriver, By } from 'selenium-webdriver'; +import { WebDriver, By, until } from 'selenium-webdriver'; export default class FormOptionPage { private webdriver: WebDriver; @@ -9,7 +9,7 @@ export default class FormOptionPage { } async setBlacklist(nth: number, value: string): Promise<void> { - let selector = '.form-blacklist-form .column-url'; + 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') @@ -19,7 +19,7 @@ export default class FormOptionPage { } async setSearchEngine(nth: number, name: string, url: string) { - let selector = '.form-search-form input.column-name'; + let selector = '.form-search-form-row > .column-name'; let inputs = await this.webdriver.findElements(By.css(selector)); if (inputs.length <= nth) { throw new RangeError('Index out of range to set a search engine') @@ -27,7 +27,7 @@ export default class FormOptionPage { await inputs[nth].sendKeys(name); await this.webdriver.executeScript(`document.querySelectorAll('${selector}')[${nth}].blur()`); - selector = '.form-search-form input.column-url'; + selector = '.form-search-form-row > .column-url'; inputs = await this.webdriver.findElements(By.css(selector)); if (inputs.length <= nth) { throw new RangeError('Index out of range to set a search engine') @@ -37,12 +37,14 @@ export default class FormOptionPage { } async addBlacklist(): Promise<void> { + let rows = await this.webdriver.findElements(By.css(`.form-blacklist-form-row`)); let button = await this.webdriver.findElement(By.css('.form-blacklist-form .ui-add-button')) await button.click(); + await this.webdriver.wait(until.elementLocated(By.css(`.form-blacklist-form-row:nth-child(${rows.length + 1})`))); } async removeBlackList(nth: number): Promise<void> { - let buttons = await this.webdriver.findElements(By.css('.form-blacklist-form .ui-delete-button')); + let buttons = await this.webdriver.findElements(By.css('.form-blacklist-form-row .ui-delete-button')); if (buttons.length <= nth) { throw new RangeError('Index out of range to remove blacklist') } @@ -50,12 +52,14 @@ export default class FormOptionPage { } async addSearchEngine(): Promise<void> { - let button = await this.webdriver.findElement(By.css('.form-search-form .ui-add-button')) + 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')) await button.click(); + await this.webdriver.wait(until.elementLocated(By.css(`.form-search-form-row:nth-child(${rows.length + 1})`))); } async setDefaultSearchEngine(nth: number): Promise<void> { - let radios = await this.webdriver.findElements(By.css('.form-search-form input[type=radio]')); + let radios = await this.webdriver.findElements(By.css('.form-search-form-row input[type=radio]')); if (radios.length <= nth) { throw new RangeError('Index out of range to set a default search engine'); } |