Simplify setup; example login spec#2
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR streamlines the repository setup and CI configuration while adding an initial reusable login “component” plus a corresponding example spec to exercise it in Playwright.
Changes:
- Simplify local setup guidance and scripts (README + package.json).
- Update Playwright configuration defaults and require
BASE_URLat config load time. - Add a login helper (
loginComponent) and a new login check spec; wire CI to provideBASE_URL/PASSWORD.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/hello-world.spec.js | Simplifies the smoke test assertion for non-Example-Domain targets. |
| tests/components/login-component.js | Adds a login helper that navigates, fills credentials, and submits. |
| tests/components/checks/login.spec.js | Adds an example spec that invokes the login helper. |
| README.md | Reworks setup instructions and clarifies how to set target URL. |
| playwright.config.js | Simplifies config and enforces BASE_URL as required. |
| package.json | Simplifies scripts by removing headed/debug helpers and browser install script. |
| .github/workflows/ci.yml | Passes BASE_URL/PASSWORD into test step; ensures Testspace steps run with always(). |
| .env.example | Updates example BASE_URL and adds PASSWORD. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3
to
6
| test('hello world smoke test', async ({ page }) => { | ||
| await page.goto('/'); | ||
| await expect(page).toHaveTitle(/Example Domain/); | ||
| await expect(page.getByRole('heading', { name: 'Example Domain' })).toBeVisible(); | ||
| await expect(page).toHaveTitle(/.+/); | ||
| }); No newline at end of file |
Comment on lines
+7
to
+9
| process.env.BASE_URL = process.env.BASE_URL || 'https://s2testorg.stridespace.com'; | ||
| process.env.PASSWORD = process.env.PASSWORD || ''; | ||
| await loginComponent(page); |
| @@ -0,0 +1,12 @@ | |||
| const { test, expect } = require('@playwright/test'); | |||
Comment on lines
+15
to
+18
| const BASE_URL = process.env.BASE_URL; | ||
| if (!BASE_URL) throw new Error('Environment variable BASE_URL is required but not defined'); | ||
| const PASSWORD = process.env.PASSWORD; | ||
| if (!PASSWORD) throw new Error('Environment variable PASSWORD is required but not defined'); |
Comment on lines
+23
to
+25
| // Step 2: Click on username or email address | ||
| // Step 3: Enter 'testuser' in username or email address | ||
| await page.getByPlaceholder('username or email address').fill('testuser'); |
Comment on lines
+1
to
+2
| BASE_URL=https://s2testorg.stridespace.com | ||
| PASSWORD=testuser No newline at end of file |
Comment on lines
113
to
116
| ## Changing the target URL | ||
|
|
||
| The sample test uses `BASE_URL` and defaults to `https://example.com`. | ||
|
|
||
| You can store it in a `.env` file: | ||
| `BASE_URL` must be set before running tests. Set it in your `.env` file: | ||
|
|
Comment on lines
9
to
+13
| module.exports = defineConfig({ | ||
| testDir: './tests', | ||
| timeout: 30_000, | ||
| fullyParallel: true, | ||
| forbidOnly: !!process.env.CI, | ||
| retries: process.env.CI ? 2 : 0, | ||
| workers: process.env.CI ? 1 : undefined, | ||
| timeout: 60000, | ||
| retries: 0, | ||
| workers: 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates to setup.
Added a initial login component.