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

Remove voiceover from exp schema #20675

Draft
wants to merge 39 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f003882
Adds conversions function for exploration migration.
Nik-09 Apr 19, 2024
71a0266
Removes recorded voiceover fields from exploration states backend
Nik-09 Apr 22, 2024
d000747
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 8, 2024
68b14ad
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 9, 2024
a930682
Fixes merge conflict
Nik-09 Jul 8, 2024
17f95f4
Removed recorded voiceover from exploration
Nik-09 Jul 9, 2024
d9e5a91
Removes feature flag
Nik-09 Jul 9, 2024
2214f8b
Removes voice artist models and UI
Nik-09 Jul 10, 2024
7f21430
Removes audio translation service files and uses.
Nik-09 Jul 14, 2024
d62e948
Fixes merge conflict
Nik-09 Jul 15, 2024
e7a8ac4
Fixes backend tests
Nik-09 Jul 15, 2024
16eacbc
Fixes backend tests
Nik-09 Jul 15, 2024
9fb7eca
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jul 16, 2024
49380f3
Fixes frontend tests
Nik-09 Jul 21, 2024
439c490
Fixes merge conflict and frontend test
Nik-09 Jul 29, 2024
79c333b
Fixes frontend tests
Nik-09 Jul 29, 2024
7de0993
Fixes frontend tests
Nik-09 Aug 1, 2024
a348168
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 1, 2024
827700f
Fixes lint issues
Nik-09 Aug 1, 2024
789cb77
Fixes lint issues
Nik-09 Aug 3, 2024
7519f17
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 3, 2024
77ce7d1
Fixes merge conflict
Nik-09 Aug 7, 2024
23661e3
Fixes typescript checks
Nik-09 Aug 8, 2024
ff67301
Fixes merge conflict
Nik-09 Aug 18, 2024
4acb589
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 4, 2024
8072d16
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 21, 2024
3ea710d
Fixes frontend tests
Nik-09 Sep 23, 2024
a06d486
Fixes merge conflicts
Nik-09 Sep 30, 2024
c8a2218
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Oct 7, 2024
7f34239
Fixes merge conflict
Nik-09 Oct 30, 2024
11942df
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 2, 2024
e89e16c
Fixes frontend tests
Nik-09 Nov 7, 2024
a8ab730
Fixes merge conflict
Nik-09 Nov 11, 2024
fc155ba
Reverts unnecessary changes.
Nik-09 Nov 24, 2024
bd34115
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 24, 2024
95d39fa
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Dec 1, 2024
c49c609
Fixes backend and lint checks
Nik-09 Dec 1, 2024
a87e250
Fixes merge conflict
Nik-09 Dec 10, 2024
446684c
Merge branch 'develop' into remove_voiceover_from_exp_schema
seanlip Dec 12, 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
Prev Previous commit
Next Next commit
Fixes frontend tests
  • Loading branch information
Nik-09 committed Jul 29, 2024
commit 79c333b35f619cb2c5b06de01a7e6e0aa579f2b2
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ describe('Audio preloader service', () => {
content_id: 'content',
html: '<p>State 1 Content</p>',
},
recorded_voiceovers: {
voiceovers_mapping: {
content: {
en: {
filename: 'en-2.mp3',
file_size_bytes: 120000,
needs_update: false,
duration_secs: 1.2,
},
},
default_outcome: {},
},
},
interaction: {
id: 'Continue',
default_outcome: {
Expand Down Expand Up @@ -149,18 +136,6 @@ describe('Audio preloader service', () => {
content_id: 'content',
html: 'Congratulations, you have finished!',
},
recorded_voiceovers: {
voiceovers_mapping: {
content: {
en: {
filename: 'en-4.mp3',
file_size_bytes: 120000,
needs_update: false,
duration_secs: 1.2,
},
},
},
},
interaction: {
id: 'EndExploration',
default_outcome: null,
Expand All @@ -185,19 +160,6 @@ describe('Audio preloader service', () => {
content_id: 'content',
html: '<p>State 2 Content</p>',
},
recorded_voiceovers: {
voiceovers_mapping: {
content: {
en: {
filename: 'en-3.mp3',
file_size_bytes: 120000,
needs_update: false,
duration_secs: 1.2,
},
},
default_outcome: {},
},
},
interaction: {
id: 'Continue',
default_outcome: {
Expand Down Expand Up @@ -233,20 +195,6 @@ describe('Audio preloader service', () => {
content_id: 'content',
html: '<p>Introduction Content</p>',
},
recorded_voiceovers: {
voiceovers_mapping: {
content: {
en: {
filename: 'en-1.mp3',
file_size_bytes: 120000,
needs_update: false,
duration_secs: 1.2,
},
},
default_outcome: {},
feedback_1: {},
},
},
interaction: {
id: 'TextInput',
default_outcome: {
Expand Down Expand Up @@ -378,53 +326,6 @@ describe('Audio preloader service', () => {
explorationObjectFactory.createFromBackendDict(explorationDict);
audioPreloaderService.init(exploration);
audioTranslationLanguageService.init(['en'], 'en', 'en', false);
audioPreloaderService.kickOffAudioPreloader(
exploration.getInitialState().name as string
);

expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-1.mp3', 'en-2.mp3', 'en-3.mp3']);
expect(audioPreloaderService.isLoadingAudioFile('en-1.mp3')).toBeTrue();
expect(audioPreloaderService.isLoadingAudioFile('en-2.mp3')).toBeTrue();
expect(audioPreloaderService.isLoadingAudioFile('en-3.mp3')).toBeTrue();
expect(audioPreloaderService.isLoadingAudioFile('en-4.mp3')).toBeFalse();

httpTestingController.expectOne(requestUrl1).flush(audioBlob);
flushMicrotasks();

expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-2.mp3', 'en-3.mp3', 'en-4.mp3']);
expect(audioPreloaderService.isLoadingAudioFile('en-4.mp3')).toBeTrue();

httpTestingController.expectOne(requestUrl2).flush(audioBlob);
flushMicrotasks();

expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-3.mp3', 'en-4.mp3']);

httpTestingController.expectOne(requestUrl3).flush(audioBlob);
flushMicrotasks();

expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-4.mp3']);

httpTestingController.expectOne(requestUrl4).flush(audioBlob);
flushMicrotasks();

expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual([]);
}));

it('should maintain the correct number of download requests in queue with accent feature enabled', fakeAsync(() => {
const exploration =
explorationObjectFactory.createFromBackendDict(explorationDict);
audioPreloaderService.init(exploration);
audioTranslationLanguageService.init(['en'], 'en', 'en', false);

let manualVoiceoverBackendDict: VoiceoverBackendDict = {
filename: 'a.mp3',
Expand All @@ -440,10 +341,6 @@ describe('Audio preloader service', () => {
entityVoiceoversService,
'getAllContentIdsToVoiceovers'
).and.returnValue({content: [manualVoiceover]});
spyOn(
audioPreloaderService,
'isVoiceoverContributionWithAccentEnabled'
).and.returnValue(true);

audioPreloaderService.kickOffAudioPreloader(
exploration.getInitialState().name as string
Expand Down Expand Up @@ -486,31 +383,56 @@ describe('Audio preloader service', () => {
explorationObjectFactory.createFromBackendDict(explorationDict);
audioPreloaderService.init(exploration);
audioTranslationLanguageService.init(['en'], 'en', 'en', false);

let allContentIdMethodSpy = spyOn(
entityVoiceoversService,
'getAllContentIdsToVoiceovers'
);

let manualVoiceoverBackendDict1: VoiceoverBackendDict = {
filename: 'a.mp3',
file_size_bytes: 200000,
needs_update: false,
duration_secs: 10.0,
};

let manualVoiceover1 = Voiceover.createFromBackendDict(
manualVoiceoverBackendDict1
);

let manualVoiceoverBackendDict2: VoiceoverBackendDict = {
filename: 'b.mp3',
file_size_bytes: 200000,
needs_update: false,
duration_secs: 10.0,
};

let manualVoiceover2 = Voiceover.createFromBackendDict(
manualVoiceoverBackendDict2
);

let requestUrl1 = '/assetsdevhandler/exploration/1/assets/audio/a.mp3';
let requestUrl2 = '/assetsdevhandler/exploration/1/assets/audio/b.mp3';

allContentIdMethodSpy.and.returnValue({content: [manualVoiceover1]});

audioPreloaderService.kickOffAudioPreloader(
exploration.getInitialState().name as string
);

httpTestingController.expectOne(requestUrl1);
httpTestingController.expectOne(requestUrl2);
httpTestingController.expectOne(requestUrl3);
expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-1.mp3', 'en-2.mp3', 'en-3.mp3']);

audioPreloaderService.restartAudioPreloader('State 3');
).toEqual(['a.mp3']);

httpTestingController.expectOne(requestUrl4);
expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-4.mp3']);
allContentIdMethodSpy.and.returnValue({content: [manualVoiceover2]});

audioPreloaderService.restartAudioPreloader('State 2');

httpTestingController.expectOne(requestUrl3);
httpTestingController.expectOne(requestUrl4);
httpTestingController.expectOne(requestUrl2);
expect(
audioPreloaderService.getFilenamesOfAudioCurrentlyDownloading()
).toEqual(['en-3.mp3', 'en-4.mp3']);
).toEqual(['b.mp3']);
});

it('should properly set most recently requested audio filename', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ describe('Voiceover Admin Page component ', () => {
voiceoverBackendApiService,
'fetchVoiceoverAdminDataAsync'
).and.returnValue(Promise.resolve(voiceoverAdminDataResponse));
spyOn(
voiceoverBackendApiService,
'fetchVoiceArtistMetadataAsync'
).and.returnValue(Promise.resolve(voiceArtistMetadataInfo));

expect(
voiceoverBackendApiService.fetchVoiceoverAdminDataAsync
Expand All @@ -128,9 +124,6 @@ describe('Voiceover Admin Page component ', () => {
expect(
voiceoverBackendApiService.fetchVoiceoverAdminDataAsync
).toHaveBeenCalled();
expect(
voiceoverBackendApiService.fetchVoiceArtistMetadataAsync
).toHaveBeenCalled();
expect(component.availableLanguageAccentDescriptionsToCodes).toEqual({
'Hindi (India)': 'hi-IN',
});
Expand Down Expand Up @@ -257,66 +250,4 @@ describe('Voiceover Admin Page component ', () => {

expect(component.languageAccentDropdownIsShown).toBeFalse();
});

it('should be able to add accent for voiceovers', fakeAsync(() => {
component.languageAccentMasterList = {
hi: {
'hi-IN': 'Hindi (India)',
},
en: {
'en-US': 'English (United States)',
},
};
component.voiceArtistIdToVoiceArtistName = {
voiceArtistId: 'Voice Artist',
};
component.voiceArtistIdToLanguageMapping = {
voiceArtistId: {
en: '',
},
};
spyOn(ngbModal, 'open').and.returnValue({
componentInstance: {},
result: Promise.resolve('en-US'),
} as NgbModalRef);

component.addLanguageAccentForVoiceArtist('voiceArtistId', 'en');
tick();

expect(ngbModal.open).toHaveBeenCalled();
expect(component.voiceArtistIdToLanguageMapping.voiceArtistId.en).toEqual(
'en-US'
);
}));

it('should not add accent for voiceovers when confirm modal is cancelled', fakeAsync(() => {
component.languageAccentMasterList = {
hi: {
'hi-IN': 'Hindi (India)',
},
en: {
'en-US': 'English (United States)',
},
};
component.voiceArtistIdToVoiceArtistName = {
voiceArtistId: 'Voice Artist',
};
component.voiceArtistIdToLanguageMapping = {
voiceArtistId: {
en: '',
},
};
spyOn(ngbModal, 'open').and.returnValue({
componentInstance: {},
result: Promise.reject(),
} as NgbModalRef);

component.addLanguageAccentForVoiceArtist('voiceArtistId', 'en');
tick();

expect(ngbModal.open).toHaveBeenCalled();
expect(component.voiceArtistIdToLanguageMapping.voiceArtistId.en).toEqual(
''
);
}));
});
33 changes: 0 additions & 33 deletions core/templates/services/audio-player.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ describe('AudioPlayerService', () => {
it('should stop playing track when called', fakeAsync(() => {
spyOn(audioPlayerService, 'setCurrentTime');
spyOn(console, 'error');
spyOn(audioTranslationManagerService, 'clearSecondaryAudioTranslations');
let subjectNext = spyOn(Subject.prototype, 'next');
audioPlayerService.loadAsync('test.mp3');
flushMicrotasks();
Expand All @@ -196,9 +195,6 @@ describe('AudioPlayerService', () => {

expect(console.error).toHaveBeenCalledWith('Howl.stop');
expect(subjectNext).toHaveBeenCalledTimes(2);
expect(
audioTranslationManagerService.clearSecondaryAudioTranslations
).toHaveBeenCalled();
}));

it(
Expand Down Expand Up @@ -444,39 +440,10 @@ describe('AudioPlayerService', () => {
}));
});

it(
'should clear secondary audio translations when audio ' + 'ends',
fakeAsync(async () => {
spyOn(howler, 'Howl').and.returnValue({
on: (evt: string, func: () => void) => {
if (evt === 'end') {
func();
}
},
} as Howl);
spyOn(assetsBackendApiService, 'loadAudio').and.returnValue(
Promise.resolve({
data: new Blob(),
filename: 'test',
})
);
spyOn(audioTranslationManagerService, 'clearSecondaryAudioTranslations');

audioPlayerService.loadAsync('test.mp3');
flushMicrotasks();

expect(
audioTranslationManagerService.clearSecondaryAudioTranslations
).toHaveBeenCalled();
})
);

it('should display error when audio fails to load', fakeAsync(() => {
spyOn(assetsBackendApiService, 'loadAudio').and.returnValue(
Promise.reject('Error')
);
spyOn(audioTranslationManagerService, 'clearSecondaryAudioTranslations');

audioPlayerService.loadAsync('test.mp3').then(successHandler, failHandler);
flushMicrotasks();

Expand Down