diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7b14e7..9755f56 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,6 +48,14 @@ jobs: restore-keys: | yarn- + - name: Lint the application + shell: bash -l {0} + working-directory: frontend + run: | + set -eux + yarn install + yarn run lint:check + - name: Package the application shell: bash -l {0} run: | diff --git a/frontend/package.json b/frontend/package.json index 418053c..890d58e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,9 +6,12 @@ "scripts": { "build": "cross-env NODE_ENV=development webpack --config webpack.config.js", "build:prod": "cross-env NODE_ENV=production webpack --config webpack.config.js", - "eslint": "eslint --ext .js,.jsx,.ts,.tsx src/", + "eslint": "eslint --fix --ext .js,.jsx,.ts,.tsx src/", + "eslint:check": "eslint --ext .js,.jsx,.ts,.tsx src/", + "prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"", "prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"", "lint": "yarn prettier && yarn eslint", + "lint:check": "yarn prettier:check && yarn eslint:check", "clean": "rimraf ./lib ../tljh_repo2docker/static/js/react" }, "devDependencies": { diff --git a/frontend/ui-tests/package.json b/frontend/ui-tests/package.json index 8bdf775..ed8db4c 100644 --- a/frontend/ui-tests/package.json +++ b/frontend/ui-tests/package.json @@ -1,16 +1,16 @@ { - "name": "tljh_repo2docker-ui-tests", - "version": "1.0.0", - "description": "tljh_repo2docker UI Tests", - "private": true, - "scripts": { - "test": "npx playwright test --workers 1", - "test:update": "npx playwright test --update-snapshots", - "test:debug": "PWDEBUG=1 npx playwright test --workers 1" - }, - "license": "BSD-3-Clause", - "dependencies": { - "@playwright/test": "^1.31.0", - "rimraf": "^4.1.2" - } + "name": "tljh_repo2docker-ui-tests", + "version": "1.0.0", + "description": "tljh_repo2docker UI Tests", + "private": true, + "scripts": { + "test": "npx playwright test --workers 1", + "test:update": "npx playwright test --update-snapshots", + "test:debug": "PWDEBUG=1 npx playwright test --workers 1" + }, + "license": "BSD-3-Clause", + "dependencies": { + "@playwright/test": "^1.31.0", + "rimraf": "^4.1.2" + } } diff --git a/frontend/ui-tests/playwright.config.js b/frontend/ui-tests/playwright.config.js index 757ade2..5505f28 100644 --- a/frontend/ui-tests/playwright.config.js +++ b/frontend/ui-tests/playwright.config.js @@ -1,14 +1,14 @@ module.exports = { timeout: 120000, - reporter: [[process.env.CI ? "dot" : "list"], ["html"]], + reporter: [[process.env.CI ? 'dot' : 'list'], ['html']], use: { - baseURL: "http://localhost:8000", - video: "retain-on-failure", + baseURL: 'http://localhost:8000', + video: 'retain-on-failure' }, retries: 0, expect: { toMatchSnapshot: { - maxDiffPixelRatio: 0.005, - }, + maxDiffPixelRatio: 0.005 + } } }; diff --git a/frontend/ui-tests/tests/ui.test.ts b/frontend/ui-tests/tests/ui.test.ts index a6661da..ad9f85e 100644 --- a/frontend/ui-tests/tests/ui.test.ts +++ b/frontend/ui-tests/tests/ui.test.ts @@ -35,15 +35,14 @@ test.describe('tljh_repo2docker UI Tests', () => { test('Render servers page', async ({ page }) => { await login(page, 'alice'); await page.getByRole('link', { name: 'Servers' }).click(); - // await page.getByRole('button', { name: 'Create new Server' }); - await page.waitForTimeout(1000) + await page.waitForURL('**/servers'); await page.getByText('No servers are running'); expect(await page.screenshot()).toMatchSnapshot(); }); test('Render environments page', async ({ page }) => { await login(page, 'alice'); await page.getByRole('link', { name: 'Environments' }).click(); - await page.waitForTimeout(1000) + await page.waitForURL('**/environments'); await page.getByText('No environment available'); expect(await page.screenshot()).toMatchSnapshot(); });