Skip to content

Cleanup: root .gitignore, unignore package-lock.json, npm ci, playwright --with-deps, JS examples - #33

Merged
bg-playground merged 5 commits into
mainfrom
copilot/add-root-gitignore-and-update-ignore
Mar 6, 2026
Merged

Cleanup: root .gitignore, unignore package-lock.json, npm ci, playwright --with-deps, JS examples#33
bg-playground merged 5 commits into
mainfrom
copilot/add-root-gitignore-and-update-ignore

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Applies the still-relevant cleanup from stale PR #27 against current main. Fixes CI reliability issues and documentation accuracy.

Changes

  • New /.gitignore — root-level ignore for OS files, IDE artifacts, and logs (previously only automated-testing/.gitignore existed)
  • automated-testing/.gitignore — remove package-lock.json entry; lockfile must be tracked for npm ci to work
  • .github/workflows/ci.ymlnpm installnpm ci for reproducible CI builds
  • README.md — fix two instances of npx playwright installnpx playwright install --with-deps
  • automated-testing/README.md:
    • Fix npx playwright installnpx playwright install --with-deps
    • Bump example workflow action versions v3v4 (checkout, setup-node, upload-artifact)
    • Convert TypeScript-style code examples to CommonJS JavaScript matching the actual codebase

Before (TypeScript, wrong):

import { Page, Locator } from '@playwright/test';
export class ExamplePage {
  readonly page: Page;
  constructor(page: Page) { ... }
}

After (CommonJS JS, correct):

class ExamplePage {
  constructor(page) {
    this.page = page;
    this.submitButton = page.getByRole('button', { name: 'Submit' });
  }
}
module.exports = { ExamplePage };
Original prompt

Fresh Repo Cleanup PR (replaces stale PR #27)

PR #27 had good cleanup ideas but is now stale with merge conflicts. This PR should apply the still-needed cleanup changes against the current main branch (commit 85fd567).

What to change:

1. Add a root .gitignore file

There is currently no root .gitignore — only automated-testing/.gitignore exists. Create a new /.gitignore at the repo root with standard entries:

# OS files
.DS_Store
Thumbs.db

# IDE
.vscode/
.idea/
*.swp
*.swo

# Logs
*.log

2. Unignore package-lock.json in automated-testing/.gitignore

Currently line 3 of automated-testing/.gitignore ignores package-lock.json. This is incorrect for CI — npm ci requires a lockfile. Remove the package-lock.json line from automated-testing/.gitignore.

The updated file should look like:

# Dependencies
node_modules/

# Test results
test-results/
playwright-report/
test-output/

# Environment files
.env

# OS files
.DS_Store
Thumbs.db

# IDE
.vscode/
.idea/
*.swp
*.swo

# Logs
*.log
npm-debug.log*

# Coverage
coverage/
.nyc_output/

3. Change npm installnpm ci in .github/workflows/ci.yml

On line 26 of .github/workflows/ci.yml, change:

        run: npm install

to:

        run: npm ci

This is a CI best practice — npm ci is faster, stricter, and ensures reproducible builds from the lockfile.

4. Fix npx playwright installnpx playwright install --with-deps in READMEs

In README.md (root):

  • Line 128: change npx playwright installnpx playwright install --with-deps
  • Line 272: change npx playwright installnpx playwright install --with-deps

In automated-testing/README.md:

  • Line 86: change npx playwright installnpx playwright install --with-deps

The --with-deps flag ensures system dependencies (like libgbm, libatk, etc.) are also installed, which is critical for CI and fresh machines. The copilot-instructions.md already documents this as the correct command.

5. Fix TypeScript examples → JavaScript in automated-testing/README.md

The repo is 100% JavaScript (CommonJS with require), but the "Writing Tests" section in automated-testing/README.md shows TypeScript examples with import, export class, readonly, and type annotations. Convert these to match the actual codebase style:

Page Object Model Example (lines 249-265) — replace with:

// pages/ExamplePage.js
const { expect } = require('@playwright/test');

class ExamplePage {
  constructor(page) {
    this.page = page;
    this.submitButton = page.getByRole('button', { name: 'Submit' });
  }

  async clickSubmit() {
    await this.submitButton.click();
  }
}

module.exports = { ExamplePage };

Test Example (lines 270-289) — replace with:

// tests/ui/example.spec.js
const { test, expect } = require('@playwright/test');
const { ExamplePage } = require('../../pages/ExamplePage');

test('Example Test', async ({ page }) => {
  const examplePage = new ExamplePage(page);
  
  await test.step('Navigate to page', async () => {
    await page.goto('/example');
  });

  await test.step('Perform action', async () => {
    await examplePage.clickSubmit();
  });

  await test.step('Verify result', async () => {
    await expect(page).toHaveURL(/.*success/);
  });
});

Also fix the CI/CD example YAML in automated-testing/README.md (lines 212-243):

  • Update actions/checkout@v3actions/checkout@v4
  • Update actions/setup-node@v3actions/setup-node@v4
  • Update actions/upload-artifact@v3actions/upload-artifact@v4

These should match what's actually in the repo's workflows (which already use v4 after PR #26 was merged).

Files to modify:

  1. CREATE .gitignore (root) — new file
  2. MODIFY automated-testing/.gitignore — remove package-lock.json line
  3. MODIFY .github/workflows/ci.ymlnpm installnpm ci
  4. MODIFY README.mdnpx playwright installnpx playwright install --with-deps (2 occurrences)
  5. MODIFY automated-testing/README.md — fix --with-deps, TS→JS examples, action versions in YAML example

What NOT to change:

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…laywright --with-deps, JS examples

Co-authored-by: bg-playground <259109604+bg-playground@users.noreply.github.com>
Copilot AI changed the title [WIP] Add root .gitignore and unignore package-lock.json Cleanup: root .gitignore, unignore package-lock.json, npm ci, playwright --with-deps, JS examples Mar 6, 2026
Copilot AI and others added 2 commits March 6, 2026 03:08
Co-authored-by: bg-playground <259109604+bg-playground@users.noreply.github.com>
…on-file

Add committed package-lock.json to satisfy npm ci requirement
@bg-playground
bg-playground marked this pull request as ready for review March 6, 2026 03:25
@bg-playground
bg-playground merged commit cb72b3b into main Mar 6, 2026
1 check passed
@bg-playground
bg-playground deleted the copilot/add-root-gitignore-and-update-ignore branch March 6, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants