forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:harshit078/twenty
- Loading branch information
Showing
262 changed files
with
4,912 additions
and
10,890 deletions.
There are no files selected for viewing
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
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
36
packages/twenty-e2e-testing/lib/pom/helper/confirmationModal.ts
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 |
---|---|---|
@@ -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
28
packages/twenty-e2e-testing/lib/pom/helper/formatDate.function.ts
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 |
---|---|---|
@@ -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' }), | ||
); | ||
} |
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 |
---|---|---|
@@ -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?) | ||
} |
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 |
---|---|---|
@@ -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(); | ||
} | ||
} |
Oops, something went wrong.