Skip to content

Commit

Permalink
test(e2e): added stacktrace to check why the test breaks
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Villanueva <[email protected]>
  • Loading branch information
danivilla9 committed Dec 12, 2024
1 parent 4bde536 commit 91e61fe
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/src/openshift-local-extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,28 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
await playExpect(extensionCard.card).toBeVisible();
});

test('Extension (card) is installed, present and active', async ({ navigationBar }) => {
test('Extension (card) is installed, present and active', async ({ navigationBar, page }) => {
const extensions = await navigationBar.openExtensions();
await playExpect.poll(async () =>
await extensions.extensionIsInstalled(extensionLabelCrc), { timeout: 30000 },
).toBeTruthy();
const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc);
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
try {
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
} catch (error){
const extensions = await navigationBar.openExtensions();
const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc);
await extensionCard.openExtensionDetails('Red Hat OpenShift Local');
const details = new OpenShiftLocalExtensionPage(page);
const errorTab = details.tabs.getByRole('button', { name: 'Error' });
// we would like to propagate the error's stack trace into test failure message
let stackTrace = '';
if ((await errorTab.count()) > 0) {
await details.activateTab('Error');
stackTrace = await details.errorStackTrace.innerText();
}
await playExpect(errorTab, `Error Tab was present with stackTrace: ${stackTrace}`).not.toBeVisible();
}
});

test('Extension\'s dependency, Red Hat Authentication, (card) is installed, present and active', async ({ navigationBar }) => {
Expand All @@ -98,7 +113,7 @@ test.describe.serial('Red Hat OpenShift Local extension verification', () => {
test('Extension\'s details show correct status, no error', async ({ page,navigationBar }) => {
const extensions = await navigationBar.openExtensions();
const extensionCard = await extensions.getInstalledExtension(extensionLabelNameCrc, extensionLabelCrc);
await extensionCard.openExtensionDetails('Red Hat Authentication');
await extensionCard.openExtensionDetails('Red Hat OpenShift Local');
const details = new OpenShiftLocalExtensionPage(page);
await playExpect(details.heading).toBeVisible();
await playExpect(details.status).toHaveText(activeExtensionStatus);
Expand Down

0 comments on commit 91e61fe

Please sign in to comment.