Skip to content

Commit

Permalink
address changes
Browse files Browse the repository at this point in the history
Signed-off-by: xbabalov <[email protected]>
  • Loading branch information
xbabalov committed Oct 22, 2024
1 parent 3c9323f commit 44a446c
Show file tree
Hide file tree
Showing 4 changed files with 514 additions and 1,436 deletions.
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"publisher": "redhat",
"license": "Apache-2.0",
"type": "module",
"type": "module",
"engines": {
"podman-desktop": "^1.10.0"
},
Expand Down Expand Up @@ -61,8 +60,8 @@
"scripts": {
"build": "vite build && node ./scripts/build.cjs",
"watch": "vite build -w",
"format:check": "prettier --check \"**/*.ts\" \"scripts/*.js\"",
"format:fix": "prettier --write \"**/*.ts\" \"scripts/*.js\"",
"format:check": "prettier --check \"**/*.ts\" \"scripts/*.cjs\"",
"format:fix": "prettier --write \"**/*.ts\" \"scripts/*.cjs\"",
"test": "vitest run --coverage",
"test:e2e:setup": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' --",
"test:e2e": "npm run test:e2e:setup npx playwright test tests/src"
Expand All @@ -76,19 +75,14 @@
"devDependencies": {
"@playwright/test": "1.48.0",
"@podman-desktop/tests-playwright": "next",
"@playwright/test": "^1.47.1",
"@podman-desktop/tests-playwright": "next",
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.16.14",
"@vitest/coverage-v8": "^2.0.5",
"7zip-min": "^1.4.5",
"7zip-min": "^1.4.5",
"byline": "^5.0.0",
"copyfiles": "^2.4.1",
"cross-env": "7.0.3",
"electron": "^32.1.1",
"cross-env": "7.0.3",
"electron": "^32.1.1",
"jsdom": "^25.0.1",
"mkdirp": "^3.0.1",
"prettier": "^3.3.3",
Expand Down
15 changes: 7 additions & 8 deletions tests/src/developer-sandbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
ExtensionCardPage,
RunnerOptions,
test,
AuthenticationPage,
} from '@podman-desktop/tests-playwright';
import { DeveloperSandboxPage } from './model/pages/developer-sandbox-page';

Expand All @@ -37,7 +36,7 @@ const extensionProvider = 'Developer Sandbox Provider';
const activeExtensionStatus = 'ACTIVE';
const disabledExtensionStatus = 'DISABLED';
const activeConnectionStatus = 'RUNNING';
const skipInstallation = process.env.SKIP_INSTALLATION ? process.env.SKIP_INSTALLATION : false;
const skipInstallation = process.env.SKIP_INSTALLATION === 'true';

test.use({
runnerOptions: new RunnerOptions({ customFolder: 'sandbox-tests-pd', autoUpdate: false, autoCheckUpdates: false }),
Expand All @@ -64,15 +63,15 @@ 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 || !!skipInstallation);
test.skip(!extensionInstalled || skipInstallation);
test.setTimeout(60000);
await removeExtension(navigationBar);
});

// we want to install extension from OCI image (usually using latest tag) after new code was added to the codebase
// and extension was published already
test('Extension can be installed using OCI image', async ({ navigationBar }) => {
test.skip(extensionInstalled && !skipInstallation);
test.skip(skipInstallation);
test.setTimeout(200000);
const extensions = await navigationBar.openExtensions();
await extensions.installExtensionFromOCIImage(imageName);
Expand Down Expand Up @@ -155,28 +154,28 @@ async function removeExtension(navBar: NavigationBar): Promise<void> {
.toBeFalsy();
}

async function checkSandboxInResources(navigationBar: NavigationBar, isPresent: boolean) {
async function checkSandboxInResources(navigationBar: NavigationBar, isInstalled: 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' });

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

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

if (isPresent) {
if (isInstalled) {
await playExpect(sandboxProviderCard).toBeVisible();
await playExpect(sandboxStatus).toHaveText(activeConnectionStatus);
} else {
Expand Down
16 changes: 10 additions & 6 deletions vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@
* @type {import('vite').UserConfig}
* @see https://vitest.dev/config/
*/
const excludeArray = [
'tests/**', '**/builtin/**',
'**/node_modules/**',
'**/dist/**',
'**/.{idea,git,cache,output,temp,cdix}/**',
'**/{.electron-builder,babel,changelog,docusaurus,jest,postcss,prettier,rollup,svelte,tailwind,vite,vitest*,webpack}.config.*',];

const config = {
test: {
globals: true,
exclude: excludeArray,
coverage: {
include: ['**/*.ts'],
exclude: ['tests/**', '**/builtin/**',
'**/node_modules/**',
'**/dist/**',
'**/.{idea,git,cache,output,temp,cdix}/**',
'**/{.electron-builder,babel,changelog,docusaurus,jest,postcss,prettier,rollup,svelte,tailwind,vite,vitest*,webpack}.config.*',],
include: ['./src/**/*.ts}'],
exclude: excludeArray,
},
},
resolve: {
Expand Down
Loading

0 comments on commit 44a446c

Please sign in to comment.