Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSTEAM1-1461: Fetch On Demand TV data from BFF #12188

Merged
merged 93 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
85448fa
Add TV as a page type
karinathomasbbc Nov 18, 2024
3215ea4
Support TV page in constructPageFetchURL
karinathomasbbc Nov 18, 2024
ac17220
Convert getInitialData to TS;
karinathomasbbc Nov 18, 2024
fb98540
Remove leading / from tv page url in order for local data fetching to…
karinathomasbbc Nov 18, 2024
11533fb
Update TV fixture data from BFF
karinathomasbbc Nov 18, 2024
f15069a
Update TV fixture data from BFF
karinathomasbbc Nov 18, 2024
dfe14fc
Add TV_PAGE
karinathomasbbc Nov 18, 2024
f53020c
Update snapshot
karinathomasbbc Nov 18, 2024
9e151b4
Attempting to fix failing tests
karinathomasbbc Nov 18, 2024
96a8ba7
Fix TS issues
karinathomasbbc Nov 18, 2024
d6d767c
Update TV fixture data from BFF
karinathomasbbc Nov 18, 2024
a365c25
Update integration snapshots
karinathomasbbc Nov 18, 2024
5c8f058
Replace all references of w172xcg0kg6vph8 with w172yjj7rfhxp1p
karinathomasbbc Nov 18, 2024
7066500
Update hausa tv test page snapshots
karinathomasbbc Nov 18, 2024
3110df3
Fix tests
karinathomasbbc Nov 18, 2024
f5224b6
processRecentEpisodes no longer required for TV
karinathomasbbc Nov 18, 2024
d03cb54
Update fixture data
karinathomasbbc Nov 18, 2024
8314852
Fix E2E test
karinathomasbbc Nov 18, 2024
2d34428
Update tests now that fixture data has been updated
karinathomasbbc Nov 18, 2024
9da8cf3
Updates to data based on latest BFF changes
karinathomasbbc Nov 19, 2024
9083eb9
Use title from media block instead of requiring an override
karinathomasbbc Nov 19, 2024
243ac2b
Fix tests
karinathomasbbc Nov 19, 2024
636095b
Update snapshots
karinathomasbbc Nov 19, 2024
5a1f756
Remove mediaOverrides logic as it has been implemented in the BFF
karinathomasbbc Nov 19, 2024
143283b
Update tests & snapshots
karinathomasbbc Nov 19, 2024
55b333c
Remove unused imports
karinathomasbbc Nov 19, 2024
982654c
Update integration snapshots
karinathomasbbc Nov 19, 2024
f56c4d1
Update fixture data for cypress tests
karinathomasbbc Nov 19, 2024
ecac5ac
Revert "Update fixture data for cypress tests"
karinathomasbbc Nov 19, 2024
dbab89c
Update fixture data for cypress tests
karinathomasbbc Nov 19, 2024
a5e0bdb
Fix test
karinathomasbbc Nov 19, 2024
8e3a1fc
Add support for id without leading `/`
karinathomasbbc Nov 19, 2024
b84a349
Remove tv tests from getEpisodeAvailability as it is no longer invoked
karinathomasbbc Nov 19, 2024
b1aaff3
Update fixture data & corresponding test
karinathomasbbc Nov 19, 2024
3bfe290
Update test name
karinathomasbbc Nov 19, 2024
56b6855
Update fixture data
karinathomasbbc Nov 19, 2024
47224db
Fix test & corresponding snapshots
karinathomasbbc Nov 19, 2024
90dc96e
Fix test & corresponding snapshots
karinathomasbbc Nov 19, 2024
772fe5e
Fix ati tests
karinathomasbbc Nov 19, 2024
5ca7f20
Update integration snapshots
karinathomasbbc Nov 19, 2024
8ae7b0d
Use analytics data from the BFF
karinathomasbbc Nov 19, 2024
40961fe
Update TV fixture data from BFF
karinathomasbbc Nov 19, 2024
5e54377
Update integration snapshots
karinathomasbbc Nov 19, 2024
4b358d4
Fix tests
karinathomasbbc Nov 20, 2024
2688d4d
Fix tests
karinathomasbbc Nov 20, 2024
573fc17
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Nov 20, 2024
e3769d6
Merge branch 'latest' of github.com:bbc/simorgh into WSTEAM1-1461-sim…
karinathomasbbc Nov 21, 2024
7fb6f59
Fix tests
karinathomasbbc Nov 21, 2024
59ede59
Update TV fixture data from BFF
karinathomasbbc Nov 21, 2024
4a37213
Update snapshots
karinathomasbbc Nov 21, 2024
239062d
Fix tests
karinathomasbbc Nov 21, 2024
a1a1a01
Fix tests
karinathomasbbc Nov 21, 2024
f63c38f
Remove references to MEDIA_PAGE as it is being phased out once all me…
karinathomasbbc Nov 26, 2024
325c3b4
Adding a test for TV pages
karinathomasbbc Nov 26, 2024
ae36976
Use TV_PAGE instead of MEDIA_PAGE
karinathomasbbc Nov 26, 2024
99ad6b9
Use TV_PAGE instead of MEDIA_PAGE
karinathomasbbc Nov 26, 2024
d435db2
Update test
karinathomasbbc Nov 26, 2024
2e84ec9
Use TV_PAGE instead of MEDIA_PAGE
karinathomasbbc Nov 26, 2024
177082c
Add test for TV_PAGE
karinathomasbbc Nov 26, 2024
fb57dc8
Use TV_PAGE instead of MEDIA_PAGE
karinathomasbbc Nov 26, 2024
9287b15
Use TV_PAGE instead of MEDIA_PAGE
karinathomasbbc Nov 26, 2024
b64d422
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' of github…
karinathomasbbc Nov 26, 2024
f95c1b1
Delete amp test for OD Radio as it is not supported
karinathomasbbc Nov 26, 2024
19f55e1
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' of github…
karinathomasbbc Nov 26, 2024
e3c0cdd
Audio pages don.t support AMP
karinathomasbbc Nov 26, 2024
c39b89e
Clean up episode availability
karinathomasbbc Nov 26, 2024
da999ce
Use TV_PAGE instead of media
karinathomasbbc Nov 26, 2024
608005d
Use TV_PAGE instead of media
karinathomasbbc Nov 26, 2024
f1fd2af
Prettier
karinathomasbbc Nov 26, 2024
b94bd61
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Nov 26, 2024
cab8c5a
Reorder page types
karinathomasbbc Nov 26, 2024
a28c855
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' into WSTE…
karinathomasbbc Nov 26, 2024
c170b87
Use ATIData since the page has been migrated
karinathomasbbc Nov 27, 2024
6ce956b
Merge branch 'WSTEAM1-1461-simorgh-fetch-tv-from-bff' of github.com:b…
karinathomasbbc Nov 27, 2024
bc969b5
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' into WSTE…
karinathomasbbc Nov 27, 2024
ee063ee
Use content type from atiAnalytics for Chartbeat
karinathomasbbc Nov 27, 2024
09c9e87
Merge branch 'WSTEAM1-1461-simorgh-fetch-tv-from-bff' of github.com:b…
karinathomasbbc Nov 27, 2024
c1b0d23
Set recentEpisodes to null if toggle disabled
karinathomasbbc Nov 27, 2024
5781ebd
Use fixture data for TV Storybook
karinathomasbbc Nov 27, 2024
c6f378c
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' into WSTE…
karinathomasbbc Nov 27, 2024
e4d0398
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' into WSTE…
karinathomasbbc Nov 28, 2024
47d3055
Merge branch 'WSTEAM1-1347-fetch-ondemand-podcast-from-bff' into WSTE…
karinathomasbbc Dec 3, 2024
da90de5
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Dec 4, 2024
62a0535
Merge branch 'fetch-live-audio-data-on-test' into WSTEAM1-1461-simorg…
karinathomasbbc Dec 4, 2024
b322df2
Merge branch 'fetch-live-audio-data-on-test' into WSTEAM1-1461-simorg…
karinathomasbbc Dec 4, 2024
f275a52
Merge branch 'fetch-live-audio-data-on-test' into WSTEAM1-1461-simorg…
karinathomasbbc Dec 4, 2024
d03aa99
Fetch live data on the test environment for on demand tv
karinathomasbbc Dec 4, 2024
77b012f
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Dec 5, 2024
d083da5
Simplify recent episode tests & check that the number of recent episo…
karinathomasbbc Dec 5, 2024
2500903
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Dec 5, 2024
23ee0ae
Fix recent episode cypress tests for OD TV
karinathomasbbc Dec 5, 2024
ba0f8e6
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Dec 5, 2024
7d19696
Merge branch 'latest' into WSTEAM1-1461-simorgh-fetch-tv-from-bff
karinathomasbbc Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 15 additions & 43 deletions cypress/e2e/pages/onDemandTV/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
getEpisodeAvailability,
videoPlaceholderImageUrl,
} from '../../../support/helpers/onDemandRadioTv';
import getDataUrl from '../../../support/helpers/getDataUrl';
import processRecentEpisodes from '../../../../src/app/routes/utils/processRecentEpisodes';

export default ({ service, pageType, variant }) => {
describe(`Tests for ${service} ${pageType}`, () => {
Expand Down Expand Up @@ -62,55 +60,29 @@ export default ({ service, pageType, variant }) => {
);
// There cannot be more episodes shown than the max allowed
if (recentEpisodesEnabled) {
const recentEpisodesMaxNumber = path(
['recentVideoEpisodes', 'value'],
toggles,
const recentEpisodesMaxNumber = parseInt(
toggles?.recentVideoEpisodes.value,
10,
);
const currentPath = Cypress.env('currentPath');
const url =
Cypress.env('APP_ENV') === 'test'
? `${currentPath}?renderer_env=live`
: `${currentPath}`;

cy.request(getDataUrl(url)).then(({ body }) => {
const episodeId = path(['content', 'blocks', 0, 'id'], body);

const expectedNumberOfEpisodes = processRecentEpisodes(body, {
exclude: episodeId,
recentEpisodesLimit: recentEpisodesMaxNumber,
}).length;
cy.log(
`Number of available episodes? ${recentEpisodesMaxNumber}`,
);
// More than one episode expected
cy.getPageDataFromWindow().then(data => {
const { recentEpisodes } = data;
cy.log({ recentEpisodes });

cy.log(
`Number of available episodes? ${expectedNumberOfEpisodes}`,
);
// More than one episode expected
if (expectedNumberOfEpisodes > 1) {
if (recentEpisodes?.length > 0 && recentEpisodesMaxNumber > 1) {
cy.get('[data-e2e=recent-episodes-list]').should('exist');

cy.get('[data-e2e=recent-episodes-list]').within(() => {
cy.get('[data-e2e=recent-episodes-list-item]')
.its('length')
.should('eq', expectedNumberOfEpisodes);
cy.get('[data-e2e=recent-episodes-list-item]').should(
'have.length.of.at.most',
recentEpisodesMaxNumber,
);
});
}
// If there is only one item, it is not in a list
else if (expectedNumberOfEpisodes === 1) {
cy.get('aside[aria-labelledby=recent-episodes]').within(
() => {
cy.get('[data-e2e="recent-episodes-list"]').should(
'not.exist',
);
},
);
}
// No items expected
else {
cy.get('aside[aria-labelledby=recent-episodes]').should(
'not.exist',
);

cy.log('No episodes present or available');
}
});
}
// Not toggled on for this service
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ module.exports = () => ({
},
local: {
paths: [
'/hausa/bbc_hausa_tv/tv/w172xcg0kg6vph8', // Episode
'/hausa/bbc_hausa_tv/tv/w172yjj7rfhxp1p', // Episode
],
enabled: true,
},
Expand Down
Loading
Loading