Skip to content

Commit 714f491

Browse files
committed
[FIX] test_website: adapt snippet_background_video tour
1 parent c272c4e commit 714f491

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

addons/html_editor/static/src/main/media/media_dialog/video_selector.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,7 @@ export class VideoSelector extends Component {
129129
}
130130
});
131131

132-
onMounted(async () => {
133-
await Promise.all(
134-
this.props.vimeoPreviewIds.map(async (videoId) => {
135-
const { thumbnail_url: thumbnailSrc } = await this.http.get(
136-
`https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/${encodeURIComponent(
137-
videoId
138-
)}`
139-
);
140-
this.state.vimeoPreviews.push({
141-
id: videoId,
142-
thumbnailSrc,
143-
src: `https://player.vimeo.com/video/${encodeURIComponent(videoId)}`,
144-
});
145-
})
146-
);
147-
});
132+
onMounted(async () => this.prepareVimeoPreviews());
148133

149134
useAutofocus();
150135

@@ -275,4 +260,24 @@ export class VideoSelector extends Component {
275260
return div;
276261
});
277262
}
263+
264+
/**
265+
* Based on the config vimeo ids, prepare the vimeo previews.
266+
*/
267+
async prepareVimeoPreviews() {
268+
await Promise.all(
269+
this.props.vimeoPreviewIds.map(async (videoId) => {
270+
const { thumbnail_url: thumbnailSrc } = await this.http.get(
271+
`https://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/${encodeURIComponent(
272+
videoId
273+
)}`
274+
);
275+
this.state.vimeoPreviews.push({
276+
id: videoId,
277+
thumbnailSrc,
278+
src: `https://player.vimeo.com/video/${encodeURIComponent(videoId)}`,
279+
});
280+
})
281+
);
282+
}
278283
}

addons/test_website/static/tests/tours/snippet_background_video.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @odoo-module **/
22

33
import { patch } from "@web/core/utils/patch";
4-
import { VideoSelector } from '@web_editor/components/media_dialog/video_selector';
4+
import { VideoSelector } from "@html_editor/main/media/media_dialog/video_selector";
55
import { insertSnippet, registerWebsitePreviewTour } from "@website/js/tours/tour_utils";
66

77
registerWebsitePreviewTour(
@@ -54,7 +54,7 @@ registerWebsitePreviewTour(
5454
},
5555
{
5656
content: "Click on the 'Background Video' button option.",
57-
trigger: "we-button[data-name='bg_video_toggler_opt']",
57+
trigger: "button[data-action-id='toggleBgVideo']",
5858
run: "click",
5959
},
6060
{

addons/test_website/tests/test_snippet_background_video.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
@odoo.tests.common.tagged('post_install', '-at_install')
88
class TestSnippetBackgroundVideo(odoo.tests.HttpCase):
9-
# TODO master-mysterious-egg fix error
10-
@unittest.skip("prepare mysterious-egg for merging")
9+
1110
def test_snippet_background_video(self):
1211
self.start_tour("/", "snippet_background_video", login="admin")

0 commit comments

Comments
 (0)