Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/dist/
e2e/browser/test-app/
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
extends: ["@inrupt/eslint-config-lib"],
rules: {
"import/prefer-default-export": "off"
}
}
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on: [push]
env:
CI: true
jobs:
lint:
uses: ./.github/workflows/reusable-lint.yml
with:
build: true

build:
runs-on: ${{ matrix.os }}
environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
required: false
default: false
type: boolean

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
41 changes: 21 additions & 20 deletions eslint-configs/eslint-config-base/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
Copyright Inrupt Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// Copyright Inrupt Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

module.exports = {
env: {
Expand All @@ -44,6 +44,7 @@ module.exports = {
},
},
jest: {
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/extensions
version: require("jest/package.json").version,
},
},
Expand Down
45 changes: 24 additions & 21 deletions eslint-configs/eslint-config-lib/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
Copyright Inrupt Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// Copyright Inrupt Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

module.exports = {
extends: [
Expand Down Expand Up @@ -73,7 +73,10 @@ module.exports = {
// import type { Term } from '@rdfjs/types';
// ```
//
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
},
},
],
Expand Down
40 changes: 20 additions & 20 deletions eslint-configs/eslint-config-react/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/*
Copyright Inrupt Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//
// Copyright Inrupt Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

module.exports = {
extends: ["airbnb", "airbnb/hooks", "@inrupt/eslint-config-base"],
Expand Down
13 changes: 8 additions & 5 deletions package-lock.json

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

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"release": "scripts/release.sh",
"test": "playwright test",
"e2e:test:setup": "cd ./e2e/browser/test-app && npm ci",
"prepare-release": "scripts/prepare-release.sh"
"prepare-release": "scripts/prepare-release.sh",
"lint": "npm run lint:check",
"lint:check": "npm run lint:eslint && npm run lint:prettier -- --check",
"lint:eslint": "eslint --config .eslintrc.js \"packages/\" \"e2e/\" \"eslint-configs/\"",
"lint:prettier": "prettier \"{src,e2e,examples}/**/*.{ts,tsx,js,jsx,css}\" \"**/*.{md,mdx,yml}\"",
"lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write"
},
"workspaces": [
"eslint-configs/*",
Expand All @@ -27,13 +32,15 @@
},
"homepage": "https://github.com/inrupt/typescript-sdk-tools#readme",
"dependencies": {
"@inrupt/eslint-config-lib": "^2.1.1",
"lerna": "^7.1.4",
"rimraf": "^5.0.1",
"rollup": "^3.27.0",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^5.1.3"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.2",
"@types/react": "^18.2.18",
"next": "^13.4.12"
}
Expand Down
7 changes: 4 additions & 3 deletions packages/internal-playwright-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ Then add in calls to the functions such as `loginAndAllow` to your test files.
For these helpers to work, your app should use predefined testids defined in
`@@inrupt/internal-playwright-testids`. The following testids are expected in the
exposed helpers:
- The OpenID provider should be specified in a text input identified with

- The OpenID provider should be specified in a text input identified with
`TESTID_OPENID_PROVIDER_INPUT`.
- The login should be initiated by clicking a button identified with
- The login should be initiated by clicking a button identified with
`TESTID_LOGIN_BUTTON`.
- When the login process is complete, an element identified with
- When the login process is complete, an element identified with
`TESTID_SESSION_STATUS` should appear in the DOM.
- When an error occurs, an element identified with `TESTID_ERROR_MESSAGE` should
appear in the DOM.
22 changes: 21 additions & 1 deletion packages/internal-playwright-helpers/src/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
//
// Copyright Inrupt Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import { test as base } from "@playwright/test";
import { getBrowserTestingEnvironment } from "@inrupt/internal-test-env";
import { AuthFlow } from "./flows/auth";
Expand All @@ -10,7 +30,7 @@ export const test = base.extend<AuthFixture>({
// Override the page fixture to start the app automatically
page: async ({ page }, use) => {
await page.goto("/");
use(page);
await use(page);
},
auth: async ({ page }, use) => {
const { idp, clientCredentials } = getBrowserTestingEnvironment({
Expand Down
16 changes: 12 additions & 4 deletions packages/internal-playwright-helpers/src/flows/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,26 @@
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { Page } from "@playwright/test";
import type { Page } from "@playwright/test";
import { CognitoPage } from "../pages/cognito";
import { OpenIdPage } from "../pages/open-id";
import { TestPage } from "../pages/testPage";

export class AuthFlow {
page: Page;

openidProvider: string;

userLogin: string;

password: string;

constructor(page: Page, openidProvider: string, userLogin: string, password: string) {
constructor(
page: Page,
openidProvider: string,
userLogin: string,
password: string
) {
this.page = page;
this.openidProvider = openidProvider;
this.userLogin = userLogin;
Expand All @@ -51,9 +59,9 @@ export class AuthFlow {
await testPage.startLogin();
await cognitoPage.login(this.userLogin, this.password);
// TODO: handle allow === false
if(options.allow) {
if (options.allow) {
await openIdPage.allow();
}
await testPage.handleRedirect();
};
}
}
14 changes: 7 additions & 7 deletions packages/internal-playwright-helpers/src/pages/cognito.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { Page } from "@playwright/test";
import type { Page } from "@playwright/test";

/**
* Login page exposed by Cognito, the OIDC Provider used for PodSpaces and other
Expand All @@ -33,13 +33,13 @@ export class CognitoPage {
}

async login(username: string, password: string) {
await this.page.getByRole('textbox', { name: 'Username' }).fill(username);
await this.page.getByRole('textbox', { name: 'Password' }).fill(password);
await this.page.getByRole("textbox", { name: "Username" }).fill(username);
await this.page.getByRole("textbox", { name: "Password" }).fill(password);
await Promise.all([
// It is important to call waitForURL before click to set up waiting.
this.page.waitForURL(/.*/),
// Clicking the link will indirectly cause a navigation.
this.page.getByRole('button', { name: 'submit' }).click(),
// It is important to call waitForURL before click to set up waiting.
this.page.waitForURL(/.*/),
// Clicking the link will indirectly cause a navigation.
this.page.getByRole("button", { name: "submit" }).click(),
]);
}
}
4 changes: 2 additions & 2 deletions packages/internal-playwright-helpers/src/pages/open-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { Page } from "@playwright/test";
import type { Page } from "@playwright/test";

/**
* The Solid-OIDC Broker exposed by ESS wrapped around an underlying OpenID Provider
* The Solid-OIDC Broker exposed by ESS wrapped around an underlying OpenID Provider
*/
export class OpenIdPage {
page: Page;
Expand Down
Loading