diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 09:30:05 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-01-19 13:53:40 +0100 |
commit | 5bdfa604f102a5e51b5152457cd1a16d79177e26 (patch) | |
tree | 878c04cbd3c452c7b45aa39e19abd38bfe691063 /client/e2e/src/utils/elements.ts | |
parent | 9589907c89d29a6c0acd52c8cb789af9f93ce9af (diff) | |
download | PeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.tar.gz PeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.tar.zst PeerTube-5bdfa604f102a5e51b5152457cd1a16d79177e26.zip |
Add E2E client tests for signup approval
Diffstat (limited to 'client/e2e/src/utils/elements.ts')
-rw-r--r-- | client/e2e/src/utils/elements.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/client/e2e/src/utils/elements.ts b/client/e2e/src/utils/elements.ts index b0ddd5a65..d9435e520 100644 --- a/client/e2e/src/utils/elements.ts +++ b/client/e2e/src/utils/elements.ts | |||
@@ -5,6 +5,10 @@ async function getCheckbox (name: string) { | |||
5 | return input.parentElement() | 5 | return input.parentElement() |
6 | } | 6 | } |
7 | 7 | ||
8 | function isCheckboxSelected (name: string) { | ||
9 | return $(`input[id=${name}]`).isSelected() | ||
10 | } | ||
11 | |||
8 | async function selectCustomSelect (id: string, valueLabel: string) { | 12 | async function selectCustomSelect (id: string, valueLabel: string) { |
9 | const wrapper = $(`[formcontrolname=${id}] .ng-arrow-wrapper`) | 13 | const wrapper = $(`[formcontrolname=${id}] .ng-arrow-wrapper`) |
10 | 14 | ||
@@ -22,7 +26,18 @@ async function selectCustomSelect (id: string, valueLabel: string) { | |||
22 | return option.click() | 26 | return option.click() |
23 | } | 27 | } |
24 | 28 | ||
29 | async function findParentElement ( | ||
30 | el: WebdriverIO.Element, | ||
31 | finder: (el: WebdriverIO.Element) => Promise<boolean> | ||
32 | ) { | ||
33 | if (await finder(el) === true) return el | ||
34 | |||
35 | return findParentElement(await el.parentElement(), finder) | ||
36 | } | ||
37 | |||
25 | export { | 38 | export { |
26 | getCheckbox, | 39 | getCheckbox, |
27 | selectCustomSelect | 40 | isCheckboxSelected, |
41 | selectCustomSelect, | ||
42 | findParentElement | ||
28 | } | 43 | } |