mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(console): add isDevFeaturesEnabled env const (#4506)
This commit is contained in:
parent
08a0a6748b
commit
fb100ce0f0
5 changed files with 15 additions and 11 deletions
3
.github/workflows/integration-test.yml
vendored
3
.github/workflows/integration-test.yml
vendored
|
@ -15,6 +15,9 @@ jobs:
|
||||||
package:
|
package:
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2204
|
runs-on: buildjet-4vcpu-ubuntu-2204
|
||||||
|
|
||||||
|
env:
|
||||||
|
INTEGRATION_TEST: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,6 @@ import { yes } from '@silverhand/essentials';
|
||||||
export const isProduction = process.env.NODE_ENV === 'production';
|
export const isProduction = process.env.NODE_ENV === 'production';
|
||||||
export const isCloud = yes(process.env.IS_CLOUD);
|
export const isCloud = yes(process.env.IS_CLOUD);
|
||||||
export const adminEndpoint = process.env.ADMIN_ENDPOINT;
|
export const adminEndpoint = process.env.ADMIN_ENDPOINT;
|
||||||
|
// eslint-disable-next-line unicorn/prevent-abbreviations -- we love dev
|
||||||
|
export const isDevFeaturesEnabled =
|
||||||
|
yes(process.env.DEV_FEATURES_ENABLED) || yes(process.env.INTEGRATION_TEST);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import useSWR from 'swr';
|
||||||
import RequestDataError from '@/components/RequestDataError';
|
import RequestDataError from '@/components/RequestDataError';
|
||||||
import SubmitFormChangesActionBar from '@/components/SubmitFormChangesActionBar';
|
import SubmitFormChangesActionBar from '@/components/SubmitFormChangesActionBar';
|
||||||
import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal';
|
import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal';
|
||||||
import { isCloud } from '@/consts/env';
|
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||||
import CardTitle from '@/ds-components/CardTitle';
|
import CardTitle from '@/ds-components/CardTitle';
|
||||||
import ConfirmModal from '@/ds-components/ConfirmModal';
|
import ConfirmModal from '@/ds-components/ConfirmModal';
|
||||||
import TabNav, { TabNavItem } from '@/ds-components/TabNav';
|
import TabNav, { TabNavItem } from '@/ds-components/TabNav';
|
||||||
|
@ -218,8 +218,7 @@ function SignInExperience() {
|
||||||
<PageTab href="../content" errorCount={getContentErrorCount(errors)}>
|
<PageTab href="../content" errorCount={getContentErrorCount(errors)}>
|
||||||
{t('sign_in_exp.tabs.content')}
|
{t('sign_in_exp.tabs.content')}
|
||||||
</PageTab>
|
</PageTab>
|
||||||
{/* Remove the `isCloud` check until all the changes are merged */}
|
{isDevFeaturesEnabled && (
|
||||||
{isCloud && (
|
|
||||||
<PageTab href="../password-policy">{t('sign_in_exp.tabs.password_policy')}</PageTab>
|
<PageTab href="../password-policy">{t('sign_in_exp.tabs.password_policy')}</PageTab>
|
||||||
)}
|
)}
|
||||||
</TabNav>
|
</TabNav>
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import ExpectConsole from '#src/ui-helpers/expect-console.js';
|
import ExpectConsole from '#src/ui-helpers/expect-console.js';
|
||||||
import { getInputValue } from '#src/ui-helpers/index.js';
|
import { getInputValue } from '#src/ui-helpers/index.js';
|
||||||
|
|
||||||
const expectConsole = new ExpectConsole(await browser.newPage(), { tenantId: 'default' });
|
const expectConsole = new ExpectConsole(await browser.newPage());
|
||||||
|
|
||||||
// Skip this test suite since it's not public yet
|
describe('sign-in experience: password policy', () => {
|
||||||
describe.skip('sign-in experience: password policy', () => {
|
it('navigates to sign-in experience page', async () => {
|
||||||
it('navigate to sign-in experience page', async () => {
|
|
||||||
await expectConsole.start();
|
await expectConsole.start();
|
||||||
await expectConsole.gotoPage('/sign-in-experience', 'Sign-in experience');
|
await expectConsole.gotoPage('/sign-in-experience', 'Sign-in experience');
|
||||||
await expectConsole.toClickTab('Password policy');
|
await expectConsole.toClickTab('Password policy');
|
||||||
|
|
|
@ -53,7 +53,7 @@ export default class ExpectConsole extends ExpectPage {
|
||||||
async gotoPage(pathname: string, title: ConsoleTitle) {
|
async gotoPage(pathname: string, title: ConsoleTitle) {
|
||||||
await this.navigateTo(this.buildUrl(path.join(this.options.tenantId, pathname)));
|
await this.navigateTo(this.buildUrl(path.join(this.options.tenantId, pathname)));
|
||||||
await expect(this.page).toMatchElement(
|
await expect(this.page).toMatchElement(
|
||||||
'div[class$=main] div[class$=container] div[class$=cardTitle]',
|
'div[class*=_main] div[class*=_container] div[class*=_cardTitle]',
|
||||||
{ text: title }
|
{ text: title }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ export default class ExpectConsole extends ExpectPage {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
titles.map(async (title) => {
|
titles.map(async (title) => {
|
||||||
return expect(this.page).toMatchElement(
|
return expect(this.page).toMatchElement(
|
||||||
'div[class$=tabContent] div[class$=card] div[class$=title]',
|
'div[class*=_tabContent] div[class*=_card] div[class*=_title]',
|
||||||
{ text: new RegExp(title, 'i'), visible: true }
|
{ text: new RegExp(title, 'i'), visible: true }
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
@ -78,7 +78,7 @@ export default class ExpectConsole extends ExpectPage {
|
||||||
const fieldTitle = await expect(this.page).toMatchElement(
|
const fieldTitle = await expect(this.page).toMatchElement(
|
||||||
// Use `:has()` for a quick and dirty way to match the field title.
|
// Use `:has()` for a quick and dirty way to match the field title.
|
||||||
// Not harmful in most cases.
|
// Not harmful in most cases.
|
||||||
'div[class$=field]:has(div[class$=title])',
|
'div[class*=_field]:has(div[class*=_title])',
|
||||||
{
|
{
|
||||||
text: new RegExp(title, 'i'),
|
text: new RegExp(title, 'i'),
|
||||||
visible: true,
|
visible: true,
|
||||||
|
@ -100,7 +100,7 @@ export default class ExpectConsole extends ExpectPage {
|
||||||
* Click a `<nav>` navigation tab (not the page tab) in the Console.
|
* Click a `<nav>` navigation tab (not the page tab) in the Console.
|
||||||
*/
|
*/
|
||||||
async toClickTab(tabName: string | RegExp) {
|
async toClickTab(tabName: string | RegExp) {
|
||||||
await expect(this.page).toClick(`nav div[class$=item] div[class$=link] a`, { text: tabName });
|
await expect(this.page).toClick(`nav div[class*=_item] div[class*=_link] a`, { text: tabName });
|
||||||
}
|
}
|
||||||
|
|
||||||
async toSaveChanges(confirmation?: string | RegExp) {
|
async toSaveChanges(confirmation?: string | RegExp) {
|
||||||
|
|
Loading…
Reference in a new issue