Skip to content

Commit

Permalink
fix: fix broken recording itest
Browse files Browse the repository at this point in the history
  • Loading branch information
tthvo committed Sep 10, 2024
1 parent e79f101 commit ab69956
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/app/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ export const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
<ToolbarGroup variant="icon-button-group">
<ToolbarItem>
<NotificationBadge
id="notification-badge"
count={unreadNotificationsCount}
variant={
errorNotificationsCount > 0 ? 'attention' : unreadNotificationsCount === 0 ? 'read' : 'unread'
Expand Down
1 change: 0 additions & 1 deletion src/app/TargetView/TargetSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { LoadingView } from '@app/Shared/Components/LoadingView';
import { Target } from '@app/Shared/Services/api.types';
import { getTargetRepresentation, includesTarget, isEqualTarget } from '@app/Shared/Services/api.utils';
import { ServiceContext } from '@app/Shared/Services/Services';
import { NoTargetSelected } from '@app/TargetView/NoTargetSelected';
import { SerializedTarget } from '@app/TargetView/SerializedTarget';
import { useSubscriptions } from '@app/utils/hooks/useSubscriptions';
import { getFromLocalStorage } from '@app/utils/LocalStorage';
Expand Down
2 changes: 2 additions & 0 deletions src/itest/RecordingWorkflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ describe('Recording workflow steps', function () {
const active = await recordings.getRecordings();
assert.equal(active.length, 1);

await cryostat.closeNotificationAlerts();

await recordings.deleteRecording(active[0]);
await sleep(10000);
assert.equal((await recordings.getRecordings()).length, 0);
Expand Down
25 changes: 16 additions & 9 deletions src/itest/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Builder, By, WebDriver, WebElement, WebElementPromise, until, Actions } from 'selenium-webdriver';
import { Builder, By, WebDriver, WebElement, WebElementPromise, until } from 'selenium-webdriver';
import firefox from 'selenium-webdriver/firefox';

const DEFAULT_FIND_ELEMENT_TIMEOUT = 5000;
Expand Down Expand Up @@ -95,16 +95,26 @@ export class Cryostat {
if (skipButton) await skipButton.click();
}

async closeNotificationAlerts(): Promise<void> {
const notiBadge = await this.driver.wait(until.elementLocated(By.id('notification-badge')));

// Toggle to open/close
await notiBadge.click();
return await notiBadge.click();
}

async getLatestNotification(): Promise<ITestNotification> {
const latestNotification = await this.driver.wait(
until.elementLocated(By.className('pf-c-alert-group pf-m-toast')),
until.elementLocated(By.className('pf-v5-c-alert-group pf-m-toast')),
);
return {
title: await getDirectTextContent(
this.driver,
await latestNotification.findElement(By.css('li:last-of-type .pf-c-alert__title')),
await latestNotification.findElement(By.css('li:last-of-type .pf-v5-c-alert__title')),
),
description: await latestNotification.findElement(By.css('li:last-of-type .pf-c-alert__description')).getText(),
description: await latestNotification
.findElement(By.css('li:last-of-type .pf-v5-c-alert__description'))
.getText(),
};
}
}
Expand Down Expand Up @@ -164,10 +174,7 @@ export class Dashboard {
const addCardButton = await getElementById(this.driver, 'dashboard-add-btn');
// Can't use click() directly because the button is wrapped by a Tooltip
const actions = this.driver.actions();
actions
.move({ origin: addCardButton })
.click()
.perform();
await actions.move({ origin: addCardButton }).click().perform();
const twoPartCards = [CardType.AUTOMATED_ANALYSIS, CardType.JFR_METRICS_CHART, CardType.MBEAN_METRICS_CHART];

switch (cardType) {
Expand Down Expand Up @@ -237,7 +244,7 @@ export class Recordings {
}

async getRecordings(): Promise<WebElement[]> {
const tableXPath = "//div[@class='recording-table--inner-container pf-c-scroll-inner-wrapper']";
const tableXPath = "//div[@class='recording-table--inner-container pf-v5-c-scroll-inner-wrapper']";
return this.driver.findElements(By.xpath(`${tableXPath}//tbody`));
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/Settings/__snapshots__/AutoRefresh.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Array [
className="pf-v5-l-split__item"
>
<span
className="pf-v5-c-form-control pf-m-disabled"
className="pf-v5-c-form-control pf-m-disabled duration-picker__form_select"
>
<select
aria-invalid={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ exports[`<DeletionDialogControl/> renders correctly 1`] = `
className="pf-v5-c-expandable-section"
>
<button
aria-controls="expandable-section-content-17177484467765uqbuek5d18"
aria-controls="expandable-section-content-17259356481295ov90zs5f2"
aria-expanded={false}
className="pf-v5-c-expandable-section__toggle"
id="expandable-section-toggle-1717748446776vbr16rjdf6l"
id="expandable-section-toggle-1725935648129cmgthvllnqg"
onClick={[Function]}
type="button"
>
Expand Down Expand Up @@ -103,10 +103,10 @@ exports[`<DeletionDialogControl/> renders correctly 1`] = `
</span>
</button>
<div
aria-labelledby="expandable-section-toggle-1717748446776vbr16rjdf6l"
aria-labelledby="expandable-section-toggle-1725935648129cmgthvllnqg"
className="pf-v5-c-expandable-section__content"
hidden={true}
id="expandable-section-content-17177484467765uqbuek5d18"
id="expandable-section-content-17259356481295ov90zs5f2"
role="region"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ exports[`<NotificationControl/> renders correctly 1`] = `
className="pf-v5-c-expandable-section"
>
<button
aria-controls="expandable-section-content-1717748448129qag9p523vjj"
aria-controls="expandable-section-content-17259356474081mjir64hbea"
aria-expanded={false}
className="pf-v5-c-expandable-section__toggle"
id="expandable-section-toggle-1717748448130xo7znv5n5mo"
id="expandable-section-toggle-17259356474081x6ii635s9t"
onClick={[Function]}
type="button"
>
Expand Down Expand Up @@ -230,10 +230,10 @@ exports[`<NotificationControl/> renders correctly 1`] = `
</span>
</button>
<div
aria-labelledby="expandable-section-toggle-1717748448130xo7znv5n5mo"
aria-labelledby="expandable-section-toggle-17259356474081x6ii635s9t"
className="pf-v5-c-expandable-section__content"
hidden={true}
id="expandable-section-content-1717748448129qag9p523vjj"
id="expandable-section-content-17259356474081mjir64hbea"
role="region"
>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/test/Settings/__snapshots__/Settings.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`<Settings/> renders correctly 1`] = `
className="pf-v5-c-page__main-group"
>
<section
className="pf-v5-c-page__main-section"
className="pf-v5-c-page__main-section pf-m-fill"
>
<nav
aria-label="Breadcrumb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`<WebSocketDebounce/> renders correctly 1`] = `
<div
className="pf-v5-c-number-input__unit"
>
ms
Milliseconds
</div>
</div>
`;

0 comments on commit ab69956

Please sign in to comment.