diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-18 10:20:55 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-19 15:05:35 +0200 |
commit | bbe078ba55be635b5fc92f8f6286c45792b9e7e5 (patch) | |
tree | 6d64d40dec7d445a9855856d4cd42587d360bab5 /client/e2e/src/po | |
parent | e379f813d45c4a83442aa13268d351e2605a7a01 (diff) | |
download | PeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.tar.gz PeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.tar.zst PeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.zip |
Fix e2e tests in parallel
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r-- | client/e2e/src/po/my-account.ts | 46 | ||||
-rw-r--r-- | client/e2e/src/po/video-watch.po.ts | 14 |
2 files changed, 34 insertions, 26 deletions
diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts index e49372983..49db789fb 100644 --- a/client/e2e/src/po/my-account.ts +++ b/client/e2e/src/po/my-account.ts | |||
@@ -16,34 +16,32 @@ export class MyAccountPage { | |||
16 | 16 | ||
17 | // My account Videos | 17 | // My account Videos |
18 | 18 | ||
19 | getLastVideoName () { | 19 | removeVideo (name: string) { |
20 | return this.getAllVideoNameElements().first().getText() | 20 | return this.getVideoElement(name).element(by.css('my-delete-button')).click() |
21 | } | ||
22 | |||
23 | removeLastVideo () { | ||
24 | return this.getLastVideoElement().element(by.css('my-delete-button')).click() | ||
25 | } | 21 | } |
26 | 22 | ||
27 | validRemove () { | 23 | validRemove () { |
28 | return element(by.css('.action-button-submit')).click() | 24 | return element(by.css('.action-button-submit')).click() |
29 | } | 25 | } |
30 | 26 | ||
31 | countVideos () { | 27 | countVideos (names: string[]) { |
32 | return this.getAllVideoNameElements().count() | 28 | return element.all(by.css('.video')) |
29 | .filter(e => { | ||
30 | return e.element(by.css('.video-miniature-name')) | ||
31 | .getText() | ||
32 | .then(t => names.some(n => t.includes(n))) | ||
33 | }) | ||
34 | .count() | ||
33 | } | 35 | } |
34 | 36 | ||
35 | // My account playlists | 37 | // My account playlists |
36 | 38 | ||
37 | getLastUpdatedPlaylistName () { | 39 | getPlaylistVideosText (name: string) { |
38 | return this.getLastUpdatedPlaylist().element(by.css('.miniature-name')).getText() | 40 | return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText() |
39 | } | ||
40 | |||
41 | getLastUpdatedPlaylistVideosText () { | ||
42 | return this.getLastUpdatedPlaylist().element(by.css('.miniature-playlist-info-overlay')).getText() | ||
43 | } | 41 | } |
44 | 42 | ||
45 | clickOnLastUpdatedPlaylist () { | 43 | clickOnPlaylist (name: string) { |
46 | return this.getLastUpdatedPlaylist().element(by.css('.miniature-thumbnail')).click() | 44 | return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click() |
47 | } | 45 | } |
48 | 46 | ||
49 | countTotalPlaylistElements () { | 47 | countTotalPlaylistElements () { |
@@ -56,17 +54,17 @@ export class MyAccountPage { | |||
56 | 54 | ||
57 | // My account Videos | 55 | // My account Videos |
58 | 56 | ||
59 | private getLastVideoElement () { | 57 | private getVideoElement (name: string) { |
60 | return element.all(by.css('.video')).first() | 58 | return element.all(by.css('.video')) |
61 | } | 59 | .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name))) |
62 | 60 | .first() | |
63 | private getAllVideoNameElements () { | ||
64 | return element.all(by.css('.video-miniature-name')) | ||
65 | } | 61 | } |
66 | 62 | ||
67 | // My account playlists | 63 | // My account playlists |
68 | 64 | ||
69 | private getLastUpdatedPlaylist () { | 65 | private getPlaylist (name: string) { |
70 | return element.all(by.css('my-video-playlist-miniature')).first() | 66 | return element.all(by.css('my-video-playlist-miniature')) |
67 | .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name))) | ||
68 | .first() | ||
71 | } | 69 | } |
72 | } | 70 | } |
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index 9bb0a3919..c06b131b6 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts | |||
@@ -126,8 +126,18 @@ export class VideoWatchPage { | |||
126 | return element(by.css('.action-button-save')).click() | 126 | return element(by.css('.action-button-save')).click() |
127 | } | 127 | } |
128 | 128 | ||
129 | async saveToWatchLater () { | 129 | async createPlaylist (name: string) { |
130 | return element.all(by.css('my-video-add-to-playlist .playlist')).first().click() | 130 | await element(by.css('.new-playlist-button')).click() |
131 | |||
132 | await element(by.css('#displayName')).sendKeys(name) | ||
133 | |||
134 | return element(by.css('.new-playlist-block input[type=submit]')).click() | ||
135 | } | ||
136 | |||
137 | async saveToPlaylist (name: string) { | ||
138 | return element.all(by.css('my-video-add-to-playlist .playlist')) | ||
139 | .filter(p => p.getText().then(t => t === name)) | ||
140 | .click() | ||
131 | } | 141 | } |
132 | 142 | ||
133 | waitUntilVideoName (name: string, maxTime: number) { | 143 | waitUntilVideoName (name: string, maxTime: number) { |