webship-js 2.0.0-alpha1 → 2.0.0-rc1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webship-js",
3
- "version": "2.0.0-alpha1",
3
+ "version": "2.0.0-rc1",
4
4
  "description": "Webship JS automated functional testing.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -13,6 +13,7 @@ const chromiumArgs: string[] = [
13
13
  '--disable-extensions',
14
14
  '--incognito',
15
15
  '--disable-infobars',
16
+ '--start-maximized',
16
17
  ];
17
18
 
18
19
  interface PlaywrightConfig {
@@ -29,7 +30,7 @@ const config: PlaywrightConfig = {
29
30
  args: browser === 'chromium' ? chromiumArgs : [],
30
31
  },
31
32
  contextOptions: {
32
- viewport: { width: 1600, height: 1200 },
33
+ viewport: null,
33
34
  ignoreHTTPSErrors: true,
34
35
  },
35
36
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { setWorldConstructor, World, Before, After, BeforeStep, AfterStep, setDefaultTimeout, Given, When, Then } = require('@cucumber/cucumber');
4
4
  const playwright = require('playwright');
5
- const playwrightConfig = require('../../playwright.config');
5
+ const playwrightConfig = require(require('path').join(process.cwd(), 'playwright.config'));
6
6
  const assert = require('assert');
7
7
  const axios = require('axios');
8
8
  const path = require('path');
@@ -1,134 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(find /var/www/html/products/webship-js-playwright/webship-js -name \"*.conf.js\" -o -name \"nightwatch.conf.js\" 2>/dev/null | head -20)",
5
- "Bash(node --version && npm --version && ls /var/www/html/products/webship-js-playwright/webship-js/node_modules | grep playwright 2>/dev/null || echo \"No playwright installed\")",
6
- "Bash(npm install 2>&1 | tail -5)",
7
- "Bash(npm install playwright 2>&1 | tail -5)",
8
- "Bash(npx playwright install chromium 2>&1 | tail -10)",
9
- "Bash(npx cucumber-js --config cucumber.js --tags \"@smoke or not @smoke\" tests/features/test--when--i-fill-in.feature 2>&1 | head -80)",
10
- "Bash(npx cucumber-js --config cucumber.js tests/features/test--given--i-am-on-homepage.feature 2>&1)",
11
- "Bash(node -e \"\n// Test capture group counts\nconst patterns = [\n [/^\\(I |we \\)*press \\\\\"\\([^\\\\\"]*\\)?\\\\\" by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'press by attr'],\n [/^\\(I |we \\)*click \\\\\"\\([^\\\\\"]*\\)?\\\\\" by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'click by attr'],\n [/^\\(I scroll|we scroll|scrolling\\)? down\\( \\([^\\\\\"]*\\)?\\)*$/, 'scroll down'],\n [/^\\(I |we \\)*fill in \\\\\"\\([^\\\\\"]*\\)?\\\\\" with: by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'fill in with by attr'],\n [/^\\(I |we \\)*fill in\\( the\\)* following: by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'fill in following by attr'],\n];\n\nfor \\(const [re, name] of patterns\\) {\n // Count by checking re.source for groups\n const groups = \\(re.source.match\\(/\\(?<!\\\\\\\\\\\\\\\\\\)\\\\\\\\\\(/g\\) || []\\).length;\n // Test against actual strings\n const testStr1 = name.includes\\('scroll'\\) ? 'I scroll down 500' : 'I press \\\\\"btn\\\\\" by \\\\\"id\\\\\" attr';\n const m = re.exec\\(testStr1\\);\n console.log\\(name + ': source groups=' + groups + ', match length=' + \\(m ? m.length - 1 : 'no match'\\)\\);\n}\n\")",
12
- "Bash(node -e \"\nconst patterns = [\n [/^\\(I |we \\)*press \\\\\"\\([^\\\\\"]*\\)?\\\\\" by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'press by attr', 'I press \\\\\"btn\\\\\" by \\\\\"id\\\\\" attr'],\n [/^\\(I scroll|we scroll|scrolling\\)? down\\( \\([^\\\\\"]*\\)?\\)*$/, 'scroll down', 'I scroll down 500'],\n [/^\\(I scroll|we scroll|scrolling\\)? down\\( \\([^\\\\\"]*\\)?\\)*$/, 'scroll down empty', 'I scroll down'],\n [/^\\(I |we \\)*fill in \\\\\"\\([^\\\\\"]*\\)?\\\\\" with: by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/, 'fill in with by attr', 'I fill in \\\\\"uname\\\\\" with: by attr'],\n];\nfor \\(const [re, name, test] of patterns\\) {\n const m = re.exec\\(test\\);\n console.log\\(name + ': match=' + JSON.stringify\\(m\\)\\);\n}\n\")",
13
- "Bash(node -e \"\nconst { When } = require\\('./node_modules/@cucumber/cucumber'\\);\n// Test how Cucumber counts args\nconst pattern = /^\\(I |we \\)*press \\\\\"\\([^\\\\\"]*\\)?\\\\\" by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)*\\\\s\\(attribute|attr\\)$/;\nconst fn = async function\\(a, b, c, d, e, f\\) {};\nconsole.log\\('fn.length =', fn.length\\);\n\n// check via Cucumber internals\ntry {\n When\\(pattern, fn\\);\n console.log\\('No error registering with 6 args'\\);\n} catch \\(err\\) {\n console.log\\('Error:', err.message\\);\n}\n\" 2>&1)",
14
- "Bash(npx cucumber-js --config cucumber.js tests/features/test--when--i-press-button-by-attribute.feature 2>&1 | head -40)",
15
- "Bash(timeout 120 npm test 2>&1 | tail -100)",
16
- "Bash(node -e \"\n// Replicate what Cucumber does - check what expression type is used\nconst pattern = /^\\(I |we \\)*press \\\\\"\\([^\\\\\"]*\\)?\\\\\" by\\( its\\)*\\( \\\\\"\\([^\\\\\"]*\\)?\\\\\"\\)* \\(attribute|attr\\)$/;\nconst { RegularExpression } = require\\('/var/www/html/products/webship-js-playwright/webship-js/node_modules/@cucumber/cucumber-expressions'\\);\nconst re = new RegularExpression\\(pattern, {}\\);\nconst text = 'I press \\\\\"Submit\\\\\" by \\\\\"value\\\\\" attr';\nconst matches = re.match\\(text\\);\nconsole.log\\('matches count:', matches ? matches.length : 'null'\\);\nif \\(matches\\) {\n matches.forEach\\(\\(m, i\\) => console.log\\('match', i, ':', JSON.stringify\\(m.getValue\\(null\\)\\)\\)\\);\n}\n\")",
17
- "Bash(timeout 120 npm test 2>&1 | grep \"✖\\\\|Error:\" | grep -v \"After\\\\|^[[:space:]]*at\" | sort | uniq -c | sort -rn | head -30)",
18
- "Bash(timeout 120 npm test 2>&1 | grep -A5 \"table.rows is not a function\" | head -20)",
19
- "Bash(timeout 120 npm test 2>&1 | grep \"✖ When I check\\\\|✖ When I select\" | head -10)",
20
- "Bash(timeout 120 npm test 2>&1 | grep -A3 \"✖ When I check\" | head -30)",
21
- "Bash(cat /var/www/html/products/webship-js-playwright/webship-js/tests/html-examples/test--when--i-check-uncheck-checkbox.html 2>/dev/null || find /var/www/html/products/webship-js-playwright/webship-js -name \"*check*uncheck*\" 2>/dev/null | head -5)",
22
- "Bash(cat /var/www/html/products/webship-js-playwright/webship-js/examples/test--when--i-select-option.html 2>/dev/null || find /var/www/html/products/webship-js-playwright/webship-js/examples -name \"*select*\" 2>/dev/null | head -5)",
23
- "Bash(timeout 120 npm test 2>&1 | grep -A8 \"✖ When I select\" | head -20)",
24
- "Bash(timeout 150 npm test 2>&1 | tail -30)",
25
- "Bash(timeout 200 npm test 2>&1 | grep \"scenarios\\\\|steps\\\\|Error\\\\|failed\\\\|passed\" | tail -20)",
26
- "Bash(timeout 300 npm test 2>&1 | grep \"scenarios\\\\|steps\\\\|Error:\\\\|AssertionError\" | tail -20)",
27
- "Bash(timeout 60 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature 2>&1 | tail -50)",
28
- "Bash(timeout 90 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature 2>&1 | grep \"✔\\\\|✖\\\\|scenarios\\\\|steps\" | tail -30)",
29
- "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8080/ 2>/dev/null; echo \"\")",
30
- "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8080/test--when--i-scroll-functionality.html 2>/dev/null; echo \"\")",
31
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n const beforeY = await page.evaluate\\(\\(\\) => window.scrollY\\);\n console.log\\('Before scroll Y:', beforeY\\);\n console.log\\('Doc height:', await page.evaluate\\(\\(\\) => document.documentElement.scrollHeight\\)\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(500\\);\n \n const afterY = await page.evaluate\\(\\(\\) => window.scrollY\\);\n console.log\\('After scroll Y:', afterY\\);\n \n const text = await page.evaluate\\(\\(\\) => document.documentElement.innerText\\);\n console.log\\('Has basic-scroll-down text:', text.includes\\('Basic scroll down works'\\)\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
32
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(500\\); // wait for debounce\n \n const result = await page.evaluate\\(\\(\\) => {\n const el = document.getElementById\\('basic-scroll-down'\\);\n return {\n display: el ? window.getComputedStyle\\(el\\).display : 'not found',\n scrollY: window.scrollY,\n text: el ? el.textContent : null,\n innerTextVisible: \\(document.documentElement.innerText || ''\\).includes\\('Basic scroll down works'\\)\n };\n }\\);\n console.log\\(JSON.stringify\\(result, null, 2\\)\\);\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
33
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n // Intercept to check if scroll event fires\n await page.evaluate\\(\\(\\) => {\n window._scrollFired = false;\n window.addEventListener\\('scroll', \\(\\) => { window._scrollFired = true; }\\);\n }\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(500\\);\n \n const result = await page.evaluate\\(\\(\\) => \\({\n scrollFired: window._scrollFired,\n scrollY: window.scrollY,\n display: window.getComputedStyle\\(document.getElementById\\('basic-scroll-down'\\)\\).display\n }\\)\\);\n console.log\\(JSON.stringify\\(result, null, 2\\)\\);\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
34
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n // Check setTimeout works\n await page.evaluate\\(\\(\\) => {\n window._timeoutFired = false;\n setTimeout\\(\\(\\) => { window._timeoutFired = true; }, 200\\);\n }\\);\n await page.waitForTimeout\\(500\\);\n const fired = await page.evaluate\\(\\(\\) => window._timeoutFired\\);\n console.log\\('setTimeout fired:', fired\\);\n \n // Now scroll and check\n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(300\\);\n \n const result = await page.evaluate\\(\\(\\) => \\({\n scrollY: window.scrollY,\n display: window.getComputedStyle\\(document.getElementById\\('basic-scroll-down'\\)\\).display\n }\\)\\);\n console.log\\('After scroll + 300ms wait:', result\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
35
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n // Patch the scroll handler to log\n await page.evaluate\\(\\(\\) => {\n window._debugLog = [];\n const origListener = window.addEventListener.bind\\(window\\);\n // Manual trigger\n window._manualCheck = function\\(\\) {\n const scrollY = window.scrollY;\n const windowHeight = window.innerHeight;\n const documentHeight = document.documentElement.scrollHeight;\n window._debugLog.push\\({scrollY, windowHeight, documentHeight, check: scrollY >= 300 && scrollY <= 400}\\);\n if \\(scrollY >= 300 && scrollY <= 400\\) {\n document.getElementById\\('basic-scroll-down'\\).style.display = 'block';\n }\n };\n }\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(300\\);\n \n // Manually trigger check\n await page.evaluate\\(\\(\\) => window._manualCheck\\(\\)\\);\n \n const result = await page.evaluate\\(\\(\\) => \\({\n debugLog: window._debugLog,\n display: window.getComputedStyle\\(document.getElementById\\('basic-scroll-down'\\)\\).display\n }\\)\\);\n console.log\\(JSON.stringify\\(result, null, 2\\)\\);\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
36
- "Bash(timeout 15 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n \n // Patch scrollTimeout tracking\n await page.evaluate\\(\\(\\) => {\n window._scrollCallbackFired = false;\n // Intercept the scroll handler by patching setTimeout\n const orig = window.setTimeout;\n window.setTimeout = function\\(fn, delay\\) {\n return orig\\(function\\(\\) { \n window._scrollCallbackFired = true;\n fn\\(\\);\n }, delay\\);\n };\n }\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n await page.waitForTimeout\\(500\\);\n \n const result = await page.evaluate\\(\\(\\) => \\({\n scrollCallbackFired: window._scrollCallbackFired,\n scrollY: window.scrollY,\n display: window.getComputedStyle\\(document.getElementById\\('basic-scroll-down'\\)\\).display\n }\\)\\);\n console.log\\(JSON.stringify\\(result, null, 2\\)\\);\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1)",
37
- "Bash(timeout 60 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature 2>&1 | grep \"✔\\\\|✖\\\\|scenarios\\\\|steps\" | tail -20)",
38
- "Bash(timeout 60 npx cucumber-js --config cucumber.js --name \"Test basic scroll down functionality\" 2>&1 | tail -20)",
39
- "Bash(timeout 30 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature --name \"Test basic scroll down\" 2>&1 | tail -20)",
40
- "Bash(timeout 30 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature --name \"Test basic scroll down functionality\" 2>&1 | tail -15)",
41
- "Bash(timeout 90 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature 2>&1 | grep \"✔\\\\|✖\\\\|scenarios\\\\|steps\" | tail -20)",
42
- "Bash(timeout 30 node -e \"\nconst { execSync } = require\\('child_process'\\);\ntry {\n const result = execSync\\(\n 'npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature --scenario-filter 1',\n { timeout: 25000, cwd: '/var/www/html/products/webship-js-playwright/webship-js' }\n \\);\n console.log\\(result.toString\\(\\).slice\\(-500\\)\\);\n} catch\\(e\\) {\n console.log\\('FAILED:', e.stdout ? e.stdout.toString\\(\\).slice\\(-500\\) : e.message\\);\n}\n\" 2>&1 | tail -30)",
43
- "Bash(timeout 25 npx cucumber-js --config cucumber.js \"tests/features/test--when--i-scroll.feature:5\" 2>&1 | tail -20)",
44
- "Bash(timeout 20 node -e \"\nconst { chromium } = require\\('playwright'\\);\nconst { setWorldConstructor, World, Before, After } = require\\('@cucumber/cucumber'\\);\n// Simple test to see if scroll.feature scenario hangs\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n console.log\\('navigating...'\\);\n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n console.log\\('scrolling...'\\);\n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n console.log\\('checking text...'\\);\n const bodyText = await page.evaluate\\(\\(\\) => document.documentElement.textContent || ''\\);\n console.log\\('includes Basic scroll down works:', bodyText.includes\\('Basic scroll down works'\\)\\);\n await browser.close\\(\\);\n console.log\\('done'\\);\n}\\)\\(\\);\n\" 2>&1)",
45
- "Bash(timeout 20 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature:5 2>&1 | tail -30)",
46
- "Bash(timeout 15 node -e \"\nconst { loadConfiguration, runCucumber } = require\\('@cucumber/cucumber/api'\\);\nprocess.chdir\\('/var/www/html/products/webship-js-playwright/webship-js'\\);\n\\(async \\(\\) => {\n const { runConfiguration } = await loadConfiguration\\({\n provided: {\n paths: ['tests/features/test--when--i-scroll.feature:5'],\n require: ['tests/support/world.js', 'tests/step-definitions/webship.js', 'tests/step-definitions/webship-api.js'],\n timeout: 10000,\n }\n }\\);\n const { success } = await runCucumber\\(runConfiguration\\);\n console.log\\('Success:', success\\);\n process.exit\\(success ? 0 : 1\\);\n}\\)\\(\\).catch\\(e => { console.error\\(e.message\\); process.exit\\(1\\); }\\);\n\" 2>&1 | tail -20)",
47
- "Bash(timeout 15 node -e \"\nconst { Given, When, Then, Before, After, setWorldConstructor, World, setDefaultTimeout } = require\\('@cucumber/cucumber'\\);\nconst { chromium } = require\\('playwright'\\);\n\nsetDefaultTimeout\\(10000\\);\n\nclass TestWorld extends World {\n constructor\\(opt\\) { super\\(opt\\); this.page = null; this.launchUrl = 'http://localhost:8080'; this.minWaitTime = {page:3000}; }\n async openBrowser\\(\\) {\n const b = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const ctx = await b.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n this.page = await ctx.newPage\\(\\);\n this.b = b;\n }\n async closeBrowser\\(\\) { if \\(this.b\\) { await this.b.close\\(\\); this.b = null; } }\n}\n\nsetWorldConstructor\\(TestWorld\\);\nBefore\\(async function \\(\\) { \n console.log\\('BEFORE start'\\);\n await this.openBrowser\\(\\); \n console.log\\('BEFORE done'\\);\n}\\);\nAfter\\(async function \\(\\) { \n console.log\\('AFTER start'\\);\n await this.closeBrowser\\(\\); \n console.log\\('AFTER done'\\);\n}\\);\n\nGiven\\(/^I am on page \\\\\"\\([^\\\\\"]*\\)\\\\\"$/, async function\\(url\\) {\n console.log\\('GIVEN start'\\);\n await this.page.goto\\(this.launchUrl + url\\);\n console.log\\('GIVEN navigate done'\\);\n await this.page.waitForLoadState\\('domcontentloaded', {timeout:5000}\\);\n console.log\\('GIVEN done'\\);\n}\\);\n\nWhen\\(/^I scroll down step$/, async function\\(\\) {\n console.log\\('WHEN start'\\);\n await this.page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n console.log\\('WHEN done'\\);\n}\\);\n\nThen\\(/^I should see text \\\\\"\\([^\\\\\"]*\\)\\\\\"$/, async function\\(text\\) {\n console.log\\('THEN start'\\);\n const bodyText = await this.page.evaluate\\(\\(\\) => document.documentElement.textContent || ''\\);\n console.log\\('THEN bodyText includes:', bodyText.includes\\(text\\)\\);\n console.log\\('THEN done'\\);\n}\\);\n\n// Run it\nconst { runCucumber, loadConfiguration } = require\\('@cucumber/cucumber/api'\\);\nprocess.chdir\\('/var/www/html/products/webship-js-playwright/webship-js'\\);\n\\(async \\(\\) => {\n // Write temp feature\n const fs = require\\('fs'\\);\n fs.writeFileSync\\('/tmp/test.feature', \\\\`\nFeature: Test\n Scenario: Test scroll\n Given I am on page \\\\\"/test--when--i-scroll-functionality.html\\\\\"\n When I scroll down step\n Then I should see text \\\\\"Basic scroll down works\\\\\"\n \\\\`\\);\n \n const { runConfiguration } = await loadConfiguration\\({ provided: { paths: ['/tmp/test.feature'], require: [] } }\\);\n const { success } = await runCucumber\\(runConfiguration\\);\n console.log\\('Success:', success\\);\n}\\)\\(\\).catch\\(e => console.error\\(e.message\\)\\);\n\" 2>&1)",
48
- "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8080/dynamic-examples.html 2>/dev/null; echo \"\")",
49
- "Bash(timeout 120 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature 2>&1 | grep \"✔\\\\|✖\\\\|scenarios\\\\|steps\" | tail -20)",
50
- "Bash(timeout 30 node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const start = Date.now\\(\\);\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox'] }\\);\n const ctx = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await ctx.newPage\\(\\);\n console.log\\('Browser launched:', Date.now\\(\\)-start, 'ms'\\);\n \n await page.goto\\('http://localhost:8080/test--when--i-scroll-functionality.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n console.log\\('Page loaded:', Date.now\\(\\)-start, 'ms'\\);\n \n await page.evaluate\\(\\(\\) => window.scrollBy\\(0, 350\\)\\);\n console.log\\('Scrolled:', Date.now\\(\\)-start, 'ms'\\);\n \n const text = await page.evaluate\\(\\(\\) => document.documentElement.textContent || ''\\);\n console.log\\('Text checked:', Date.now\\(\\)-start, 'ms', 'has text:', text.includes\\('Basic scroll down works'\\)\\);\n \n await browser.close\\(\\);\n console.log\\('Done:', Date.now\\(\\)-start, 'ms'\\);\n}\\)\\(\\);\n\" 2>&1)",
51
- "Bash(timeout 120 npx cucumber-js --config cucumber.js tests/features/test--when--i-scroll.feature --format progress 2>&1 | head -50)",
52
- "Bash(timeout 360 npm test 2>&1 | tail -15)",
53
- "Bash(timeout 360 npm test 2>&1 | grep \"✖\\\\|Error:\" | grep -v \"After\\\\|^[[:space:]]*at\" | sort | uniq -c | sort -rn | head -30)",
54
- "Bash(timeout 360 npm test 2>&1 | grep -A5 \"✖ When I click.*by attr\\\\|✖ When I click.*row\\\\|✖ When I select\\\\|✖ Then I should see.*Username\" | head -80)",
55
- "Bash(curl -s http://localhost:8080/test--modal-dialogs.html | grep -i \"show-modal\\\\|trigger-modal\\\\|delete-btn\" | head -10)",
56
- "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8080/test--modal-dialogs.html; echo)",
57
- "Bash(timeout 360 npm test 2>&1 | grep -A8 \"✖ When I click.*row\\\\|✖ When I select.*#cars\\\\|✖ Then the.*element should contain\\\\|✖ Then the.*link should contain\\\\|✖ Then I should see.*element by attr\\\\|✖ Then I should see.*action-message\\\\|✖ Then I should see.*Username\" | grep -v \"^$\" | head -100)",
58
- "Bash(npm test 2>&1 | tail -80)",
59
- "Bash(npm test 2>&1 | grep -E \"^[0-9]+\\\\\\) Scenario:|✖|Error:|AssertionError\" | head -120)",
60
- "Bash(npm test 2>&1 | head -100)",
61
- "Bash(npm install 2>&1 | tail -20)",
62
- "Bash(npm test 2>&1 | tail -60)",
63
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js 2>&1 | sed 's/\\\\x1b\\\\[[0-9;]*m//g' > /tmp/test-output.txt; echo \"Exit: $?\")",
64
- "Bash(for i in 2 3 4 5 6 7 18 25 26 28 30; do echo \"=== Scenario $i ===\"; grep -A 20 \"^$i\\) Scenario\" /tmp/test-output.txt | grep -E \"✖|Error:|AssertionError\" | head -5; done)",
65
- "Bash(curl -s http://localhost:8080/ | head -5 2>&1 || echo \"Server not running\")",
66
- "Bash(curl -s http://localhost:8080/test--when--i-fill-in.html | head -30)",
67
- "Bash(curl -s http://localhost:8080/test--when--i-select-option-from-dropdownlist.html | head -30)",
68
- "Bash(curl -s http://localhost:8080/test--when--i-fill-in.html)",
69
- "Bash(curl -s http://localhost:8080/test--when--i-reload-page.html)",
70
- "Bash(curl -s http://localhost:8080/test--then--the-element-should_not-contain-cssproperty.html)",
71
- "Bash(curl -s http://localhost:8080/dynamic-examples.html | grep -i \"data-page\\\\|product\\\\|Products\\\\|nav\\\\|scroll\" | head -30)",
72
- "Bash(curl -s http://localhost:8080/test--modal-dialogs.html 2>&1 | head -20)",
73
- "Bash(curl -s http://localhost:8080/dynamic-examples.html | head -5)",
74
- "Bash(curl -s http://localhost:8080/ajax-wait-examples.html | head -5)",
75
- "Bash(curl -s http://localhost:8080/dynamic-examples.html | grep -A5 \"data-page\\\\|count\\\\|Count\\\\|infinite\")",
76
- "Bash(curl -s http://localhost:8080/ajax-wait-examples.html)",
77
- "Bash(curl -s http://localhost:8080/test--when--i-scroll-left-right-functionality.html)",
78
- "Bash(curl -s http://localhost:8080/test--when--i-click-text-in-table-row.html)",
79
- "Bash(printf '%PDF-1.4\\\\n1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj\\\\n2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj\\\\n3 0 obj<</Type/Page/MediaBox[0 0 612 792]/Parent 2 0 R>>endobj\\\\nxref\\\\n0 4\\\\n0000000000 65535 f\\\\n0000000009 00000 n\\\\n0000000058 00000 n\\\\n0000000115 00000 n\\\\ntrailer<</Size 4/Root 1 0 R>>\\\\nstartxref\\\\n190\\\\n%%EOF' > /var/www/html/products/webship-js-playwright2/webship-js/tests/assets/test-document.pdf)",
80
- "Bash(node -e \"const fs=require\\('fs'\\); fs.writeFileSync\\('/var/www/html/products/webship-js-playwright2/webship-js/tests/assets/test-document.pdf', '%PDF-1.4\\\\n1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj\\\\n2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj\\\\n3 0 obj<</Type/Page/MediaBox[0 0 612 792]/Parent 2 0 R>>endobj\\\\nxref\\\\n0 4\\\\n0000000000 65535 f \\\\n0000000009 00000 n \\\\n0000000058 00000 n \\\\n0000000115 00000 n \\\\ntrailer<</Size 4/Root 1 0 R>>\\\\nstartxref\\\\n190\\\\n%%EOF\\\\n'\\);\")",
81
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js 2>&1 | tee /tmp/test-output2.txt | tail -10)",
82
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js 2>&1 | sed 's/\\\\x1b\\\\[[0-9;]*m//g' > /tmp/test3.txt; echo \"Done: $?\")",
83
- "Bash(for i in 1 2 6 10 13 14 21 24 32; do echo \"=== $i ===\"; grep -A 15 \"^$i\\) Scenario\" /tmp/test3.txt | grep -E \"✖|Error:|AssertionError\" | head -3; done)",
84
- "Bash(curl -s http://localhost:8080/test--modal-dialogs.html | grep \"show-welcome-modal\" | head -3)",
85
- "Bash(curl -s http://localhost:8080/test--modal-dialogs.html | head -5)",
86
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js 2>&1 | sed 's/\\\\x1b\\\\[[0-9;]*m//g' > /tmp/test_current.txt && tail -20 /tmp/test_current.txt)",
87
- "Bash(grep -A25 \"14\\) Scenario:\" /tmp/test_current.txt | tail -20\ngrep -A25 \"15\\) Scenario:\" /tmp/test_current.txt | head -35)",
88
- "Bash(node -e \"const pw = require\\('playwright'\\); console.log\\(pw.chromium._defaultBrowserType\\)\" 2>/dev/null; cat /var/www/html/products/webship-js-playwright2/webship-js/package.json | grep playwright)",
89
- "Bash(node -e \"const pw = require\\('playwright'\\); console.log\\(require\\('./node_modules/playwright/package.json'\\).version\\)\")",
90
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n \n // Try fill with comma-separated selector\n const sel = 'pwordcss,#pwordcss,.pwordcss,[name=pwordcss]';\n try {\n await page.waitForSelector\\(sel, {timeout: 2000}\\);\n console.log\\('waitForSelector OK'\\);\n await page.fill\\(sel, '1234'\\);\n console.log\\('fill OK'\\);\n } catch\\(e\\) {\n console.log\\('Error:', e.message\\);\n }\n \n // Fill username too\n await page.fill\\('#uname', 'John Smith'\\);\n \n // Check values\n const vals = await page.evaluate\\(\\(\\) => \\({\n uname: document.getElementById\\('uname'\\).value,\n pword: document.getElementById\\('pword'\\).value,\n }\\)\\);\n console.log\\('Values:', vals\\);\n \n // Click the button\n await page.evaluate\\(\\(\\) => { document.getElementById\\('btnLogin'\\).click\\(\\); }\\);\n \n const result = await page.evaluate\\(\\(\\) => document.getElementById\\('result'\\).innerText\\);\n console.log\\('Result:', result\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
91
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n \n // Scenario 14: fill by attr\n await page.fill\\('#uname', 'John Smith'\\);\n await page.fill\\('pwordcss,#pwordcss,.pwordcss,[name=pwordcss],[value=\\\\\"pwordcss\\\\\"],[placeholder=\\\\\"pwordcss\\\\\"],[title=\\\\\"pwordcss\\\\\"]', '1234'\\);\n \n // Press Login - simulate what the step does\n const locator = page.locator\\('button, input[type=\\\\\"button\\\\\"], input[type=\\\\\"submit\\\\\"], [role=\\\\\"button\\\\\"], .btn, a'\\).filter\\({ hasText: /^Login$/ }\\);\n const count = await locator.count\\(\\);\n console.log\\('Locator count:', count\\);\n \n try {\n await locator.first\\(\\).waitFor\\({ state: 'visible', timeout: 1000 }\\);\n await locator.first\\(\\).click\\(\\);\n console.log\\('Primary click worked'\\);\n } catch\\(e\\) {\n console.log\\('Primary failed, trying fallback'\\);\n const found = await page.evaluate\\(\\(buttonText\\) => {\n const buttons = document.querySelectorAll\\('button, input[type=\\\\\"button\\\\\"], input[type=\\\\\"submit\\\\\"], [role=\\\\\"button\\\\\"], .btn, a'\\);\n for \\(const btn of buttons\\) {\n const text = \\(btn.textContent || btn.innerText || btn.value || ''\\).trim\\(\\);\n if \\(text === buttonText\\) { btn.click\\(\\); return true; }\n }\n return false;\n }, 'Login'\\);\n console.log\\('Fallback found:', found\\);\n }\n \n await page.waitForTimeout\\(100\\);\n const bodyText = await page.evaluate\\(\\(\\) => document.body.innerText || ''\\);\n console.log\\('Body includes expected text:', bodyText.includes\\('You enter Username: John Smith and Password: 1234'\\)\\);\n console.log\\('Result div:', await page.evaluate\\(\\(\\) => document.getElementById\\('result'\\).innerText\\)\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
92
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js tests/features/test--when--i-fill-in-table-by-attr.feature 2>&1 | sed 's/\\\\x1b\\\\[[0-9;]*m//g')",
93
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js --tags \"@fill\" 2>&1 | head -5 ; ./node_modules/.bin/cucumber-js tests/features/test--when--i-fill-in-table-by-attr.feature tests/features/test--when--i-fill-in.feature --require tests/support/world.js --require \"tests/step-definitions/**/*.js\" --format @cucumber/pretty-formatter 2>&1 | sed 's/\\\\x1b\\\\[[0-9;]*m//g' | tail -40)",
94
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.setViewportSize\\({ width: 1600, height: 1200 }\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n await page.waitForSelector\\('body', {timeout: 3000}\\);\n\n // Simulate fill-in table by attr\n const sel1 = '#uname';\n const sel2 = 'pwordcss,#pwordcss,.pwordcss,[name=pwordcss],[value=\\\\\"pwordcss\\\\\"],[placeholder=\\\\\"pwordcss\\\\\"],[title=\\\\\"pwordcss\\\\\"]';\n \n await page.waitForSelector\\(sel1, {timeout: 5000}\\);\n await page.fill\\(sel1, 'John Smith'\\);\n \n await page.waitForSelector\\(sel2, {timeout: 5000}\\);\n await page.fill\\(sel2, '1234'\\);\n \n // Check values before click\n const valsBefore = await page.evaluate\\(\\(\\) => \\({\n uname: document.getElementById\\('uname'\\).value,\n pword: document.getElementById\\('pword'\\).value\n }\\)\\);\n console.log\\('Values before click:', valsBefore\\);\n \n // Press Login - primary locator path\n const locator = page.locator\\('button, input[type=\\\\\"button\\\\\"], input[type=\\\\\"submit\\\\\"], [role=\\\\\"button\\\\\"], .btn, a'\\)\n .filter\\({ hasText: /^Login$/ }\\);\n const count = await locator.count\\(\\);\n console.log\\('Button locator count:', count\\);\n await locator.first\\(\\).waitFor\\({ state: 'visible', timeout: 10000 }\\);\n await locator.first\\(\\).click\\(\\);\n \n await page.waitForTimeout\\(200\\);\n const bodyText = await page.evaluate\\(\\(\\) => document.body.innerText || ''\\);\n const resultText = await page.evaluate\\(\\(\\) => document.getElementById\\('result'\\).innerText\\);\n console.log\\('Result div:', resultText\\);\n console.log\\('Body includes expected:', bodyText.includes\\('You enter Username: John Smith and Password: 1234'\\)\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
95
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n \n // Check if script content contains any relevant text \n const textContent = await page.evaluate\\(\\(\\) => document.body.innerText\\);\n console.log\\('Initial body.innerText:'\\);\n console.log\\(JSON.stringify\\(textContent\\).substring\\(0, 200\\)\\);\n \n // Check if the text matches even before fill\n console.log\\('Contains John Smith before fill:', textContent.includes\\('John Smith'\\)\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
96
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n \n await page.fill\\('#uname', 'John Smith'\\);\n await page.fill\\('#pword', '1234'\\);\n \n await page.locator\\('button, input[type=\\\\\"button\\\\\"]'\\).filter\\({hasText: /^Login\\\\$/}\\).first\\(\\).click\\(\\);\n \n // Check immediately\n const bodyText = await page.evaluate\\(\\(\\) => document.body.innerText\\);\n console.log\\('After click, body.innerText:'\\);\n console.log\\(JSON.stringify\\(bodyText\\)\\);\n console.log\\('Contains expected:', bodyText.includes\\('You enter Username: John Smith and Password: 1234'\\)\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
97
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true }\\);\n const page = await browser.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n \n // Check the exact selector from buildSelector\n const sel = 'pwordcss,#pwordcss,.pwordcss,[name=pwordcss],[value=\\\\\"pwordcss\\\\\"],[placeholder=\\\\\"pwordcss\\\\\"],[title=\\\\\"pwordcss\\\\\"]';\n const count = await page.locator\\(sel\\).count\\(\\);\n console.log\\('Selector matches:', count\\);\n \n // Try fill and check strict mode\n try {\n await page.fill\\(sel, '1234'\\);\n console.log\\('fill OK'\\);\n } catch\\(e\\) {\n console.log\\('fill error:', e.message.substring\\(0, 200\\)\\);\n }\n \n // Check value\n const val = await page.evaluate\\(\\(\\) => document.getElementById\\('pword'\\).value\\);\n console.log\\('pword.value:', val\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
98
- "Bash(./node_modules/.bin/cucumber-js --config cucumber.js 2>&1 | grep -E \"\\\\[DEBUG\\\\]\" | head -20)",
99
- "Bash(node -e \"\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox','--disable-dev-shm-usage','--incognito'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n await page.waitForSelector\\('body', {timeout: 3000}\\);\n\n // Step 1: fill uname\n await page.waitForSelector\\('#uname', {timeout: 5000}\\);\n await page.fill\\('#uname', 'John Smith'\\);\n \n // Check value after first fill\n const v1 = await page.evaluate\\(\\(\\) => document.getElementById\\('uname'\\).value\\);\n console.log\\('uname after fill:', v1\\);\n \n // Step 2: fill pwordcss\n const sel = 'pwordcss,#pwordcss,.pwordcss,[name=pwordcss],[value=\\\\\"pwordcss\\\\\"],[placeholder=\\\\\"pwordcss\\\\\"],[title=\\\\\"pwordcss\\\\\"]';\n await page.waitForSelector\\(sel, {timeout: 5000}\\);\n await page.fill\\(sel, '1234'\\);\n \n // Check value after second fill\n const v2 = await page.evaluate\\(\\(\\) => document.getElementById\\('uname'\\).value\\);\n console.log\\('uname after second fill:', v2\\);\n \n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\n\" 2>&1)",
100
- "Bash(node /tmp/test_fill.js 2>&1)",
101
- "Bash(cp /tmp/test_fill.js /var/www/html/products/webship-js-playwright2/webship-js/test_fill.js && node test_fill.js && rm test_fill.js)",
102
- "Bash(cat > /tmp/test_fill2.js << 'EOF'\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox','--disable-dev-shm-usage'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n\n // Simulate label-based fill \\(fill in the following:\\)\n const filled = await page.evaluate\\(\\(fillData\\) => {\n const results = [];\n for \\(const { field, value } of fillData\\) {\n const label = Array.from\\(document.querySelectorAll\\('label'\\)\\).find\\(l => l.textContent.trim\\(\\) === field\\);\n let el = null;\n if \\(label && label.htmlFor\\) { el = document.getElementById\\(label.htmlFor\\); }\n if \\(!el && label\\) {\n const p = label.closest\\('p, div, td, li'\\);\n if \\(p\\) { const sib = p.nextElementSibling; if \\(sib\\) el = sib.querySelector\\('input, textarea'\\) || \\(sib.tagName === 'INPUT' || sib.tagName === 'TEXTAREA' ? sib : null\\); }\n }\n if \\(!el\\) { el = document.querySelector\\(`[placeholder=\"${field}\"], [name=\"${field}\"], #${CSS.escape\\(field\\)}`\\); }\n if \\(el\\) {\n el.value = value;\n el.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n el.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n results.push\\({ field, found: true, id: el.id, tag: el.tagName }\\);\n } else {\n results.push\\({ field, found: false }\\);\n }\n }\n return results;\n }, [{ field: 'Username', value: 'John Smith' }, { field: 'Password', value: '1234' }]\\);\n console.log\\('Fill results:', JSON.stringify\\(filled\\)\\);\n\n // Check values after fill\n const afterFill = await page.evaluate\\(\\(\\) => \\({\n u: document.getElementById\\('uname'\\).value,\n p: document.getElementById\\('pword'\\).value\n }\\)\\);\n console.log\\('After fill:', afterFill\\);\n\n // Click login button via JS evaluate \\(simulate fallback\\)\n const clicked = await page.evaluate\\(\\(\\) => {\n const buttons = document.querySelectorAll\\('button, input[type=\"button\"], input[type=\"submit\"]'\\);\n for \\(const btn of buttons\\) {\n const text = \\(btn.textContent || btn.innerText || btn.value || ''\\).trim\\(\\);\n if \\(text === 'Login'\\) { btn.click\\(\\); return true; }\n }\n return false;\n }\\);\n console.log\\('Button clicked:', clicked\\);\n\n // Check result\n const result = await page.evaluate\\(\\(\\) => \\({\n u: document.getElementById\\('uname'\\).value,\n p: document.getElementById\\('pword'\\).value,\n result: document.getElementById\\('result'\\).innerText\n }\\)\\);\n console.log\\('After click:', result\\);\n\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\nEOF\nnode /tmp/test_fill2.js)",
103
- "Bash(node /tmp/test_fill2.js)",
104
- "Bash(cp /tmp/test_fill2.js . && node test_fill2.js; rm test_fill2.js)",
105
- "Bash(cat > test_press.js << 'EOF'\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({ headless: true, args: ['--no-sandbox','--disable-dev-shm-usage'] }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 } }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n\n // Simulate fill in the following \\(table-based, one evaluate call\\)\n await page.evaluate\\(\\(fillData\\) => {\n for \\(const { field, value } of fillData\\) {\n const label = Array.from\\(document.querySelectorAll\\('label'\\)\\).find\\(l => l.textContent.trim\\(\\) === field\\);\n let el = null;\n if \\(label && label.htmlFor\\) { el = document.getElementById\\(label.htmlFor\\); }\n if \\(!el && label\\) {\n const p = label.closest\\('p, div, td, li'\\);\n if \\(p\\) { const sib = p.nextElementSibling; if \\(sib\\) el = sib.querySelector\\('input, textarea'\\) || \\(sib.tagName === 'INPUT' || sib.tagName === 'TEXTAREA' ? sib : null\\); }\n }\n if \\(!el\\) { el = document.querySelector\\(`[placeholder=\"${field}\"], [name=\"${field}\"], #${CSS.escape\\(field\\)}`\\); }\n if \\(el\\) {\n el.value = value;\n el.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n el.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n }\n }\n }, [{ field: 'Username', value: 'John Smith' }, { field: 'Password', value: '1234' }]\\);\n\n const afterFill = await page.evaluate\\(\\(\\) => \\({\n u: document.getElementById\\('uname'\\).value,\n p: document.getElementById\\('pword'\\).value\n }\\)\\);\n console.log\\('After table fill:', afterFill\\);\n\n // Check if Playwright locator finds the Login button via hasText\n const locator = page.locator\\('button, input[type=\"button\"], input[type=\"submit\"], [role=\"button\"], .btn, a'\\)\n .filter\\({ hasText: /^Login$/ }\\);\n const count = await locator.count\\(\\);\n console.log\\('Locator count for Login:', count\\);\n \n if \\(count > 0\\) {\n const tag = await locator.first\\(\\).evaluate\\(el => el.tagName + ' type=' + el.type + ' value=' + el.value\\);\n console.log\\('Locator found:', tag\\);\n \n // Check values BEFORE Playwright click\n const beforeClick = await page.evaluate\\(\\(\\) => \\({\n u: document.getElementById\\('uname'\\).value,\n p: document.getElementById\\('pword'\\).value\n }\\)\\);\n console.log\\('Before Playwright click:', beforeClick\\);\n \n await locator.first\\(\\).click\\(\\);\n \n const afterClick = await page.evaluate\\(\\(\\) => \\({\n u: document.getElementById\\('uname'\\).value,\n p: document.getElementById\\('pword'\\).value,\n result: document.getElementById\\('result'\\).innerText\n }\\)\\);\n console.log\\('After Playwright click:', afterClick\\);\n }\n\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\nEOF\nnode test_press.js; rm test_press.js)",
106
- "Bash(npm test 2>&1 | grep -A5 '\\\\[DEBUG\\\\]')",
107
- "Bash(npm test 2>&1 | grep -A20 '\\\\[DEBUG')",
108
- "Bash(npm test 2>&1 | tail -20)",
109
- "Bash(npm test 2>&1 | grep -E '\\\\[DBG\\\\]|\\\\[DBG after\\\\]|\\\\[DBG catch\\\\]|fill in the following|✖.*should see.*John' | head -30)",
110
- "Bash(npm test 2>&1 | tail -10)",
111
- "Bash(cat > test_clear.js << 'EOF'\nconst { chromium } = require\\('playwright'\\);\n\\(async \\(\\) => {\n const browser = await chromium.launch\\({\n headless: true,\n args: ['--no-sandbox','--disable-dev-shm-usage','--disable-setuid-sandbox','--disable-web-security','--ignore-certificate-errors','--disable-extensions','--incognito','--disable-infobars'],\n }\\);\n const context = await browser.newContext\\({ viewport: { width: 1600, height: 1200 }, ignoreHTTPSErrors: true }\\);\n const page = await context.newPage\\(\\);\n await page.goto\\('http://localhost:8080/test--when--i-fill-in.html'\\);\n await page.waitForLoadState\\('domcontentloaded'\\);\n\n // Simulate table fill: set values in ONE evaluate\n console.log\\('\\\\n--- ONE evaluate, no events ---'\\);\n await page.evaluate\\(\\(\\) => {\n document.getElementById\\('uname'\\).value = 'John Smith';\n document.getElementById\\('pword'\\).value = '1234';\n }\\);\n let v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('Immediately after:', v\\);\n await page.waitForTimeout\\(300\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After 300ms:', v\\);\n\n // Reset\n await page.evaluate\\(\\(\\) => { document.getElementById\\('uname'\\).value = ''; document.getElementById\\('pword'\\).value = ''; }\\);\n await page.waitForTimeout\\(100\\);\n\n // Simulate table fill: set values in TWO evaluates with delay, no events\n console.log\\('\\\\n--- TWO evaluates, 300ms delay, no events ---'\\);\n await page.evaluate\\(\\(\\) => { document.getElementById\\('uname'\\).value = 'John Smith'; }\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After uname set:', v\\);\n await page.waitForTimeout\\(300\\);\n await page.evaluate\\(\\(\\) => { document.getElementById\\('pword'\\).value = '1234'; }\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After pword set:', v\\);\n await page.waitForTimeout\\(300\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After 300ms wait:', v\\);\n\n // Reset\n await page.evaluate\\(\\(\\) => { document.getElementById\\('uname'\\).value = ''; document.getElementById\\('pword'\\).value = ''; }\\);\n await page.waitForTimeout\\(100\\);\n\n // Simulate table fill: set values with events in ONE evaluate\n console.log\\('\\\\n--- ONE evaluate, WITH events ---'\\);\n await page.evaluate\\(\\(\\) => {\n const u = document.getElementById\\('uname'\\); const p = document.getElementById\\('pword'\\);\n u.value = 'John Smith';\n u.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n u.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n p.value = '1234';\n p.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n p.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n }\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('Immediately after:', v\\);\n await page.waitForTimeout\\(300\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After 300ms:', v\\);\n\n // Reset\n await page.evaluate\\(\\(\\) => { document.getElementById\\('uname'\\).value = ''; document.getElementById\\('pword'\\).value = ''; }\\);\n await page.waitForTimeout\\(100\\);\n\n // Simulate separate steps: TWO evaluates with events, large delay\n console.log\\('\\\\n--- TWO evaluates, 1000ms delay, WITH events ---'\\);\n await page.evaluate\\(\\(\\) => {\n const u = document.getElementById\\('uname'\\);\n u.value = 'John Smith';\n u.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n u.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n }\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After uname set:', v\\);\n await page.waitForTimeout\\(1000\\);\n await page.evaluate\\(\\(\\) => {\n const p = document.getElementById\\('pword'\\);\n p.value = '1234';\n p.dispatchEvent\\(new Event\\('input', { bubbles: true }\\)\\);\n p.dispatchEvent\\(new Event\\('change', { bubbles: true }\\)\\);\n }\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After pword set:', v\\);\n await page.waitForTimeout\\(300\\);\n v = await page.evaluate\\(\\(\\) => \\({u:document.getElementById\\('uname'\\).value, p:document.getElementById\\('pword'\\).value}\\)\\);\n console.log\\('After 300ms wait:', v\\);\n\n await browser.close\\(\\);\n}\\)\\(\\).catch\\(console.error\\);\nEOF\nnode test_clear.js; rm test_clear.js)",
112
- "Bash(npx cucumber-js tests/features/test--when--i-fill-in.feature 2>&1 | tail -20)",
113
- "Bash(npx cucumber-js tests/features/test--when--i-fill-in-table-by-attr.feature 2>&1 | tail -20)",
114
- "Bash(cat cucumber.js 2>/dev/null || cat .cucumber.js 2>/dev/null || cat cucumber.yaml 2>/dev/null || ls *.js 2>/dev/null | head)",
115
- "Bash(npx cucumber-js --no-config --require tests/support/world.js --require 'tests/step-definitions/**/*.js' tests/features/test--when--i-fill-in.feature 2>&1 | tail -20)",
116
- "Bash(npx cucumber-js --require tests/support/world.js --require 'tests/step-definitions/**/*.js' tests/features/test--when--i-fill-in.feature 2>&1 | tail -20)",
117
- "Bash(npm test 2>&1 | grep -E '\\\\[FILL end\\\\]|\\\\[PRESS start\\\\].*Login' | head -20)",
118
- "Bash(npm test 2>&1 | grep -E \"✖|FAILED|AssertionError|PRESS start|FILL end\" 2>&1)",
119
- "Bash(npm test 2>&1 | grep -E \"✖|AssertionError|Error:|FAILED\" | head -20)",
120
- "Bash(npm test 2>&1 | grep -E \"FILL_|PRESS|✖ failed\" | head -20)",
121
- "Bash(npm test 2>&1 | grep -E \"FILL_ATTR\" | head -20)",
122
- "Bash(npx cucumber-js tests/features/test--when--i-fill-in-table-by-attr.feature 2>&1 | grep -E \"FILL_ATTR|✖|✔|pass|fail\" | head -30)",
123
- "Bash(npx cucumber-js --tags \"@fill-in-table-by-attr or @scenario1\" tests/features/test--when--i-fill-in-table-by-attr.feature 2>&1 | head -50)",
124
- "Bash(CUCUMBER_FEATURE_PATH=tests/features/test--when--i-fill-in-table-by-attr.feature npx cucumber-js tests/features/test--when--i-fill-in-table-by-attr.feature --no-strict 2>&1 | head -80)",
125
- "Bash(cat /var/www/html/products/webship-js-playwright2/webship-js/cucumber.js 2>/dev/null || cat /var/www/html/products/webship-js-playwright2/webship-js/.cucumber* 2>/dev/null || cat /var/www/html/products/webship-js-playwright2/webship-js/package.json | grep -A5 cucumber)",
126
- "Bash(node /tmp/test_table_fill.js)",
127
- "Bash(cp /tmp/test_table_fill.js /var/www/html/products/webship-js-playwright2/webship-js/ && node test_table_fill.js && rm test_table_fill.js)",
128
- "Bash(npm test 2>&1 | grep -E \"DBG row|FILL_ATTR end|FILL_LABEL end\" | head -30)",
129
- "Bash(npm test 2>&1 | grep \"DBG row0\" | head -20)",
130
- "Bash(npm test 2>&1 | grep -E \"DBG row|FILL_ATTR end|FILL_LABEL end|scenarios.*fail\" | head -20)",
131
- "Bash(npm test 2>&1 | tail -8)"
132
- ]
133
- }
134
- }