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
commit-message:
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:
sentry:
patterns:

View File

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

View File

@ -7427,146 +7427,32 @@
"model_authentik_stages_invitation.invitation": {
"type": "object",
"properties": {
"name": {
"type": "string",
"maxLength": 50,
"minLength": 1,
"pattern": "^[-a-zA-Z0-9_]+$",
"title": "Name"
},
"expires": {
"type": "string",
"format": "date-time",
"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",
"additionalProperties": true,
"title": "Attributes"
},
"path": {
"type": "string",
"minLength": 1,
"title": "Path"
},
"type": {
"type": "string",
"enum": [
"internal",
"external",
"service_account",
"internal_service_account"
],
"title": "Type"
}
},
"required": [
"username",
"name"
],
"title": "User"
"additionalProperties": true,
"title": "Fixed data"
},
"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",
"title": "Open in new tab",
"description": "Open launch URL in a new browser tab or window."
},
"meta_launch_url": {
"type": "string",
"title": "Meta launch url"
},
"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"
"single_use": {
"type": "boolean",
"title": "Single use",
"description": "When enabled, the invitation will be deleted after usage."
},
"permissions": {
"type": "string",
"minLength": 1,
"title": "Permissions"
"flow": {
"type": "integer",
"title": "Flow",
"description": "When set, only the configured flow can use this invitation."
}
},
"required": []

View File

@ -1,18 +1,16 @@
context: {}
version: 1
entries:
- attrs:
attributes: {}
email: test-admin@goauthentik.io
is_active: true
name: authentik Default Admin
password: test-runner
path: users
type: internal
groups:
- !Find [authentik_core.group, [name, "authentik Admins"]]
conditions: []
id: null
identifiers:
username: akadmin
model: authentik_core.user
state: present
- attrs:
email: test-admin@goauthentik.io
is_active: true
name: authentik Default Admin
password: test-runner
path: users
type: internal
groups:
- !Find [authentik_core.group, [name, "authentik Admins"]]
conditions: []
identifiers:
username: akadmin
model: authentik_core.user
state: present

View File

@ -1,10 +1,10 @@
{
"name": "my-new-project",
"name": "@goauthentik/web-tests",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "my-new-project",
"name": "@goauthentik/web-tests",
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@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",
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
@ -21,6 +22,7 @@
"scripts": {
"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": "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",
"precommit": "run-s lint:precommit lint:spelling prettier",
"prettier-check": "prettier --check .",

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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);
});

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

View File

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

View File

@ -30,7 +30,6 @@ export class ApplicationWizard extends CustomListenerElement(
this.steps = newSteps();
}
/**
* 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