Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Badminton-Apps/badman in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
cskiwi committed Jan 18, 2024
2 parents e0414f2 + a18a869 commit da1c71b
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
if: always()
with:
name: playwright-report
path: dist/.playwright/apps/badman-e2e/playwright-report
path: dist/.playwright/apps/badman-e2e/test-output
retention-days: 30
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ assembly.html

.obsidian/workspace.json
files/
.nx/cache
.nx/cache
playwright-report/
2 changes: 1 addition & 1 deletion apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { join } from 'path';
import versionPackage from '../version.json';

const productionModules = [];
if (process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') {
productionModules.push(
ServeStaticModule.forRoot({
rootPath: join(__dirname, '..', 'badman'),
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.130.0-beta.3"
"version": "6.130.0-beta.5"
}
24 changes: 13 additions & 11 deletions apps/badman-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ dotenv.config({
});

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
const baseURL = process.env['BASE_URL'] || 'http://localhost:5000';

/**
* See https://playwright.dev/docs/test-configuration.
* See https://playwright.dev/docs/test-configuration.https://github.com/Badminton-Apps/badman/actions/runs/7568349931/job/20609664637#logs
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
Expand All @@ -23,26 +23,28 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: process.env.CI ? 2 : 2,
/* Opt out of parallel tests on CI. */
workers: 1, // process.env.CI ? 1 : undefined,
/* Timeout for each test */
timeout: 120_000,
workers: process.env.CI ? 1 : '20%',
/* Timeout for each test, on average our test takes 3 seconds, so 10 should be plenty */
timeout: 60_000,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
video: 'on-first-retry',
video: process.env.CI ? 'off' : 'on-first-retry',
},
/* Run your local dev server before starting the tests */
reporter: [['html'], [process.env.CI ? 'github' : 'list']],
/* We build our projects and then api hosts itself and the client */
webServer: {
command: 'npx nx run-many --target serve --projects badman,api --parallel',
url: baseURL,
command: 'npx nx run-many -t build -p badman,api && node dist/apps/api/main.js',
url: `${baseURL}/api/health`,
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
// Our build + serve takes a while, so we need to increase the timeout.
timeout: 120_000,
stdout: 'pipe',
// stdout: 'pipe',
// stderr: 'pipe',
},

Expand Down
2 changes: 1 addition & 1 deletion apps/badman-e2e/src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type testFixture = {
homePage: HomePage;
assemblyPage: AssemblyPage;
};
export const badmanTest = base.extend<testFixture>({
export const bTest = base.extend<testFixture>({
homePage: async ({ page }, use) => {
const homePage = new HomePage(page);
await homePage.goto();
Expand Down
2 changes: 2 additions & 0 deletions apps/badman-e2e/src/pages/assembly.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export default class AssemblyPage {
// click on the mat-label in this.teamInput
this.teamSelect.locator('mat-label').click();

await this.overlay.locator('mat-option').isVisible();

// find team in overlay
const teamItem = this.overlay.locator('mat-option').filter({
hasText: team,
Expand Down
2 changes: 1 addition & 1 deletion apps/badman-e2e/src/pages/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export default class HomePage {
readonly ranking: Locator;

constructor(page: Page) {
setup(page);
this.page = page;

this.ranking = page.locator('section.ranking');
}

async goto() {
await setup(this.page);
await this.page.goto('/');
}
}
26 changes: 13 additions & 13 deletions apps/badman-e2e/src/tests/assembly.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import { expect } from '@playwright/test';
import { badmanTest } from '../fixture';
import { bTest } from '../fixture';

badmanTest.describe('Landing page', () => {
badmanTest('if page is visible', async ({ assemblyPage }) => {
bTest.describe('Landing page', () => {
bTest('if page is visible', async ({ assemblyPage }) => {
await expect(assemblyPage.header).toContainText('Team assembly');
});

badmanTest.describe('Assembly', () => {
badmanTest.beforeEach(async ({ assemblyPage }) => {
bTest.describe('Assembly', () => {
bTest.beforeEach(async ({ assemblyPage }) => {
await assemblyPage.selectClub('BC Broodrooster');
await assemblyPage.selectTeam('BC Broodrooster 1G');
});

badmanTest('Select encounter', async ({ assemblyPage }) => {
bTest('Select encounter', async ({ assemblyPage }) => {
await expect(assemblyPage.encounterSelect).toContainText('against BC Tandpasta 1G');
await expect(assemblyPage.playerList).toBeVisible({ timeout: 60_000 });
await expect(assemblyPage.playerList).toBeVisible();
});

badmanTest('Player 8888 should be visible', async ({ assemblyPage }) => {
bTest('Player 8888 should be visible', async ({ assemblyPage }) => {
const player = await assemblyPage.getPlayer('M 8-8-8 BC Broodrooster');

await expect(player).toBeVisible();
});

badmanTest.describe('Drag and drop', () => {
badmanTest('Drag player 8888 to single men', async ({ assemblyPage }) => {
bTest.describe('Drag and drop', () => {
bTest('Drag player 8888 to single men', async ({ assemblyPage }) => {
await assemblyPage.dragPlayer('M 8-8-8 BC Broodrooster', assemblyPage.single1List);

await expect(assemblyPage.single1List).toContainText('M 8-8-8 BC Broodrooster');

await expect(assemblyPage.titulars.index).toContainText('Index: 132');
});

badmanTest('Drag player 8888 to single women', async ({ assemblyPage }) => {
bTest('Drag player 8888 to single women', async ({ assemblyPage }) => {
await assemblyPage.dragPlayer('M 8-8-8 BC Broodrooster', assemblyPage.single1List);

await expect(assemblyPage.single3List).not.toContainText('M 8-8-8 BC Broodrooster');
});

badmanTest('Drag player 8888 and 999 to doubles', async ({ assemblyPage }) => {
bTest('Drag player 8888 and 999 to doubles', async ({ assemblyPage }) => {
await assemblyPage.dragPlayer('M 8-8-8 BC Broodrooster', assemblyPage.double1List);
await assemblyPage.dragPlayer('M 9-9-9 BC Broodrooster', assemblyPage.double1List);

Expand All @@ -48,7 +48,7 @@ badmanTest.describe('Landing page', () => {
await expect(assemblyPage.titulars.index).toContainText('Index: 123');
});

badmanTest('Drag player 8888 and 999 to singles reversed and check validation', async ({ assemblyPage }) => {
bTest('Drag player 8888 and 999 to singles reversed and check validation', async ({ assemblyPage }) => {
await assemblyPage.dragPlayer('M 8-8-8 BC Broodrooster', assemblyPage.single2List);
await assemblyPage.dragPlayer('M 9-9-9 BC Broodrooster', assemblyPage.single1List);

Expand Down
10 changes: 5 additions & 5 deletions apps/badman-e2e/src/tests/landing.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { expect } from '@playwright/test';
import { badmanTest } from '../fixture';
import { bTest } from '../fixture';

badmanTest.describe('Landing page', () => {
badmanTest('if page is visible', async ({ homePage }) => {
bTest.describe('Landing page', () => {
bTest('if page is visible', async ({ homePage }) => {
await expect(homePage.ranking).toBeVisible();
});

badmanTest('if header is visible', async ({ homePage }) => {
bTest('if header is visible', async ({ homePage }) => {
await expect(homePage.ranking.locator('h3')).toContainText('Ranking table');
});

badmanTest('should contain 12 rows', async ({ homePage }) => {
bTest('should contain 12 rows', async ({ homePage }) => {
await expect(homePage.ranking.locator('tbody tr')).toHaveCount(12);
});
});
14 changes: 14 additions & 0 deletions apps/badman/src/assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.130.0-beta.5](https://github.com/Badminton-Apps/badman/compare/v6.130.0-beta.4...v6.130.0-beta.5) (2024-01-18)


### Bug Fixes

* localisation is async, should hopefully result in correct language ([15f60de](https://github.com/Badminton-Apps/badman/commit/15f60defcec5efec8066cb81a39968e2fdc17a32))

## [6.130.0-beta.4](https://github.com/Badminton-Apps/badman/compare/v6.130.0-beta.3...v6.130.0-beta.4) (2024-01-18)


### Bug Fixes

* added more structured testing ([54a0e69](https://github.com/Badminton-Apps/badman/commit/54a0e69861f254f111f43252d62b1f5d3a972ae6))

## [6.130.0-beta.3](https://github.com/Badminton-Apps/badman/compare/v6.130.0-beta.2...v6.130.0-beta.3) (2024-01-17)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion apps/badman/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.130.0-beta.3"
"version": "6.130.0-beta.5"
}
2 changes: 1 addition & 1 deletion apps/worker/ranking/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.130.0-beta.3"
"version": "6.130.0-beta.5"
}
2 changes: 1 addition & 1 deletion apps/worker/sync/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "6.130.0-beta.3"
"version": "6.130.0-beta.5"
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "badman-mono",
"version": "6.130.0-beta.3",
"version": "6.130.0-beta.5",
"license": "MIT",
"scripts": {
"ng": "nx",
Expand Down
4 changes: 2 additions & 2 deletions scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "badman_scripts",
"version": "6.130.0-beta.3",
"version": "6.130.0-beta.5",
"license": "MIT",
"scripts": {
"create-release": "node ./standard-version.js"
Expand Down

0 comments on commit da1c71b

Please sign in to comment.