Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/record-group-table
Browse files Browse the repository at this point in the history
  • Loading branch information
magrinj committed Nov 12, 2024
2 parents 6c75d8c + aadcb49 commit a79f9ab
Show file tree
Hide file tree
Showing 439 changed files with 8,616 additions and 12,441 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cd-deploy-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
jobs:
deploy-main:
timeout-minutes: 3
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cd-deploy-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- 'v*'
jobs:
deploy-tag:
timeout-minutes: 3
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-chrome-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:

jobs:
chrome-extension-build:
timeout-minutes: 15
runs-on: ubuntu-latest
env:
VITE_SERVER_BASE_URL: http://localhost:3000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
name: Playwright Tests
name: CI E2E Tests
on:
push:
branches: [ main, master ]
branches:
- main
pull_request:
branches: [ main, master ]
branches:
- '**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 60
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Check for changed files
id: changed-files
uses: tj-actions/changed-files@v11
with:
files: |
packages/** # Adjust this to your relevant directories
playwright.config.ts # Include any relevant config files
id: changed-files
uses: tj-actions/changed-files@v11
with:
files: |
packages/**
playwright.config.ts

- name: Skip if no relevant changes
if: steps.changed-files.outputs.any_changed != 'true'
run: echo "No relevant changes detected. Marking as valid."
if: steps.changed-files.outputs.any_changed == 'false'
run: echo "No relevant changes detected. Marking as valid."

- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: npm install -g yarn && yarn
uses: ./.github/workflows/actions/yarn-install
- name: Install Playwright Browsers
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn playwright install --with-deps
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:

jobs:
front-sb-build:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
Expand Down Expand Up @@ -58,8 +59,8 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx storybook:build twenty-front
front-sb-test:
timeout-minutes: 30
runs-on: shipfox-8vcpu-ubuntu-2204
timeout-minutes: 60
needs: front-sb-build
strategy:
matrix:
Expand Down Expand Up @@ -101,8 +102,8 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx storybook:serve-and-test:static twenty-front --configuration=${{ matrix.storybook_scope }}
front-sb-test-performance:
timeout-minutes: 30
runs-on: shipfox-8vcpu-ubuntu-2204
timeout-minutes: 60
env:
REACT_APP_SERVER_BASE_URL: http://localhost:3000
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
Expand Down Expand Up @@ -135,6 +136,7 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx run twenty-front:storybook:serve-and-test:static:performance
front-chromatic-deployment:
timeout-minutes: 30
if: contains(github.event.pull_request.labels.*.name, 'run-chromatic') || github.event_name == 'push'
needs: front-sb-build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -177,6 +179,7 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx run twenty-front:chromatic:ci
front-task:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-release-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
create_pr:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-release-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
tag_and_release:
timeout-minutes: 10
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
steps:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:

jobs:
server-setup:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
Expand Down Expand Up @@ -67,6 +68,7 @@ jobs:
run: npx nx run twenty-server:worker:ci

server-test:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: server-setup
env:
Expand Down Expand Up @@ -102,6 +104,7 @@ jobs:
tasks: test

server-integration-test:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: server-setup
services:
Expand Down Expand Up @@ -146,7 +149,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
1 change: 1 addition & 0 deletions .github/workflows/ci-test-docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ concurrency:

jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-tinybird.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ concurrency:

jobs:
ci:
timeout-minutes: 10
runs-on: ubuntu-latest
uses: tinybirdco/ci/.github/workflows/ci.yml@main
steps:
- name: Check for changed files
id: changed-files
Expand All @@ -27,7 +29,6 @@ jobs:
run: echo "No relevant changes. Skipping CI."

- name: Check twenty-tinybird package
uses: tinybirdco/ci/.github/workflows/ci.yml@main
with:
data_project_dir: packages/twenty-tinybird
tb_admin_token: ${{ secrets.TB_ADMIN_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ concurrency:

jobs:
danger-js:
timeout-minutes: 3
runs-on: ubuntu-latest
if: github.event.action != 'closed'
steps:
Expand All @@ -31,6 +32,7 @@ jobs:
DANGER_GITHUB_API_TOKEN: ${{ github.token }}

congratulate:
timeout-minutes: 3
runs-on: ubuntu-latest
if: github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ concurrency:

jobs:
website-build:
timeout-minutes: 3
runs-on: ubuntu-latest
services:
postgres:
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 a79f9ab

Please sign in to comment.