-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
324bab1
commit fdf9e78
Showing
3 changed files
with
85 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { driver, WebElementPromise } from "mocha-webdriver"; | ||
import * as gu from "test/nbrowser/gristUtils"; | ||
|
||
export interface Button { | ||
click(): Promise<void>; | ||
element(): WebElementPromise; | ||
wait(): Promise<void>; | ||
visible(): Promise<boolean>; | ||
present(): Promise<boolean>; | ||
} | ||
|
||
export const element = (testId: string) => ({ | ||
element() { | ||
return driver.find(testId); | ||
}, | ||
async wait() { | ||
await driver.findWait(testId, 1000); | ||
}, | ||
async visible() { | ||
return await this.element().isDisplayed(); | ||
}, | ||
async present() { | ||
return await this.element().isPresent(); | ||
} | ||
}); | ||
|
||
export const label = (testId: string) => ({ | ||
...element(testId), | ||
async text() { | ||
return this.element().getText(); | ||
}, | ||
}); | ||
|
||
export const button = (testId: string): Button => ({ | ||
...element(testId), | ||
async click() { | ||
await gu.scrollIntoView(this.element()); | ||
await this.element().click(); | ||
}, | ||
}); | ||
|
||
export const option = (testId: string) => ({ | ||
...button(testId), | ||
async checked() { | ||
return 'true' === await this.element().findClosest("label").find("input[type='checkbox']").getAttribute('checked'); | ||
} | ||
}); | ||
|