Skip to content

Commit af7c9db

Browse files
committed
test: fix
1 parent 37ef6cb commit af7c9db

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/course-unit/CourseUnit.test.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ describe('<CourseUnit />', () => {
172172
const currentSubSectionName = courseSectionVerticalMock.xblock_info.ancestor_info.ancestors[1].display_name;
173173

174174
const unitHeaderTitle = await screen.findByTestId('unit-header-title');
175-
expect(screen.getByText(unitDisplayName)).toBeInTheDocument();
175+
expect(await screen.findByText(unitDisplayName)).toBeInTheDocument();
176176
expect(within(unitHeaderTitle).getByRole('button', { name: headerTitleMessages.altButtonEdit.defaultMessage })).toBeInTheDocument();
177177
expect(within(unitHeaderTitle).getByRole('button', { name: headerTitleMessages.altButtonSettings.defaultMessage })).toBeInTheDocument();
178-
expect(screen.getByRole('button', { name: headerNavigationsMessages.viewLiveButton.defaultMessage })).toBeInTheDocument();
179-
expect(screen.getByRole('button', { name: headerNavigationsMessages.previewButton.defaultMessage })).toBeInTheDocument();
180-
expect(screen.getByRole('button', { name: currentSectionName })).toBeInTheDocument();
181-
expect(screen.getByRole('button', { name: currentSubSectionName })).toBeInTheDocument();
178+
expect(await screen.findByRole('button', { name: headerNavigationsMessages.viewLiveButton.defaultMessage })).toBeInTheDocument();
179+
expect(await screen.findByRole('button', { name: headerNavigationsMessages.previewButton.defaultMessage })).toBeInTheDocument();
180+
expect(await screen.findByRole('button', { name: currentSectionName })).toBeInTheDocument();
181+
expect(await screen.findByRole('button', { name: currentSubSectionName })).toBeInTheDocument();
182182
});
183183

184184
it('renders the course unit iframe with correct attributes', async () => {
@@ -376,15 +376,19 @@ describe('<CourseUnit />', () => {
376376
await user.click(publishBtn);
377377

378378
// check if the sidebar status is Published and Live
379-
expect(await screen.findByText(
380-
legacySidebarMessages.sidebarTitlePublishedAndLive.defaultMessage,
381-
)).toBeInTheDocument();
379+
waitFor(() => {
380+
expect(screen.getByText(
381+
legacySidebarMessages.sidebarTitlePublishedAndLive.defaultMessage,
382+
)).toBeInTheDocument();
383+
});
382384
expect(await screen.findByText(
383385
unitInfoMessages.publishLastPublished.defaultMessage
384386
.replace('{publishedOn}', courseSectionVerticalMock.xblock_info.published_on)
385387
.replace('{publishedBy}', userName),
386388
)).toBeInTheDocument();
387-
expect(screen.queryByRole('button', { name: legacySidebarMessages.actionButtonPublishTitle.defaultMessage })).not.toBeInTheDocument();
389+
waitFor(() => {
390+
expect(screen.queryByRole('button', { name: legacySidebarMessages.actionButtonPublishTitle.defaultMessage })).not.toBeInTheDocument();
391+
});
388392
expect(await screen.findByText(unitDisplayName)).toBeInTheDocument();
389393

390394
axiosMock

0 commit comments

Comments
 (0)