Skip to content

Add initial playwright config #18442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update playwright settings
  • Loading branch information
kdumontnu committed Jun 22, 2022
commit 9b04f901d2bcf14c15c11ede172e5283ef762bae
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ test-e2e-sqlite: build generate-ini-sqlite
test-e2e-sqlite\#%: GOFLAGS+=sqlite sqlite_unlock_notify
test-e2e-sqlite\#%: build generate-ini-sqlite
npx playwright install $(PLAYWRIGHT_FLAGS)
GITEA_ROOT=$(CURDIR) GITEA_EXECUTABLE=$(EXECUTABLE)GITEA_CONF=integrations/sqlite.ini E2E_TESTS=$* ./tools/e2e/run_e2e.sh
GITEA_ROOT=$(CURDIR) GITEA_EXECUTABLE=$(EXECUTABLE) GITEA_CONF=integrations/sqlite.ini E2E_TESTS=$* ./tools/e2e/run_e2e.sh

.PHONY: test-e2e-mysql8
test-e2e-mysql8: build generate-ini-mysql8
Expand Down
6 changes: 5 additions & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {devices} from '@playwright/test';
* @type {import('@playwright/test').PlaywrightTestConfig}
*/
const config = {
testDir: './tools/e2e/tests',
testDir: './tools/e2e/tests', // TODO: Change this to the ./web_src/ dir?
testMatch: /.*\.test\.e2e\.js/, // Match any .test.e2e.js files

/* Maximum time one test can run for. */
timeout: 30 * 1000,
Expand Down Expand Up @@ -41,6 +42,9 @@ const config = {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 1000,

/* Maximum time allowed for navigation, such as `page.goto()`. */
navigationTimeout: 5 * 1000,

/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3000',

Expand Down
8 changes: 0 additions & 8 deletions tools/e2e/tests/example.spec.js

This file was deleted.

9 changes: 9 additions & 0 deletions tools/e2e/tests/example.test.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-check
import {test, expect} from '@playwright/test';

test('Load Homepage', async ({page}) => {
const response = await page.goto('/');
await expect(response.status()).toBe(200); // Status OK
await expect(page).toHaveTitle(/^Gitea: Test\s*$/);
await expect(page.locator('.logo')).toHaveAttribute('src', '/assets/img/logo.svg');
});