Skip to content

Commit

Permalink
Fixes bugs and tests for dependencies page
Browse files Browse the repository at this point in the history
  • Loading branch information
Iloveall committed Mar 4, 2024
1 parent 642be23 commit 9d9bfec
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 30 deletions.
10 changes: 6 additions & 4 deletions e2e/items/dependencies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ test('error/retry on dependencies/prerequisites services', async ({ page }) => {
await page.route(`${apiUrl}/items/7523720120450464843/dependencies`, route => route.abort());
await initAsUsualUser(page);
await page.goto('/a/7523720120450464843;p=7528142386663912287;pa=0/dependencies');
await expect.soft(page.getByText('Unable to load the dependencies')).toBeVisible(); // TODO: should be "prerequisites"
// TODO: There is no proper error messages when the dependencies service fails
await expect.soft(page.getByText('Unable to load the prerequisites')).toBeVisible();
await expect.soft(page.getByText('Unable to load the dependencies')).toBeVisible();
});
await test.step('test retry', async () => {
await page.unroute(`${apiUrl}/items/7523720120450464843/prerequisites`);
await page.getByRole('button', { name: 'Retry' }).click(); // TODO make it more specific to press the right one
await page.getByRole('button', { name: 'Retry to load prerequisites' }).click();
await expect.soft(page.getByText('There are no prerequisites')).toBeVisible();
// TODO: test retry on dependencies as well
await page.unroute(`${apiUrl}/items/7523720120450464843/dependencies`);
await page.getByRole('button', { name: 'Retry to load dependencies' }).click();
await expect.soft(page.getByText('There are no other content')).toBeVisible();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ <h2 class="alg-h2 alg-text-normal alg-base-title-primary-space" i18n>Prerequisit
<alg-error
*ngIf="state.isError"
icon="fa fa-exclamation-triangle"
i18n-message message="Unable to load the dependencies"
i18n-message message="Unable to load the prerequisites"
i18n-buttonCaption buttonCaption="Retry to load prerequisites"
[showRefreshButton]="true"
(refresh)="refresh()"
></alg-error>
Expand Down Expand Up @@ -63,6 +64,15 @@ <h2 class="alg-h2 alg-text-normal depending-content-title" i18n>Content dependin
<div *ngIf="dependenciesState$ | async as state">
<alg-loading size="medium" *ngIf="state.isFetching || changeInProgress"></alg-loading>

<alg-error
*ngIf="state.isError"
icon="fa fa-exclamation-triangle"
i18n-message message="Unable to load the dependencies"
i18n-buttonCaption buttonCaption="Retry to load dependencies"
[showRefreshButton]="true"
(refresh)="refresh()"
></alg-error>

<ng-container *ngIf="!state.isFetching && !changeInProgress && state.data">
<ng-container *ngIf="state.data.length > 0; else noOtherContent">
<ul class="list">
Expand Down
Loading

0 comments on commit 9d9bfec

Please sign in to comment.