]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/po/my-account.po.ts
Fix local e2e tests
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / my-account.po.ts
index 20dafbf0616eccb06ce1b3b58fd7b6471ea4a13c..5188eca1128b2b8db8af338513035eb9436a26ef 100644 (file)
@@ -24,7 +24,9 @@ export class MyAccountPage {
     const nsfw = $('#nsfwPolicy')
 
     await nsfw.waitForDisplayed()
-    await nsfw.scrollIntoView(false) // Avoid issues with fixed header on firefox
+    await nsfw.scrollIntoView({ block: 'center' }) // Avoid issues with fixed header
+    await nsfw.waitForClickable()
+
     await nsfw.selectByAttribute('value', newValue)
 
     await this.submitVideoSettings()
@@ -34,7 +36,7 @@ export class MyAccountPage {
     const p2p = await getCheckbox('p2pEnabled')
 
     await p2p.waitForClickable()
-    await p2p.scrollIntoView(false) // Avoid issues with fixed header on firefox
+    await p2p.scrollIntoView({ block: 'center' }) // Avoid issues with fixed header
 
     await p2p.click()
 
@@ -43,7 +45,9 @@ export class MyAccountPage {
 
   private async submitVideoSettings () {
     const submit = $('my-user-video-settings input[type=submit]')
-    await submit.scrollIntoView(false)
+
+    await submit.waitForClickable()
+    await submit.scrollIntoView({ block: 'center' }) // Avoid issues with fixed header
     await submit.click()
   }
 
@@ -54,10 +58,17 @@ export class MyAccountPage {
 
     await container.$('.dropdown-toggle').click()
 
-    const dropdownMenu = () => container.$$('.dropdown-menu .dropdown-item')[1]
+    const deleteItem = () => {
+      return $$('.dropdown-menu .dropdown-item').find<WebdriverIO.Element>(async v => {
+        const text = await v.getText()
+
+        return text.includes('Delete')
+      })
+    }
+
+    await (await deleteItem()).waitForClickable()
 
-    await dropdownMenu().waitForDisplayed()
-    return dropdownMenu().click()
+    return (await deleteItem()).click()
   }
 
   validRemove () {