Skip to content

Commit

Permalink
Fix formatting issues in code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Apr 25, 2024
1 parent 7523c3a commit f47b53c
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 63 deletions.
2 changes: 1 addition & 1 deletion CommonUI/src/Components/CategoryCheckbox/Category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface CategoryProps {
onChange: (value: Array<CategoryCheckboxValue>) => void;
initialValue?: undefined | Array<CategoryCheckboxValue>;
isLastCategory: boolean;
dataTestId?: string | undefined;
dataTestId?: string | undefined;
}

enum CategoryCheckboxValueState {
Expand Down
1 change: 0 additions & 1 deletion CommonUI/src/Components/RadioButtons/GroupRadioButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface RadioButton {
value: string;
sideTitle?: string | undefined;
sideDescription?: string | undefined;

}

export interface ComponentProps {
Expand Down
2 changes: 1 addition & 1 deletion CommonUI/src/Components/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const TextArea: FunctionComponent<ComponentProps> = (
<textarea
autoFocus={props.autoFocus}
placeholder={props.placeholder}
data-testid={props.dataTestId}
data-testid={props.dataTestId}
className={`${className || ''}`}
value={text}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion Dashboard/src/Pages/Onboarding/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Welcome: FunctionComponent<ComponentProps> = (
onClick={() => {
props.onClickShowProjectModal();
}}
dataTestId='create-new-project-button'
dataTestId="create-new-project-button"
/>
}
/>
Expand Down
10 changes: 6 additions & 4 deletions E2E/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const HTTP_PROTOCOL: Protocol =

export const BASE_URL: URL = URL.fromString(`${HTTP_PROTOCOL}${HOST}`);

export const IS_USER_REGISTERED: boolean = env('E2E_TEST_IS_USER_REGISTERED') === 'true';
export const REGISTERED_USER_EMAIL: string = env('E2E_TEST_REGISTERED_USER_EMAIL') || '';
export const REGISTERED_USER_PASSWORD: string = env('E2E_TEST_REGISTERED_USER_PASSWORD') || '';

export const IS_USER_REGISTERED: boolean =
env('E2E_TEST_IS_USER_REGISTERED') === 'true';
export const REGISTERED_USER_EMAIL: string =
env('E2E_TEST_REGISTERED_USER_EMAIL') || '';
export const REGISTERED_USER_PASSWORD: string =
env('E2E_TEST_REGISTERED_USER_PASSWORD') || '';
68 changes: 38 additions & 30 deletions E2E/Tests/Accounts/Register.spec.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
import { test, expect } from '@playwright/test';
import { test, expect, Page } from '@playwright/test';
import { BASE_URL, IS_USER_REGISTERED } from '../../Config';
import Faker from 'Common/Utils/Faker';
import URL from 'Common/Types/API/URL';
test.describe('Account Registration', () => {
test('should register a new account', async ({ page }) => {
test('should register a new account', async ({ page }: { page: Page }) => {
if (IS_USER_REGISTERED) {
// pass this test if user is already registered
return;
}

if(IS_USER_REGISTERED) {
// pass this test if user is already registered
return;
}
await page.goto(
URL.fromString(BASE_URL.toString())
.addRoute('/accounts/register')
.toString()
);
await page.getByTestId('email').click();
await page.getByTestId('email').fill(Faker.generateEmail().toString());
await page.getByTestId('email').press('Tab');
await page.getByTestId('name').fill('sample');
await page.getByTestId('name').press('Tab');
await page.getByTestId('companyName').fill('sample');
await page.getByTestId('companyName').press('Tab');
await page.getByTestId('companyPhoneNumber').fill('+15853641376');
await page.getByTestId('companyPhoneNumber').press('Tab');
await page.getByTestId('password').fill('sample');
await page.getByTestId('password').press('Tab');
await page.getByTestId('confirmPassword').fill('sample');
await page.getByTestId('Sign Up').click();

// wait for navigation with base url
await page.waitForURL(
URL.fromString(BASE_URL.toString())
.addRoute('/dashboard/welcome')
.toString()
);
expect(page.url()).toBe(
URL.fromString(BASE_URL.toString())
.addRoute('/dashboard/welcome')
.toString()
);

await page.goto(URL.fromString(BASE_URL.toString()).addRoute('/accounts/register').toString());
await page.getByTestId('email').click();
await page.getByTestId('email').fill(Faker.generateEmail().toString());
await page.getByTestId('email').press('Tab');
await page.getByTestId('name').fill('sample');
await page.getByTestId('name').press('Tab');
await page.getByTestId('companyName').fill('sample');
await page.getByTestId('companyName').press('Tab');
await page.getByTestId('companyPhoneNumber').fill('+15853641376');
await page.getByTestId('companyPhoneNumber').press('Tab');
await page.getByTestId('password').fill('sample');
await page.getByTestId('password').press('Tab');
await page.getByTestId('confirmPassword').fill('sample');
await page.getByTestId('Sign Up').click();

// wait for navigation with base url
await page.waitForURL(URL.fromString(BASE_URL.toString()).addRoute('/dashboard/welcome').toString());
expect(page.url()).toBe(URL.fromString(BASE_URL.toString()).addRoute('/dashboard/welcome').toString());

await page.getByTestId('create-new-project-button').click();

});

})
await page.getByTestId('create-new-project-button').click();
});
});
34 changes: 22 additions & 12 deletions E2E/Tests/App/StatusCheck.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
import { test, expect } from '@playwright/test';
import { test, expect, Page } from '@playwright/test';
import { BASE_URL } from '../../Config';
import URL from 'Common/Types/API/URL';


test.describe('check live and health check of the app', () => {

test('check if app status is ok', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/status").toString()}`);
const content = await page.content();
test('check if app status is ok', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/status')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});

test('check if app is ready', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/status/ready").toString()}`);
const content = await page.content();
test('check if app is ready', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/status/ready')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});

test('check if app is live', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/status/live").toString()}`);
const content = await page.content();
test('check if app is live', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/status/live')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});
});
4 changes: 3 additions & 1 deletion E2E/Tests/Home/Landing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ test.describe('check if pages loades with its title', () => {
.getByRole('link', { name: 'OneUptime', exact: true })
.click();

await expect(page).toHaveURL(URL.fromString(BASE_URL.toString()).toString());
await expect(page).toHaveURL(
URL.fromString(BASE_URL.toString()).toString()
);
});
});
4 changes: 3 additions & 1 deletion E2E/Tests/Home/SignUp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ test.beforeEach(async ({ page }: { page: Page }) => {
test('sign up button', async ({ page }: { page: Page }) => {
await page.getByTestId('Sign-up').click();
await expect(page).toHaveURL(
URL.fromString(BASE_URL.toString()).addRoute('/accounts/register').toString()
URL.fromString(BASE_URL.toString())
.addRoute('/accounts/register')
.toString()
);
});
33 changes: 22 additions & 11 deletions E2E/Tests/Ingestor/StatusCheck.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
import { test, expect } from '@playwright/test';
import { test, expect, Page } from '@playwright/test';
import { BASE_URL } from '../../Config';
import URL from 'Common/Types/API/URL';

test.describe('check live and health check of the app', () => {

test('check if app status is ok', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/ingestor/status").toString()}`);
const content = await page.content();
test('check if app status is ok', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/ingestor/status')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});

test('check if app is ready', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/ingestor/status/ready").toString()}`);
const content = await page.content();
test('check if app is ready', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/ingestor/status/ready')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});

test('check if app is live', async ({ page }) => {
await page.goto(`${URL.fromString(BASE_URL.toString()).addRoute("/ingestor/status/live").toString()}`);
const content = await page.content();
test('check if app is live', async ({ page }: { page: Page }) => {
await page.goto(
`${URL.fromString(BASE_URL.toString())
.addRoute('/ingestor/status/live')
.toString()}`
);
const content: string = await page.content();
expect(content).toContain('{"status":"ok"}');
});
});
6 changes: 6 additions & 0 deletions HelmChart/Public/oneuptime/templates/e2e-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ spec:
image: {{ printf "%s/%s/%s:%s" $.Values.image.registry $.Values.image.repository "e2e" $.Values.image.tag }}
env:
{{- include "oneuptime.env.common" . | nindent 14 }}
- name: E2E_TEST_IS_USER_REGISTERED
value: {{ $.Values.cronJobs.e2e.isUserRegistered }}
- name: E2E_TEST_REGISERED_USER_EMAIL
value: {{ $.Values.cronJobs.e2e.registeredUserEmail }}
- name: E2E_TEST_REGISERED_USER_PASSWORD
value: {{ $.Values.cronJobs.e2e.registeredUserPassword }}
restartPolicy: Never

{{- end }}

0 comments on commit f47b53c

Please sign in to comment.