diff options
| author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-03-21 16:52:38 +0900 | 
|---|---|---|
| committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-03-21 17:19:02 +0900 | 
| commit | b89a87220f93844a95266638b9eb01ec74732fb0 (patch) | |
| tree | f583c45c10c06d678163b39705c9f6544f9c3726 /e2e/lib | |
| parent | b9cb7fe46f1aede8e0c52a8371b331bcdc90335a (diff) | |
stabilize e2e
Diffstat (limited to 'e2e/lib')
| -rw-r--r-- | e2e/lib/Page.ts | 24 | 
1 files changed, 14 insertions, 10 deletions
diff --git a/e2e/lib/Page.ts b/e2e/lib/Page.ts index 5db97da..46d67b0 100644 --- a/e2e/lib/Page.ts +++ b/e2e/lib/Page.ts @@ -35,20 +35,18 @@ export default class Page {    async navigateTo(url: string): Promise<Page> {      await this.webdriver.navigate().to(url);      await Page.waitForPageCompleted(this.webdriver); + +    await new Promise((resolve) => setTimeout(resolve, 200)); +      return new Page(this.webdriver);    }    async showConsole(): Promise<Console> { -    await this.webdriver.switchTo().frame(0); -    await Page.waitForDocumentCompleted(this.webdriver); -    await this.webdriver.switchTo().parentFrame(); -    await new Promise((resolve) => setTimeout(resolve, 100)); -      await this.sendKeys(":");      const iframe = this.webdriver.findElement(By.id("vimvixen-console-frame"));      await this.webdriver.wait(until.elementIsVisible(iframe)); -    await this.webdriver.switchTo().frame(0); +    await this.webdriver.switchTo().frame(iframe);      await this.webdriver.wait(until.elementLocated(By.css("input")));      return new Console(this.webdriver);    } @@ -57,9 +55,8 @@ export default class Page {      const iframe = this.webdriver.findElement(        By.css("#vimvixen-console-frame")      ); -      await this.webdriver.wait(until.elementIsVisible(iframe)); -    await this.webdriver.switchTo().frame(0); +    await this.webdriver.switchTo().frame(iframe);      return new Console(this.webdriver);    } @@ -116,12 +113,19 @@ export default class Page {      return hints;    } -  private static async waitForPageCompleted(webdriver: WebDriver) { +  private static async waitForPageCompleted( +    webdriver: WebDriver +  ): Promise<void> { +    this.waitForDocumentCompleted(webdriver); +      const topFrame = await webdriver.executeScript(() => window.top === window);      if (!topFrame) {        return;      } -    return this.waitForDocumentCompleted(webdriver); +    await webdriver.wait(until.elementLocated(By.id("vimvixen-console-frame"))); +    await webdriver.switchTo().frame(0); +    await Page.waitForDocumentCompleted(webdriver); +    await webdriver.switchTo().parentFrame();    }    private static async waitForDocumentCompleted(webdriver: WebDriver) {  | 
