Skip to content

Commit

Permalink
Merge branch 'main' of github.com:harshit078/twenty
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit078 committed Nov 12, 2024
2 parents ade1af4 + f9c076d commit 317fcdc
Show file tree
Hide file tree
Showing 262 changed files with 4,912 additions and 10,890 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
uses: ./.github/workflows/actions/nx-affected
with:
tag: scope:backend
tasks: "test:integration"
tasks: "test:integration:with-db-reset"
- name: Server / Upload reset-logs file
if: always()
uses: actions/upload-artifact@v4
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@linaria/core": "^6.2.0",
"@linaria/react": "^6.2.1",
"@mdx-js/react": "^3.0.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@nestjs/apollo": "^11.0.5",
"@nestjs/axios": "^3.0.1",
"@nestjs/cli": "^9.0.0",
Expand Down Expand Up @@ -201,6 +202,7 @@
"@graphql-codegen/typescript": "^3.0.4",
"@graphql-codegen/typescript-operations": "^3.0.4",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
"@microsoft/microsoft-graph-types": "^2.40.0",
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
Expand Down Expand Up @@ -350,7 +352,7 @@
"version": "0.2.1",
"nx": {},
"scripts": {
"start": "npx nx run-many -t start worker -p twenty-server twenty-front"
"start": "npx concurrently --kill-others 'npx nx run-many -t start -p twenty-server twenty-front' 'npx wait-on tcp:3000 && npx nx run twenty-server:worker'"
},
"workspaces": {
"packages": [
Expand Down
22 changes: 22 additions & 0 deletions packages/twenty-e2e-testing/drivers/env_variables.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as fs from 'fs';
import path from 'path';

export const envVariables = (variables: string) => {
let payload = `
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default
FRONT_BASE_URL=http://localhost:3001
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
LOGIN_TOKEN_SECRET=replace_me_with_a_random_string_login
REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
REDIS_URL=redis://localhost:6379
`;
payload = payload.concat(variables);
fs.writeFile(
path.join(__dirname, '..', '..', 'twenty-server', '.env'),
payload,
(err) => {
throw err;
},
);
};
36 changes: 36 additions & 0 deletions packages/twenty-e2e-testing/lib/pom/helper/confirmationModal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Locator, Page } from '@playwright/test';

export class ConfirmationModal {
private readonly input: Locator;
private readonly cancelButton: Locator;
private readonly confirmButton: Locator;

constructor(public readonly page: Page) {
this.page = page;
this.input = page.getByTestId('confirmation-modal-input');
this.cancelButton = page.getByRole('button', { name: 'Cancel' });
this.confirmButton = page.getByTestId('confirmation-modal-confirm-button');
}

async typePlaceholderToInput() {
await this.page
.getByTestId('confirmation-modal-input')
.fill(
await this.page
.getByTestId('confirmation-modal-input')
.getAttribute('placeholder'),
);
}

async typePhraseToInput(value: string) {
await this.page.getByTestId('confirmation-modal-input').fill(value);
}

async clickCancelButton() {
await this.page.getByRole('button', { name: 'Cancel' }).click();
}

async clickConfirmButton() {
await this.page.getByTestId('confirmation-modal-confirm-button').click();
}
}
28 changes: 28 additions & 0 deletions packages/twenty-e2e-testing/lib/pom/helper/formatDate.function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const nth = (d: number) => {
if (d > 3 && d < 21) return 'th';
switch (d % 10) {
case 1:
return 'st';
case 2:
return 'nd';
case 3:
return 'rd';
default:
return 'th';
}
};

// label looks like this: Choose Wednesday, October 30th, 2024
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
export function formatDate(value: string): string {
const date = new Date(value);
return 'Choose '.concat(
date.toLocaleDateString('en-US', { weekday: 'long' }),
', ',
date.toLocaleDateString('en-US', { month: 'long' }),
' ',
nth(date.getDate()),
', ',
date.toLocaleDateString('en-US', { year: 'numeric' }),
);
}
6 changes: 6 additions & 0 deletions packages/twenty-e2e-testing/lib/pom/helper/googleLogin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Locator, Page } from '@playwright/test';

export class GoogleLogin {
// TODO: map all things like inputs and buttons
// (what's the correct way for proceeding with Google interaction? log in each time test is performed?)
}
23 changes: 23 additions & 0 deletions packages/twenty-e2e-testing/lib/pom/helper/iconSelect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Locator, Page } from '@playwright/test';

export class IconSelect {
private readonly iconSelectButton: Locator;
private readonly iconSearchInput: Locator;

constructor(public readonly page: Page) {
this.iconSelectButton = page.getByLabel('Click to select icon (');
this.iconSearchInput = page.getByPlaceholder('Search icon');
}

async selectIcon(name: string) {
await this.iconSelectButton.click();
await this.iconSearchInput.fill(name);
await this.page.getByTitle(name).click();
}

async selectRelationIcon(name: string) {
await this.iconSelectButton.nth(1).click();
await this.iconSearchInput.fill(name);
await this.page.getByTitle(name).click();
}
}
Loading

0 comments on commit 317fcdc

Please sign in to comment.