Skip to content

Commit

Permalink
rebase, fix dependencies, fix methods
Browse files Browse the repository at this point in the history
Signed-off-by: xbabalov <[email protected]>
  • Loading branch information
xbabalov committed Oct 15, 2024
1 parent f9e6c52 commit ddc4a97
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 106 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@
"@kubernetes/client-node": "^0.22.0",
"@podman-desktop/api": "^1.13.2",
"fs-extra": "^11.2.0",
"got": "^14.4.2",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.1"
"got": "^14.4.2"
},
"devDependencies": {
"@playwright/test": "^1.47.1",
Expand All @@ -93,6 +91,8 @@
"vitest": "^2.0.5",
"vscode-uri": "^3.0.8",
"xvfb-maybe": "^0.2.1",
"zip-local": "^0.3.5"
"zip-local": "^0.3.5",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.1"
}
}
34 changes: 23 additions & 11 deletions tests/src/developer-sandbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {

// we want to skip removing of the extension when we are running tests from PR check
test('Uninstall previous version of sandbox extension', async ({ navigationBar }) => {
test.skip(!extensionInstalled);
test.skip(!extensionInstalled || !!skipInstallation);
test.setTimeout(60000);
await removeExtension(navigationBar);
});
Expand Down Expand Up @@ -106,11 +106,11 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
});

test('Developer Sandbox is available in Resources Page', async ({ navigationBar }) => {
playExpect(await isSandboxInResources(navigationBar)).toBeTruthy();
await checkSandboxInResources(navigationBar, true);
});

test('Developer Sandbox is available in Dashboard', async ({ navigationBar }) => {
playExpect(await isSandboxInDashboard(navigationBar)).toBeTruthy();
await checkSandboxInDashboard(navigationBar, true);
});
});

Expand All @@ -123,8 +123,8 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
await extensionCard.disableExtension();
await playExpect(extensionCard.status).toHaveText(disabledExtensionStatus);

playExpect(await isSandboxInResources(navigationBar)).toBeFalsy();
playExpect(await isSandboxInDashboard(navigationBar)).toBeFalsy();
await checkSandboxInResources(navigationBar, false);
await checkSandboxInDashboard(navigationBar, false);
});

test('Extension can be re-enabled correctly', async ({ navigationBar }) => {
Expand All @@ -135,8 +135,8 @@ test.describe.serial('Red Hat Developer Sandbox extension verification', () => {
await extensionCard.enableExtension();
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);

playExpect(await isSandboxInResources(navigationBar)).toBeTruthy();
playExpect(await isSandboxInDashboard(navigationBar)).toBeTruthy();
await checkSandboxInResources(navigationBar, true);
await checkSandboxInDashboard(navigationBar, true);
});
});

Expand All @@ -155,19 +155,31 @@ async function removeExtension(navBar: NavigationBar): Promise<void> {
.toBeFalsy();
}

async function isSandboxInResources(navigationBar: NavigationBar) {
async function checkSandboxInResources(navigationBar: NavigationBar, isPresent: boolean) {
const settingsBar = await navigationBar.openSettings();
const resourcesPage = await settingsBar.openTabPage(ResourcesPage);
const sandboxResourceCard = resourcesPage.featuredProviderResources.getByRole('region', {
name: extensionResourceLabel,
});
const createButton = sandboxResourceCard.getByRole('button', { name: 'Create new Developer Sandbox' });
return (await sandboxResourceCard.isVisible()) && (await createButton.isVisible());

if (isPresent) {
await playExpect(sandboxResourceCard).toBeVisible();
await playExpect(createButton).toBeVisible();
} else {
await playExpect(sandboxResourceCard).toBeHidden();
}
}

async function isSandboxInDashboard(navigationBar: NavigationBar) {
async function checkSandboxInDashboard(navigationBar: NavigationBar, isPresent: boolean) {
const dashboardPage = await navigationBar.openDashboard();
const sandboxProviderCard = dashboardPage.content.getByRole('region', { name: extensionProvider });
const sandboxStatus = sandboxProviderCard.getByLabel('Connection Status Label');
return (await sandboxProviderCard.isVisible()) && (await sandboxStatus.innerText()) === activeConnectionStatus;

if (isPresent) {
await playExpect(sandboxProviderCard).toBeVisible();
await playExpect(sandboxStatus).toHaveText(activeConnectionStatus);
} else {
await playExpect(sandboxProviderCard).toBeHidden();
}
}
Loading

0 comments on commit ddc4a97

Please sign in to comment.