@aws/mynah-ui 4.35.4 → 4.35.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +21 -4
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/package.json +11 -5
- package/scripts/docker-build.js +36 -0
- package/scripts/docker-health-check.js +45 -0
- package/scripts/get-playwright-version.js +62 -0
- package/scripts/pre-test-setup.js +80 -0
- package/scripts/setup-playwright.js +61 -0
- package/scripts/test-webkit.js +44 -0
- package/ui-tests/package.json +10 -6
- package/ui-tests/playwright.config.ts +13 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws/mynah-ui",
|
|
3
3
|
"displayName": "AWS Mynah UI",
|
|
4
|
-
"version": "4.35.
|
|
4
|
+
"version": "4.35.6",
|
|
5
5
|
"description": "AWS Toolkit VSCode and Intellij IDE Extension Mynah UI",
|
|
6
6
|
"publisher": "Amazon Web Services",
|
|
7
7
|
"license": "Apache License 2.0",
|
|
@@ -28,14 +28,20 @@
|
|
|
28
28
|
"format:check": "npx prettier --check .",
|
|
29
29
|
"format:write": "npx prettier --write .",
|
|
30
30
|
"docker:clean": "docker rm -f mynah-ui-e2e-container || true",
|
|
31
|
-
"docker:build": "docker
|
|
32
|
-
"docker:run": "docker run --name mynah-ui-e2e-container mynah-ui-e2e",
|
|
31
|
+
"docker:build": "node scripts/docker-build.js",
|
|
32
|
+
"docker:run": "docker run --name mynah-ui-e2e-container -e WEBKIT_FORCE_COMPLEX_TEXT=0 -e WEBKIT_DISABLE_COMPOSITING_MODE=1 mynah-ui-e2e",
|
|
33
33
|
"docker:run:chromium": "docker run -e BROWSER=chromium --name mynah-ui-e2e-container mynah-ui-e2e",
|
|
34
|
-
"docker:run:webkit": "docker run -e BROWSER=webkit --name mynah-ui-e2e-container mynah-ui-e2e",
|
|
34
|
+
"docker:run:webkit": "docker run -e BROWSER=webkit -e WEBKIT_FORCE_COMPLEX_TEXT=0 -e WEBKIT_DISABLE_COMPOSITING_MODE=1 --name mynah-ui-e2e-container mynah-ui-e2e",
|
|
35
35
|
"docker:extract": "docker cp mynah-ui-e2e-container:/app/ui-tests/__results__ ./ui-tests/ && docker cp mynah-ui-e2e-container:/app/ui-tests/__snapshots__ ./ui-tests/__results__/__snapshots__",
|
|
36
|
+
"playwright:setup": "node scripts/setup-playwright.js",
|
|
37
|
+
"playwright:version": "node scripts/get-playwright-version.js",
|
|
38
|
+
"playwright:pre-test": "node scripts/pre-test-setup.js",
|
|
36
39
|
"tests:e2e": "npm run docker:clean && npm run docker:build && npm run docker:run",
|
|
37
40
|
"tests:e2e:chromium": "npm run docker:clean && npm run docker:build && npm run docker:run:chromium",
|
|
38
41
|
"tests:e2e:webkit": "npm run docker:clean && npm run docker:build && npm run docker:run:webkit",
|
|
42
|
+
"tests:e2e:webkit:local": "npm run playwright:pre-test && cd ui-tests && npm run e2e:webkit",
|
|
43
|
+
"tests:webkit:check": "node scripts/test-webkit.js",
|
|
44
|
+
"tests:e2e:local": "npm run playwright:pre-test && cd ui-tests && npm run e2e",
|
|
39
45
|
"tests:e2e:trace": "cd ./ui-tests && npm run trace",
|
|
40
46
|
"tests:unit": "jest --collect-coverage",
|
|
41
47
|
"api-docs": "npx typedoc src/main.ts --out ./api-docs",
|
|
@@ -96,7 +102,7 @@
|
|
|
96
102
|
"ts-loader": "^9.4.4",
|
|
97
103
|
"ts-node": "^10.9.1",
|
|
98
104
|
"typedoc": "^0.25.13",
|
|
99
|
-
"typescript": "^5.
|
|
105
|
+
"typescript": "^5.1.6",
|
|
100
106
|
"webpack": "5.94.0",
|
|
101
107
|
"webpack-cli": "4.7.2"
|
|
102
108
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script to build Docker image with detected Playwright version
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const { getPlaywrightVersion } = require('./get-playwright-version');
|
|
9
|
+
|
|
10
|
+
function buildDockerImage() {
|
|
11
|
+
try {
|
|
12
|
+
const version = getPlaywrightVersion();
|
|
13
|
+
console.log(`Building Docker image with Playwright version: ${version}`);
|
|
14
|
+
|
|
15
|
+
// Use the detected version or fallback to latest
|
|
16
|
+
// Add 'v' prefix for version numbers, but not for 'latest'
|
|
17
|
+
const dockerVersion = version === 'latest' ? 'latest' : `v${version}`;
|
|
18
|
+
|
|
19
|
+
const buildCommand = `docker build --build-arg PLAYWRIGHT_VERSION=${dockerVersion} -t mynah-ui-e2e .`;
|
|
20
|
+
|
|
21
|
+
console.log(`Executing: ${buildCommand}`);
|
|
22
|
+
execSync(buildCommand, { stdio: 'inherit' });
|
|
23
|
+
|
|
24
|
+
console.log('Docker image built successfully!');
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Error building Docker image:', error.message);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// If called directly, run the build
|
|
32
|
+
if (require.main === module) {
|
|
33
|
+
buildDockerImage();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { buildDockerImage };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Docker health check script to verify browser installations
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
function healthCheck() {
|
|
10
|
+
try {
|
|
11
|
+
console.log('=== Docker Health Check ===');
|
|
12
|
+
|
|
13
|
+
// Check if we're in Docker
|
|
14
|
+
console.log('Environment: Docker Container');
|
|
15
|
+
|
|
16
|
+
// Check Playwright installation
|
|
17
|
+
console.log('\n1. Checking Playwright...');
|
|
18
|
+
execSync('npx playwright --version', { stdio: 'inherit' });
|
|
19
|
+
|
|
20
|
+
// Check browser installations
|
|
21
|
+
console.log('\n2. Checking browsers...');
|
|
22
|
+
execSync('npx playwright install --dry-run', { stdio: 'inherit' });
|
|
23
|
+
|
|
24
|
+
// Test WebKit specifically
|
|
25
|
+
console.log('\n3. Testing WebKit launch...');
|
|
26
|
+
execSync('npx playwright test --list --project=webkit | head -5', {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
shell: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log('\n=== Health Check Passed ===');
|
|
32
|
+
return true;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Health check failed:', error.message);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// If called directly, run the health check
|
|
40
|
+
if (require.main === module) {
|
|
41
|
+
const success = healthCheck();
|
|
42
|
+
process.exit(success ? 0 : 1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = { healthCheck };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script to detect and return the appropriate Playwright version
|
|
5
|
+
* Priority: local installation > package.json > latest
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
function getPlaywrightVersion() {
|
|
13
|
+
try {
|
|
14
|
+
// 1. Try to get locally installed version
|
|
15
|
+
try {
|
|
16
|
+
const localVersion = execSync('playwright --version', { encoding: 'utf8', stdio: 'pipe' });
|
|
17
|
+
const versionMatch = localVersion.match(/Version (\d+\.\d+\.\d+)/);
|
|
18
|
+
if (versionMatch) {
|
|
19
|
+
console.log(`Found local Playwright version: ${versionMatch[1]}`);
|
|
20
|
+
return versionMatch[1];
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.log('No local Playwright installation found');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 2. Try to get version from ui-tests package.json
|
|
27
|
+
const uiTestsPackagePath = path.join(__dirname, '../ui-tests/package.json');
|
|
28
|
+
if (fs.existsSync(uiTestsPackagePath)) {
|
|
29
|
+
const packageJson = JSON.parse(fs.readFileSync(uiTestsPackagePath, 'utf8'));
|
|
30
|
+
|
|
31
|
+
// Check both playwright and @playwright/test dependencies
|
|
32
|
+
const playwrightVersion = packageJson.devDependencies?.playwright || packageJson.dependencies?.playwright;
|
|
33
|
+
const playwrightTestVersion =
|
|
34
|
+
packageJson.devDependencies?.['@playwright/test'] || packageJson.dependencies?.['@playwright/test'];
|
|
35
|
+
|
|
36
|
+
// Prefer @playwright/test version if available, otherwise use playwright
|
|
37
|
+
const version = playwrightTestVersion || playwrightVersion;
|
|
38
|
+
|
|
39
|
+
if (version) {
|
|
40
|
+
// Remove ^ or ~ prefix and get clean version
|
|
41
|
+
const cleanVersion = version.replace(/[\^~]/, '');
|
|
42
|
+
const sourcePackage = playwrightTestVersion ? '@playwright/test' : 'playwright';
|
|
43
|
+
console.log(`Found ${sourcePackage} version in ui-tests package.json: ${cleanVersion}`);
|
|
44
|
+
return cleanVersion;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 3. Fallback to latest
|
|
49
|
+
console.log('No specific version found, using latest');
|
|
50
|
+
return 'latest';
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('Error detecting Playwright version:', error.message);
|
|
53
|
+
return 'latest';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If called directly, output the version
|
|
58
|
+
if (require.main === module) {
|
|
59
|
+
console.log(getPlaywrightVersion());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = { getPlaywrightVersion };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-test setup script that ensures Playwright is properly configured
|
|
5
|
+
* This runs before tests to guarantee version consistency
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
const { getPlaywrightVersion } = require('./get-playwright-version');
|
|
12
|
+
|
|
13
|
+
function checkPlaywrightInstallation() {
|
|
14
|
+
const uiTestsPath = path.join(__dirname, '../ui-tests');
|
|
15
|
+
const nodeModulesPath = path.join(uiTestsPath, 'node_modules');
|
|
16
|
+
const playwrightPath = path.join(nodeModulesPath, '@playwright');
|
|
17
|
+
|
|
18
|
+
return fs.existsSync(playwrightPath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getInstalledPlaywrightVersion() {
|
|
22
|
+
try {
|
|
23
|
+
const uiTestsPath = path.join(__dirname, '../ui-tests');
|
|
24
|
+
const packageLockPath = path.join(uiTestsPath, 'package-lock.json');
|
|
25
|
+
|
|
26
|
+
if (fs.existsSync(packageLockPath)) {
|
|
27
|
+
const packageLock = JSON.parse(fs.readFileSync(packageLockPath, 'utf8'));
|
|
28
|
+
return (
|
|
29
|
+
packageLock.packages?.['node_modules/@playwright/test']?.version ||
|
|
30
|
+
packageLock.packages?.['node_modules/playwright']?.version ||
|
|
31
|
+
null
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.warn('Could not read package-lock.json:', error.message);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function preTestSetup() {
|
|
42
|
+
console.log('🔍 Running pre-test setup...');
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const expectedVersion = getPlaywrightVersion();
|
|
46
|
+
console.log(`📋 Expected Playwright version: ${expectedVersion}`);
|
|
47
|
+
|
|
48
|
+
const isInstalled = checkPlaywrightInstallation();
|
|
49
|
+
const installedVersion = getInstalledPlaywrightVersion();
|
|
50
|
+
|
|
51
|
+
console.log(`📦 Playwright installed: ${isInstalled}`);
|
|
52
|
+
console.log(`📦 Installed version: ${installedVersion || 'unknown'}`);
|
|
53
|
+
|
|
54
|
+
// Check if we need to install/update
|
|
55
|
+
const needsSetup = !isInstalled || (expectedVersion !== 'latest' && installedVersion !== expectedVersion);
|
|
56
|
+
|
|
57
|
+
if (needsSetup) {
|
|
58
|
+
console.log('🔧 Setting up Playwright...');
|
|
59
|
+
|
|
60
|
+
// Run setup with target directory
|
|
61
|
+
const { setupPlaywright } = require('./setup-playwright');
|
|
62
|
+
const uiTestsPath = path.join(__dirname, '../ui-tests');
|
|
63
|
+
setupPlaywright(uiTestsPath);
|
|
64
|
+
} else {
|
|
65
|
+
console.log('✅ Playwright is already properly configured');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log('🎉 Pre-test setup completed successfully!');
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('❌ Pre-test setup failed:', error.message);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// If called directly, run the setup
|
|
76
|
+
if (require.main === module) {
|
|
77
|
+
preTestSetup();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = { preTestSetup };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script to setup Playwright with version-agnostic approach
|
|
5
|
+
* This ensures consistent versions across local and Docker environments
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const { getPlaywrightVersion } = require('./get-playwright-version');
|
|
12
|
+
|
|
13
|
+
function setupPlaywright(targetDir = null) {
|
|
14
|
+
try {
|
|
15
|
+
const version = getPlaywrightVersion();
|
|
16
|
+
console.log(`Setting up Playwright version: ${version}`);
|
|
17
|
+
|
|
18
|
+
// Determine target directory
|
|
19
|
+
const uiTestsPath = targetDir || path.join(__dirname, '../ui-tests');
|
|
20
|
+
|
|
21
|
+
// Ensure target directory exists
|
|
22
|
+
if (!fs.existsSync(uiTestsPath)) {
|
|
23
|
+
throw new Error(`Target directory does not exist: ${uiTestsPath}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const installCommand =
|
|
27
|
+
version === 'latest'
|
|
28
|
+
? 'npm install @playwright/test@latest playwright@latest --save-dev'
|
|
29
|
+
: `npm install @playwright/test@${version} playwright@${version} --save-dev`;
|
|
30
|
+
|
|
31
|
+
console.log(`Installing Playwright in ${uiTestsPath}...`);
|
|
32
|
+
execSync(installCommand, {
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
cwd: uiTestsPath,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Install Playwright browsers with dependencies
|
|
38
|
+
console.log('Installing Playwright browsers with dependencies...');
|
|
39
|
+
execSync('npx playwright install --with-deps', {
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
cwd: uiTestsPath,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
console.log('Playwright setup completed successfully!');
|
|
45
|
+
return true;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error('Error setting up Playwright:', error.message);
|
|
48
|
+
throw error; // Re-throw to allow caller to handle
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// If called directly, run the setup
|
|
53
|
+
if (require.main === module) {
|
|
54
|
+
try {
|
|
55
|
+
setupPlaywright();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { setupPlaywright };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script to test WebKit browser availability and functionality
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
function testWebKit() {
|
|
11
|
+
try {
|
|
12
|
+
console.log('Testing WebKit browser availability...');
|
|
13
|
+
|
|
14
|
+
const uiTestsPath = path.join(__dirname, '../ui-tests');
|
|
15
|
+
|
|
16
|
+
// Check if WebKit is installed
|
|
17
|
+
console.log('Checking WebKit installation...');
|
|
18
|
+
execSync('npx playwright install webkit --with-deps', {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
cwd: uiTestsPath,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Run a simple WebKit test
|
|
24
|
+
console.log('Running WebKit test...');
|
|
25
|
+
execSync('npx playwright test --project=webkit --grep "should render initial data"', {
|
|
26
|
+
stdio: 'inherit',
|
|
27
|
+
cwd: uiTestsPath,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log('WebKit test completed successfully!');
|
|
31
|
+
return true;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error('WebKit test failed:', error.message);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// If called directly, run the test
|
|
39
|
+
if (require.main === module) {
|
|
40
|
+
const success = testWebKit();
|
|
41
|
+
process.exit(success ? 0 : 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { testWebKit };
|
package/ui-tests/package.json
CHANGED
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "rm -rf build dist node_modules __results__",
|
|
8
8
|
"prepare": "webpack --config webpack.config.js --mode development",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"e2e
|
|
13
|
-
"e2e:update
|
|
14
|
-
"e2e:
|
|
9
|
+
"playwright:setup": "node ../scripts/setup-playwright.js",
|
|
10
|
+
"playwright:version": "node ../scripts/get-playwright-version.js",
|
|
11
|
+
"playwright:pre-test": "node ../scripts/pre-test-setup.js",
|
|
12
|
+
"e2e": "npm run playwright:pre-test && playwright test --workers=12",
|
|
13
|
+
"e2e:update": "npm run playwright:pre-test && playwright test --update-snapshots --workers=12",
|
|
14
|
+
"e2e:chromium": "npm run playwright:pre-test && playwright test --project=chromium --workers=12",
|
|
15
|
+
"e2e:webkit": "npm run playwright:pre-test && playwright test --project=webkit --workers=12",
|
|
16
|
+
"e2e:update:chromium": "npm run playwright:pre-test && playwright test --project=chromium --update-snapshots --workers=12",
|
|
17
|
+
"e2e:update:webkit": "npm run playwright:pre-test && playwright test --project=webkit --update-snapshots --workers=12",
|
|
18
|
+
"e2e:quick": "playwright test --workers=12",
|
|
15
19
|
"trace": "playwright show-trace"
|
|
16
20
|
},
|
|
17
21
|
"dependencies": {
|
|
@@ -24,7 +24,19 @@ export default defineConfig({
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
projects: [
|
|
27
|
-
{
|
|
27
|
+
{
|
|
28
|
+
name: 'chromium',
|
|
29
|
+
use: {
|
|
30
|
+
browserName: 'chromium',
|
|
31
|
+
launchOptions: {
|
|
32
|
+
args: [
|
|
33
|
+
'--disable-features=VizDisplayCompositor',
|
|
34
|
+
'--disable-dev-shm-usage',
|
|
35
|
+
'--no-sandbox',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
},
|
|
28
40
|
{ name: 'webkit', use: { browserName: 'webkit' } },
|
|
29
41
|
],
|
|
30
42
|
updateSnapshots: updateSnapshots ? 'all' : 'missing',
|