mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
test: add cloud test cases
This commit is contained in:
parent
8ce3a993a9
commit
6e5123891f
4 changed files with 42 additions and 9 deletions
|
@ -51,7 +51,7 @@ const Tenants = ({ data, onAdd }: Props) => {
|
|||
</a>
|
||||
))}
|
||||
<h3>Create a tenant</h3>
|
||||
<Button title={<DangerousRaw>Create New</DangerousRaw>} onClick={createTenant} />
|
||||
<Button title={<DangerousRaw>Create</DangerousRaw>} onClick={createTenant} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('smoke testing for cloud', () => {
|
|||
const logtoCloudUrl = new URL(logtoCloudUrlString);
|
||||
const adminTenantUrl = new URL(logtoConsoleUrl); // In dev mode, the console URL is actually for admin tenant
|
||||
|
||||
it('opens with app element and navigates to sign-in page', async () => {
|
||||
it('can open with app element and navigate to register page', async () => {
|
||||
await page.goto(logtoCloudUrl.href);
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0' });
|
||||
|
||||
|
@ -26,7 +26,7 @@ describe('smoke testing for cloud', () => {
|
|||
expect(page.url()).toBe(appendPathname('/register', adminTenantUrl).href);
|
||||
});
|
||||
|
||||
it('registers the first admin account', async () => {
|
||||
it('can register the first admin account', async () => {
|
||||
await expect(page).toClick('button', { text: 'Create account' });
|
||||
|
||||
await expect(page).toFill('input[name=identifier]', consoleUsername);
|
||||
|
@ -51,4 +51,37 @@ describe('smoke testing for cloud', () => {
|
|||
await expect(tenantsWrapper).toMatchElement('a:nth-of-type(1)', { text: 'default' });
|
||||
await expect(tenantsWrapper).toMatchElement('a:nth-of-type(2)', { text: 'admin' });
|
||||
});
|
||||
|
||||
it('can create another tenant', async () => {
|
||||
await expect(page).toClick('button', { text: 'Create' });
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
const tenants = await page.$$('div[class$=wrapper] > a');
|
||||
expect(tenants.length).toBe(3);
|
||||
});
|
||||
|
||||
it('can enter the tenant just created', async () => {
|
||||
const button = await page.waitForSelector('div[class$=wrapper] > a:last-of-type');
|
||||
const tenantId = await button.evaluate((element) => element.textContent);
|
||||
|
||||
await button.click();
|
||||
|
||||
// Wait for our beautiful logto to show up
|
||||
await page.waitForSelector('div[class$=topbar] > svg[viewbox][class$=logo]');
|
||||
expect(page.url()).toBe(new URL(`/${tenantId ?? ''}/onboard/welcome`, logtoCloudUrl).href);
|
||||
});
|
||||
|
||||
it('can sign out of admin console', async () => {
|
||||
await expect(page).toClick('div[class$=topbar] > div[class$=container]');
|
||||
|
||||
// Try awaiting for 500ms before clicking sign-out button
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
await expect(page).toClick(
|
||||
'.ReactModalPortal div[class$=dropdownContainer] div[class$=dropdownItem]:last-child'
|
||||
);
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0' });
|
||||
|
||||
expect(page.url()).toBe(new URL('sign-in', logtoConsoleUrl).href);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('smoke testing', () => {
|
|||
const consoleUsername = 'admin';
|
||||
const consolePassword = generatePassword();
|
||||
|
||||
it('opens with app element and navigates to welcome page', async () => {
|
||||
it('can open with app element and navigate to welcome page', async () => {
|
||||
await page.goto(logtoConsoleUrl.href);
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0' });
|
||||
|
||||
|
@ -26,7 +26,7 @@ describe('smoke testing', () => {
|
|||
expect(page.url()).toBe(new URL('console/welcome', logtoConsoleUrl).href);
|
||||
});
|
||||
|
||||
it('registers a new admin account and automatically signs in', async () => {
|
||||
it('can register a new admin account and automatically sign in', async () => {
|
||||
await expect(page).toClick('button', { text: 'Create account' });
|
||||
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0' });
|
||||
|
@ -49,7 +49,7 @@ describe('smoke testing', () => {
|
|||
expect(page.url()).toBe(new URL('console/get-started', logtoConsoleUrl).href);
|
||||
});
|
||||
|
||||
it('signs out of admin console', async () => {
|
||||
it('can sign out of admin console', async () => {
|
||||
await expect(page).toClick('div[class$=topbar] > div[class$=container]');
|
||||
|
||||
// Try awaiting for 500ms before clicking sign-out button
|
||||
|
@ -63,7 +63,7 @@ describe('smoke testing', () => {
|
|||
expect(page.url()).toBe(new URL('sign-in', logtoConsoleUrl).href);
|
||||
});
|
||||
|
||||
it('signs in to admin console', async () => {
|
||||
it('can sign in to admin console', async () => {
|
||||
await expect(page).toFillForm('form', {
|
||||
identifier: consoleUsername,
|
||||
password: consolePassword,
|
||||
|
@ -82,6 +82,6 @@ describe('smoke testing', () => {
|
|||
});
|
||||
|
||||
it('renders SVG correctly with viewbox property', async () => {
|
||||
await page.waitForSelector('div[class$=topbar] > svg[viewbox]');
|
||||
await page.waitForSelector('div[class$=topbar] > svg[viewbox][class$=logo]');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ const welcome = {
|
|||
title: 'Welcome to Admin Console',
|
||||
description:
|
||||
'Admin console is a web app to manage Logto without coding requirements. Let’s first create an account. With this account, you can manage Logto by yourself or on behalf of your company.',
|
||||
create_account: 'Create Account',
|
||||
create_account: 'Create account',
|
||||
};
|
||||
|
||||
export default welcome;
|
||||
|
|
Loading…
Reference in a new issue