Skip to content

Commit

Permalink
Add TextEncoder and TextDecoder polyfills, refactor App component to …
Browse files Browse the repository at this point in the history
…pass location prop, and update @scality/core-ui dependency
  • Loading branch information
hervedombya committed Dec 12, 2024
1 parent acddd26 commit 3e5e92f
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 179 deletions.
12 changes: 6 additions & 6 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@hookform/resolvers": "^3.1.0",
"@js-temporal/polyfill": "^0.4.4",
"@kubernetes/client-node": "github:scality/kubernetes-client-javascript.git#browser-0.10.4-64-ge7c6721",
"@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f",
"@scality/core-ui": "git+https://github.com/scality/core-ui#95efcf1ca77e07e43401ad119bbb15ef3b3ffcd7",
"@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5",
"axios": "^0.21.1",
"formik": "2.2.5",
Expand Down
193 changes: 121 additions & 72 deletions ui/src/alert-configuration/ConfigureAlerting.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,8 @@ const commonSetup = async () => {
<>
<NotificationDisplayer />
<Routes>
<Route path="/alerts">
<div>Redirected Alert Page</div>
</Route>
<Route path="/">
<ConfigureAlerting />
</Route>
<Route path="/alerts" element={<div>Redirected Alert Page</div>} />
<Route path="/" element={<ConfigureAlerting />} />
</Routes>
</>,
);
Expand Down Expand Up @@ -259,6 +255,13 @@ describe('<ConfigureAlerting />', () => {

await act(async () => {
await userEvent.click(selectors.authSelect.authClick());
});

await waitFor(() => {
expect(selectors.authSelect.optionCramMd5()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.authSelect.optionCramMd5());
});

Expand All @@ -268,6 +271,13 @@ describe('<ConfigureAlerting />', () => {

await act(async () => {
await userEvent.click(selectors.authSelect.authClick());
});

await waitFor(() => {
expect(selectors.authSelect.optionPlain()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.authSelect.optionPlain());
});

Expand Down Expand Up @@ -355,8 +365,18 @@ describe('<ConfigureAlerting />', () => {
it('show errors on submit with not all required field', async () => {
await commonSetup();

await waitFor(() => {
expect(selectors.enableConfiguration()).toBeInTheDocument();
});
await act(async () => {
await userEvent.click(selectors.enableConfiguration());
});

await waitFor(() => {
expect(selectors.saveButton()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.saveButton());
});

Expand Down Expand Up @@ -403,7 +423,13 @@ describe('<ConfigureAlerting />', () => {
selectors.recipient(),
'[email protected], [email protected]',
);
});

await waitFor(() => {
expect(selectors.saveButton()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.saveButton());
});

Expand Down Expand Up @@ -460,19 +486,38 @@ spec:
);
await userEvent.clear(selectors.port());
await userEvent.type(selectors.port(), '22');
});

await waitFor(() => {
expect(selectors.authSelect.authClick()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.authSelect.authClick());
});

await waitFor(() => {
expect(selectors.authSelect.optionNoAuth()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.authSelect.optionNoAuth());
});

await userEvent.clear(selectors.sender());
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.clear(selectors.sender());
await userEvent.type(selectors.sender(), '[email protected]');

await userEvent.clear(selectors.recipient());
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);
await userEvent.clear(selectors.recipient());
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await waitFor(() => {
expect(selectors.saveButton()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.saveButton());
});

Expand Down Expand Up @@ -542,7 +587,13 @@ spec:
selectors.recipient(),
'[email protected], [email protected]',
);
});

await waitFor(() => {
expect(selectors.saveButton()).toBeInTheDocument();
});

await act(async () => {
await userEvent.click(selectors.saveButton());
});

Expand Down Expand Up @@ -602,21 +653,21 @@ spec:
'smtp4dev.default.svc.cluster.local',
);
await userEvent.type(selectors.port(), '42');
});

await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionLogin());
await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionLogin());

await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');

await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.click(selectors.saveButton());
});
await userEvent.click(selectors.saveButton());

await waitForElementToBeRemoved(() => {
return screen.getByText(/Saving\.\.\./);
Expand Down Expand Up @@ -670,21 +721,21 @@ spec:
'smtp4dev.default.svc.cluster.local',
);
await userEvent.type(selectors.port(), '42');
});

await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionCramMd5());
await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionCramMd5());

await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.secret(), 'xxxyyyzzz-secret');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.secret(), 'xxxyyyzzz-secret');

await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.click(selectors.saveButton());
});
await userEvent.click(selectors.saveButton());

await waitForElementToBeRemoved(() => {
return screen.getByText(/Saving\.\.\./);
Expand Down Expand Up @@ -738,22 +789,21 @@ spec:
'smtp4dev.default.svc.cluster.local',
);
await userEvent.type(selectors.port(), '42');
});
await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionPlain());

await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionPlain());

await userEvent.type(selectors.identity(), 'RenardID');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'xxxyyyzzz-password');
await userEvent.type(selectors.identity(), 'RenardID');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'xxxyyyzzz-password');

await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.click(selectors.saveButton());
});
await userEvent.click(selectors.saveButton());

await waitForElementToBeRemoved(() => {
return screen.getByText(/Saving\.\.\./);
Expand Down Expand Up @@ -876,21 +926,20 @@ spec:
'smtp4dev.default.svc.cluster.local',
);
await userEvent.type(selectors.port(), '42');
});
await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionLogin());

await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionLogin());
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');

await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.click(selectors.sendTestingEmailButton());
});
await userEvent.click(selectors.sendTestingEmailButton());

expect(selectors.sendTestingEmailButton()).toBeDisabled();
await waitForElementToBeRemoved(() => {
Expand Down Expand Up @@ -950,22 +999,22 @@ spec:
'smtp4dev.default.svc.cluster.local',
);
await userEvent.type(selectors.port(), '42');
});

await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionPlain());
await userEvent.click(selectors.authSelect.authClick());
await userEvent.click(selectors.authSelect.optionPlain());

await userEvent.type(selectors.identity(), 'Renard ID');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');
await userEvent.type(selectors.identity(), 'Renard ID');
await userEvent.type(selectors.username(), 'Renard');
await userEvent.type(selectors.password(), 'Renard Password');

await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);
await userEvent.type(selectors.sender(), '[email protected]');
await userEvent.type(
selectors.recipient(),
'[email protected], [email protected]',
);

await userEvent.click(selectors.sendTestingEmailButton());
});
await userEvent.click(selectors.sendTestingEmailButton());

expect(selectors.sendTestingEmailButton()).toBeDisabled();
await waitForElementToBeRemoved(() => {
Expand Down
Loading

0 comments on commit 3e5e92f

Please sign in to comment.