forked from goauthentik/authentik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web: fix e2e tests to work with latest WebdriverIO and authentik 2024…
….8 (goauthentik#11105) * web: fix e2e tests to work with latest WebdriverIO and authentik 2024.8 - Adjust the ApplicationWizard "select provider type" typeslist to have the right OUIA tags when running - Add OUIA tags to TypeCreateWizard - Provide default values for `.jwksSources` when needed. - Upgrade E2E WebUI tests to use WebdriverIO 9. - Upgrade the linters to include `package.json` and `package-lock.json`. - Adjust a *lot* of the WebdriverIO selectors! - Provide a driver for the TypeCreate card-based radio interface. - Split `Bad Logins` into two separate files. Aside from the obvious, "because testing needs this" or "because there were warnings on the console when this was running," the real issue is that WebdriverIO 9 has changed the syntax and semantics of its ShadowDOM-piercing `$` mechanism. For Oauth2 and Proxy, the field `.jwksSources` may be undefined, but `undefined` is not a legal value for ak-dual-select's `selected` field. Provide a default or use `ifDefined()`. I chose to provide a default of `[]`. In the previous iteration, `$(">>>ak-search-select input")` would be sufficient for WebdriverIO to find an input inside a component. Now, it needs to be written as: `$("ak-search-select").$("input")`. And in rare cases, when you have a floating component that is separated from its invocation (such as Notification or SearchSelect), even that doesn't work well and you have to fall back to some old-school hacking (see `./tests/wdio/test/pageobjects/page.ts` for an example) to find some child elements. Also, the monadic nature of `$` seems to have faded a bit. `$` used to wrap all child invocations in promises, making the entire expression a single valid promise; it seems that it is now necessary to unwrap the promises yourself under some circumstances, resulting in a lot of `await (await (await ... )))` blocks in the tests. We've slightly changed the semantics of our login mechanism, and now the default behavior is to not reveal when a username is invalid, but to treat the entire login as a single failure mechanism, so as not to expose any details about the username database. The problem arises that now, we (or Chrome) cache the username between roundtrips, and WebdriverIO's second pass was becoming confused by its presence. By putting the Bad Logins into two separate files, I get two separate browser instances with cleared caches, so each test can be run in the pristine environment it needs to validate the behavior I'm expecting. * web: added comment to explain the hack * Add comment to TypeCreateWizardPage to explain the component name hack. * web: fix some lint found by CI/CD
- Loading branch information
1 parent
59fa449
commit 9c45ec1
Showing
25 changed files
with
2,572 additions
and
2,236 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
import Page from "../pageobjects/page.js"; | ||
import { browser } from "@wdio/globals"; | ||
|
||
const CLICK_TIME_DELAY = 250; | ||
|
||
export default class AdminPage extends Page { | ||
public get pageHeader() { | ||
return $('>>>ak-page-header slot[name="header"]'); | ||
public async pageHeader() { | ||
return await $("ak-page-header").$('slot[name="header"]'); | ||
} | ||
|
||
async openApplicationsListPage() { | ||
await this.open("if/admin/#/core/applications"); | ||
} | ||
|
||
public open(path: string) { | ||
return browser.url(`http://localhost:9000/${path}`); | ||
} | ||
|
||
public pause(selector?: string) { | ||
if (selector) { | ||
return $(selector).waitForDisplayed(); | ||
} | ||
return browser.pause(CLICK_TIME_DELAY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.