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 16, 2024
1 parent 533f014 commit 65efca9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
}
},
"scripts": {
"build": "vite build && node ./scripts/build.js",
"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 Down
6 changes: 3 additions & 3 deletions scripts/build.js → scripts/build.cjs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

const zipper = require('zip-local');
const path = require('path');
const package = require('../package.json');
const packageJson = require('../package.json');
const { mkdirp } = require('mkdirp');
const fs = require('fs');
const byline = require('byline');
const cp = require('copyfiles');

const destFile = path.resolve(__dirname, `../${package.name}.cdix`);
const destFile = path.resolve(__dirname, `../${packageJson.name}.cdix`);
const builtinDirectory = path.resolve(__dirname, '../builtin');
const zipDirectory = path.resolve(builtinDirectory, `${package.name}.cdix`);
const zipDirectory = path.resolve(builtinDirectory, `${packageJson.name}.cdix`);
const extFiles = path.resolve(__dirname, '../.extfiles');
const fileStream = fs.createReadStream(extFiles, { encoding: 'utf8' });

Expand Down
16 changes: 8 additions & 8 deletions tests/src/developer-sandbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
expect as playExpect,
ExtensionCardPage,
RunnerOptions,
test
test,
} from '@podman-desktop/tests-playwright';
import { DeveloperSandboxPage } from './model/pages/developer-sandbox-page';

Expand All @@ -36,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 @@ -63,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 @@ -154,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

0 comments on commit 65efca9

Please sign in to comment.