Merge branch 'web/wdio-2' into application-wizard-2-with-api-and-tests

* web/wdio-2:
  remove hooks
  add basic CI
  prettier run
  add dependabot
  update package name
  fix blueprints
  web: improve testing by adding test admin user via blueprint
This commit is contained in:
Ken Sternberg 2023-10-02 09:01:07 -07:00
commit e415bc0794
13 changed files with 94 additions and 169 deletions

View File

@ -30,6 +30,38 @@ updates:
open-pull-requests-limit: 10 open-pull-requests-limit: 10
commit-message: commit-message:
prefix: "web:" prefix: "web:"
# TODO: deduplicate these groups
groups:
sentry:
patterns:
- "@sentry/*"
babel:
patterns:
- "@babel/*"
- "babel-*"
eslint:
patterns:
- "@typescript-eslint/eslint-*"
- "eslint"
- "eslint-*"
storybook:
patterns:
- "@storybook/*"
- "*storybook*"
esbuild:
patterns:
- "@esbuild/*"
- package-ecosystem: npm
directory: "/tests/wdio"
schedule:
interval: daily
time: "04:00"
labels:
- dependencies
open-pull-requests-limit: 10
commit-message:
prefix: "web:"
# TODO: deduplicate these groups
groups: groups:
sentry: sentry:
patterns: patterns:

View File

@ -13,19 +13,25 @@ on:
jobs: jobs:
lint-eslint: lint-eslint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- web
- tests/wdio
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: "20" node-version: "20"
cache: "npm" cache: "npm"
cache-dependency-path: web/package-lock.json cache-dependency-path: ${{ matrix.project }}/package-lock.json
- working-directory: web/ - working-directory: ${{ matrix.project }}/
run: npm ci run: npm ci
- name: Generate API - name: Generate API
run: make gen-client-ts run: make gen-client-ts
- name: Eslint - name: Eslint
working-directory: web/ working-directory: ${{ matrix.project }}/
run: npm run lint run: npm run lint
lint-build: lint-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -45,19 +51,25 @@ jobs:
run: npm run tsc run: npm run tsc
lint-prettier: lint-prettier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- web
- tests/wdio
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: "20" node-version: "20"
cache: "npm" cache: "npm"
cache-dependency-path: web/package-lock.json cache-dependency-path: ${{ matrix.project }}/package-lock.json
- working-directory: web/ - working-directory: ${{ matrix.project }}/
run: npm ci run: npm ci
- name: Generate API - name: Generate API
run: make gen-client-ts run: make gen-client-ts
- name: prettier - name: prettier
working-directory: web/ working-directory: ${{ matrix.project }}/
run: npm run prettier-check run: npm run prettier-check
lint-lit-analyse: lint-lit-analyse:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -7427,146 +7427,32 @@
"model_authentik_stages_invitation.invitation": { "model_authentik_stages_invitation.invitation": {
"type": "object", "type": "object",
"properties": { "properties": {
"name": {
"type": "string",
"maxLength": 50,
"minLength": 1,
"pattern": "^[-a-zA-Z0-9_]+$",
"title": "Name"
},
"expires": { "expires": {
"type": "string", "type": "string",
"format": "date-time", "format": "date-time",
"title": "Expires" "title": "Expires"
}, },
"user": { "fixed_data": {
"type": "object",
"properties": {
"username": {
"type": "string",
"maxLength": 150,
"minLength": 1,
"title": "Username"
},
"name": {
"type": "string",
"title": "Name",
"description": "User's display name."
},
"is_active": {
"type": "boolean",
"title": "Active",
"description": "Designates whether this user should be treated as active. Unselect this instead of deleting accounts."
},
"last_login": {
"type": [
"string",
"null"
],
"format": "date-time",
"title": "Last login"
},
"groups": {
"type": "array",
"items": {
"type": "integer"
},
"title": "Groups"
},
"email": {
"type": "string",
"format": "email",
"maxLength": 254,
"title": "Email address"
},
"attributes": {
"type": "object", "type": "object",
"additionalProperties": true, "additionalProperties": true,
"title": "Attributes" "title": "Fixed data"
}, },
"path": { "single_use": {
"type": "string",
"minLength": 1,
"title": "Path"
},
"type": {
"type": "string",
"enum": [
"internal",
"external",
"service_account",
"internal_service_account"
],
"title": "Type"
}
},
"required": [
"username",
"name"
],
"title": "User"
},
"application": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"title": "Name",
"description": "Application's display Name."
},
"slug": {
"type": "string",
"maxLength": 50,
"minLength": 1,
"pattern": "^[-a-zA-Z0-9_]+$",
"title": "Slug",
"description": "Internal application name, used in URLs."
},
"provider": {
"type": "integer",
"title": "Provider"
},
"backchannel_providers": {
"type": "array",
"items": {
"type": "integer"
},
"title": "Backchannel providers"
},
"open_in_new_tab": {
"type": "boolean", "type": "boolean",
"title": "Open in new tab", "title": "Single use",
"description": "Open launch URL in a new browser tab or window." "description": "When enabled, the invitation will be deleted after usage."
}, },
"meta_launch_url": { "flow": {
"type": "string", "type": "integer",
"title": "Meta launch url" "title": "Flow",
}, "description": "When set, only the configured flow can use this invitation."
"meta_description": {
"type": "string",
"title": "Meta description"
},
"meta_publisher": {
"type": "string",
"title": "Meta publisher"
},
"policy_engine_mode": {
"type": "string",
"enum": [
"all",
"any"
],
"title": "Policy engine mode"
},
"group": {
"type": "string",
"title": "Group"
}
},
"required": [
"name",
"slug"
],
"title": "Application"
},
"permissions": {
"type": "string",
"minLength": 1,
"title": "Permissions"
} }
}, },
"required": [] "required": []

View File

@ -1,7 +1,6 @@
context: {} version: 1
entries: entries:
- attrs: - attrs:
attributes: {}
email: test-admin@goauthentik.io email: test-admin@goauthentik.io
is_active: true is_active: true
name: authentik Default Admin name: authentik Default Admin
@ -11,7 +10,6 @@ entries:
groups: groups:
- !Find [authentik_core.group, [name, "authentik Admins"]] - !Find [authentik_core.group, [name, "authentik Admins"]]
conditions: [] conditions: []
id: null
identifiers: identifiers:
username: akadmin username: akadmin
model: authentik_core.user model: authentik_core.user

View File

@ -1,10 +1,10 @@
{ {
"name": "my-new-project", "name": "@goauthentik/web-tests",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "my-new-project", "name": "@goauthentik/web-tests",
"devDependencies": { "devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0", "@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/eslint-plugin": "^6.7.2",

View File

@ -1,5 +1,6 @@
{ {
"name": "my-new-project", "name": "@goauthentik/web-tests",
"private": true,
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0", "@trivago/prettier-plugin-sort-imports": "^4.2.0",
@ -21,6 +22,7 @@
"scripts": { "scripts": {
"wdio": "wdio run ./wdio.conf.ts", "wdio": "wdio run ./wdio.conf.ts",
"lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[AM?][M?]' | cut -d'/' -f3- | grep -E '\\.(ts|js|tsx|jsx)$')", "lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[AM?][M?]' | cut -d'/' -f3- | grep -E '\\.(ts|js|tsx|jsx)$')",
"lint": "eslint . --max-warnings 0 --fix",
"lint:spelling": "codespell -D - -D $(git rev-parse --show-toplevel 2> /dev/null)/.github/codespell-dictionary.txt -I $(git rev-parse --show-toplevel 2> /dev/null)/.github/codespell-words.txt ./test -s", "lint:spelling": "codespell -D - -D $(git rev-parse --show-toplevel 2> /dev/null)/.github/codespell-dictionary.txt -I $(git rev-parse --show-toplevel 2> /dev/null)/.github/codespell-words.txt ./test -s",
"precommit": "run-s lint:precommit lint:spelling prettier", "precommit": "run-s lint:precommit lint:spelling prettier",
"prettier-check": "prettier --check .", "prettier-check": "prettier --check .",

View File

@ -16,7 +16,6 @@ class ApplicationsListPage extends AdminPage {
async open() { async open() {
return await super.open("if/admin/#/core/applications"); return await super.open("if/admin/#/core/applications");
} }
} }
export default new ApplicationsListPage(); export default new ApplicationsListPage();

View File

@ -2,7 +2,7 @@ import LoginPage from "../pageobjects/login.page.js";
import { BAD_PASSWORD, BAD_USERNAME, GOOD_USERNAME } from "../utils/constants.js"; import { BAD_PASSWORD, BAD_USERNAME, GOOD_USERNAME } from "../utils/constants.js";
import { expect } from "@wdio/globals"; import { expect } from "@wdio/globals";
describe("Log into Authentik", () => { describe("Log into authentik", () => {
it("should fail on a bad username", async () => { it("should fail on a bad username", async () => {
await LoginPage.open(); await LoginPage.open();
await LoginPage.username(BAD_USERNAME); await LoginPage.username(BAD_USERNAME);

View File

@ -1,5 +1,5 @@
import { login } from "../utils/login.js"; import { login } from "../utils/login.js";
describe("Log into Authentik", () => { describe("Log into authentik", () => {
it("should login with valid credentials and reach the UserLibrary", login); it("should login with valid credentials and reach the UserLibrary", login);
}); });

View File

@ -2,6 +2,4 @@ export const BAD_USERNAME = process.env.AK_BAD_USERNAME ?? "bad-username@bad-log
export const GOOD_USERNAME = process.env.AK_GOOD_USERNAME ?? "test-admin@goauthentik.io"; export const GOOD_USERNAME = process.env.AK_GOOD_USERNAME ?? "test-admin@goauthentik.io";
export const BAD_PASSWORD = process.env.AK_BAD_PASSWORD ?? "-this-is-a-bad-password-"; export const BAD_PASSWORD = process.env.AK_BAD_PASSWORD ?? "-this-is-a-bad-password-";
export const GOOD_PASSWORD = process.env.AK_GOOD_PASSWORD ?? "test-runner" export const GOOD_PASSWORD = process.env.AK_GOOD_PASSWORD ?? "test-runner";

View File

@ -1,7 +1,7 @@
import LoginPage from "../pageobjects/login.page.js"; import LoginPage from "../pageobjects/login.page.js";
import UserLibraryPage from "../pageobjects/user-library.page.js"; import UserLibraryPage from "../pageobjects/user-library.page.js";
import { expect } from "@wdio/globals";
import { GOOD_PASSWORD, GOOD_USERNAME } from "./constants.js"; import { GOOD_PASSWORD, GOOD_USERNAME } from "./constants.js";
import { expect } from "@wdio/globals";
export const login = async () => { export const login = async () => {
await LoginPage.open(); await LoginPage.open();

View File

@ -1,5 +1,4 @@
import type { Options } from "@wdio/types"; import type { Options } from "@wdio/types";
import { browser } from "@wdio/globals";
export const config: Options.Testrunner = { export const config: Options.Testrunner = {
// //
@ -74,7 +73,7 @@ export const config: Options.Testrunner = {
"--disable-dev-shm-usage", "--disable-dev-shm-usage",
] ]
: []; : [];
})() })(),
), ),
}, },
}, },

View File

@ -30,7 +30,6 @@ export class ApplicationWizard extends CustomListenerElement(
this.steps = newSteps(); this.steps = newSteps();
} }
/** /**
* We're going to be managing the content of the forms by percolating all of the data up to this * We're going to be managing the content of the forms by percolating all of the data up to this
* class, which will ultimately transmit all of it to the server as a transaction. The * class, which will ultimately transmit all of it to the server as a transaction. The