Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kdumontnu committed Jun 23, 2022
1 parent 282397f commit 0236676
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,6 @@ prime/
# Manpage
/man
test-results/
playwright-report/

# E2E
tools/e2e/reports/
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const config = {
// workers: process.env.CI ? 1 : undefined,

/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? 'dot' : 'html',
reporter: process.env.CI ? 'dot' : [['html', {outputFolder: 'tools/e2e/reports/', open: 'never'}]],

/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
Expand Down
6 changes: 3 additions & 3 deletions tools/e2e/run_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ trap 'kill $(jobs -p)' EXIT

GiteaFlags=()

[[ -v GITEA_CUSTOM ]] && GiteaFlags+=(-C ${GITEA_CUSTOM})
[[ -v GITEA_CONF ]] && GiteaFlags+=(-c ${GITEA_CONF})
[[ -v GITEA_CUSTOM ]] && GiteaFlags+=(-C "${GITEA_CUSTOM}")
[[ -v GITEA_CONF ]] && GiteaFlags+=(-c "${GITEA_CONF}")

./${GITEA_EXECUTABLE:-gitea} ${GiteaFlags[@]} --quiet web &
./"${GITEA_EXECUTABLE:-gitea}" "${GiteaFlags[@]}" --quiet web &

# Wait up to 30s for server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${GITEA_URL:-http://localhost:3000})" != "200" ]]; do sleep 2; done' || \
Expand Down
20 changes: 17 additions & 3 deletions tools/e2e/tests/example.test.e2e.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
// @ts-check
import {test, expect} from '@playwright/test';

test('Load Homepage', async ({page}) => {
test('Load Homepage', async ({page}, workerInfo) => {
const response = await page.goto('/');
await expect(response.status()).toBe(200); // Status OK
await expect(response?.status()).toBe(200); // Status OK
await expect(page).toHaveTitle(/^Gitea: Git with a cup of tea\s*$/);
await expect(page.locator('.logo')).toHaveAttribute('src', '/assets/img/logo.svg');
await page.screenshot({ path: 'screenshot.png', fullPage: true});
});

test('Test Register Form', async ({page}, workerInfo) => {
const response = await page.goto('/user/sign_up');
await expect(response?.status()).toBe(200); // Status OK
await page.type('input[name=user_name]', `test-${workerInfo.workerIndex}`);
await page.type('input[name=email]', `test-${workerInfo.workerIndex}@test.com`);
await page.type('input[name=password]', 'test123');
await page.type('input[name=retype]', 'test123');
await page.click('form button.ui.green.button:visible');
// Make sure we routed to the home page. Else login failed.
await expect(page.url()).toBe(`${workerInfo.project.use.baseURL}/`);
// Uncomment to see visual testing
//await expect(page).toHaveScreenshot({ timeout: 20000, mask: [page.locator('footer div.ui.left')] });
//await page.screenshot({ path: `tools/e2e/screenshots/${workerInfo.title}-${workerInfo.project.name}.png` });
});

0 comments on commit 0236676

Please sign in to comment.