Skip to content

Commit

Permalink
feat: update to latest visyn_scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
puehringer committed May 22, 2024
1 parent d0ba470 commit bf7d384
Show file tree
Hide file tree
Showing 16 changed files with 14,171 additions and 10,238 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ name: build
on:
workflow_dispatch:
inputs:
cypress:
description: 'Run cypress'
playwright:
description: 'Run playwright'
required: false
type: boolean
default: false
playwright_spec_param:
type: string
description: "Run specific test(s). Example: `landing-page.spec.ts`"
required: false
push:
schedule:
- cron: '15 1 * * *'

jobs:
build:
uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main
secrets: inherit
with:
cypress_enable: true
cypress_run_because_flag: ${{ inputs.cypress == true }}
cypress_enable: false
playwright_enable: true
playwright_run_because_flag: ${{ inputs.playwright == true }}
playwright_spec_param: ${{ inputs.playwright_spec_param }}
22 changes: 22 additions & 0 deletions .github/workflows/build_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build nightly

on:
workflow_dispatch:
schedule:
- cron: '15 1 * * *'

jobs:
build-main:
uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main
secrets: inherit
with:
playwright_enable: true
playwright_run_because_flag: true
branch: main
build-develop:
uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main
secrets: inherit
with:
playwright_enable: true
playwright_run_because_flag: true
branch: develop
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@ node_modules/
!.yarn/versions

# env
/.venv*/
/.venv*/

# playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.2.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
yarnPath: .yarn/releases/yarn-3.2.2.cjs
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.2.2.cjs
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,29 @@
"compile:watch": "visyn_scripts compile --watch",
"compile": "visyn_scripts compile",
"copy": "visyn_scripts copy",
"cy:open": "cypress open",
"cy:run": "cypress run --e2e && cypress run --component",
"delete-dependencies": "visyn_scripts clean node_modules",
"dist": "mkdir lib && cd dist && tar cvzf ../lib/app_template.tar.gz *",
"docs": "visyn_scripts docs",
"lint:fix": "visyn_scripts lint --fix",
"lint": "visyn_scripts lint",
"pw:open": "playwright test --ui",
"pw:run": "playwright test",
"predist": "yarn run lint && yarn run test && yarn run build",
"start": "visyn_scripts start --env workspace_mode=single",
"test": "visyn_scripts test",
"webpack:dev": "visyn_scripts build --mode development --env workspace_mode=single",
"webpack:prod": "visyn_scripts build --mode production --env workspace_mode=single"
"bundle:dev": "visyn_scripts bundle --mode development --env workspace_mode=single",
"bundle:prod": "visyn_scripts bundle --mode production --env workspace_mode=single"
},
"dependencies": {
"@mantine/core": "^5.5.5",
"@mantine/form": "^5.5.5",
"@mantine/hooks": "^5.5.5",
"@mantine/notifications": "^5.5.5",
"@reduxjs/toolkit": "^1.8.2",
"react-redux": "^8.0.2",
"visyn_core": "^7.0.1",
"visyn_scripts": "^7.0.1"
"visyn_core": "^10.0.3",
"visyn_scripts": "v9.0.0"
},
"devDependencies": {
"@rtk-query/codegen-openapi": "^1.0.0",
"cypress": "^12.0.1"
"@playwright/test": "^1.44.0",
"@rtk-query/codegen-openapi": "^1.2.0",
"playwright": "^1.44.0"
},
"resolutions": {
"@types/react": "~18.2.0",
Expand All @@ -77,5 +74,5 @@
}
}
},
"packageManager": "yarn@3.2.2"
"packageManager": "yarn@4.2.2"
}
49 changes: 49 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineConfig, devices } from '@playwright/test';

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './playwright',
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 0 : 0,
workers: process.env.CI ? 2 : 2,
reporter: process.env.CI ? [['github'], ['list'], ['html', { open: 'never' }]] : [['list'], ['html', { open: 'never' }]],
use: {
baseURL: 'http://127.0.0.1:8080',
testIdAttribute: 'data-testid',
viewport: { width: 1920, height: 1080 },
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Capture screenshot after each test failure: https://playwright.dev/docs/test-use-options#recording-options */
screenshot: 'only-on-failure',
/* Capture video */
// video: 'retain-on-failure',
},
expect: { timeout: 20000 },
timeout: 1000 * 60,
globalTimeout: 8 * 60 * 1000,
projects: [
{ name: 'setup', testMatch: /.*\.setup\.ts/ },
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], viewport: { width: 1920, height: 1080 }, storageState: 'playwright/.auth/user.json' },
dependencies: ['setup'],
},
],
/* Run your local dev server before starting the tests */
webServer: [
{
command: 'yarn start dev_server_only=true',
url: 'http://127.0.0.1:8080',
reuseExistingServer: !process.env.CI,
},
{
command: 'make start',
url: 'http://127.0.0.1:9000/health',
reuseExistingServer: !process.env.CI,
},
],
});
12 changes: 12 additions & 0 deletions playwright/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test } from '@playwright/test';

test.describe('App', () => {
test('App test 01', async ({ page }) => {
await page.goto('/');

await page.getByText('Campaign name').fill('Test campaign name');
await page.getByText('Campaign description').fill('Test campaign description');
await page.getByText('Create campaign').click();
await page.getByText('Delete').click();
});
});
13 changes: 13 additions & 0 deletions playwright/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test as setup } from '@playwright/test';

const authFile = 'playwright/.auth/user.json';

setup('authenticate', async ({ request }) => {
await request.post('/api/login', {
form: {
username: 'admin',
password: 'admin',
},
});
await request.storageState({ path: authFile });
});
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
visyn_core>=7.0.1,<8.0.0
pandas==2.0.1
sqlmodel==0.0.8
sse-starlette==1.6.1
sse-starlette==1.6.1
visyn_core>=10.0.3,<11.0.0
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function App() {
<Stack style={{ overflowY: 'auto' }} m="md">
{campaigns?.map((c) => (
<Card key={c.id} withBorder shadow="sm">
<Group position="apart">
<Group justify="apart">
{c.name}

<Button
Expand Down
10 changes: 5 additions & 5 deletions src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import type { ConfigFile } from '@rtk-query/codegen-openapi';

const config: ConfigFile = {
schemaFile: 'http://localhost:9000/api/openapi.json',
apiFile: './store/appBaseApi.ts',
apiImport: 'emptySplitApi',
outputFile: './store/generatedAppApi.ts',
exportName: 'generatedAppApi',
apiFile: './generated/baseApi.ts',
apiImport: 'baseApi',
outputFile: './generated/generatedOpenAPI.ts',
exportName: 'generatedOpenAPI',
tag: false, // TODO: when true, his will refetch everything with every mutation as we only have one tag.
filterEndpoints: (endpoint, definition) => definition?.path?.startsWith('/api/v1/app'),
filterEndpoints: (endpoint, definition) => definition?.path?.startsWith('/api/'),
hooks: { queries: true, lazyQueries: true, mutations: true },
};

Expand Down
9 changes: 9 additions & 0 deletions src/generated/baseApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Or from '@reduxjs/toolkit/query' if not using the auto-generated hooks
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';

// initialize an empty api service that we'll inject endpoints into later as needed
export const baseApi = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({ baseUrl: '/' }),
endpoints: () => ({}),
});
Loading

0 comments on commit bf7d384

Please sign in to comment.