Skip to content

Commit

Permalink
Merge branch 'next' into update-containized-env
Browse files Browse the repository at this point in the history
  • Loading branch information
Cliftonz authored Jun 3, 2024
2 parents 4242489 + e246a75 commit 590a4d2
Show file tree
Hide file tree
Showing 110 changed files with 4,732 additions and 1,896 deletions.
16 changes: 14 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"adresses",
"africas",
"africastalking",
"alanturing",
"alexjoverm",
"alist",
"aliyun",
Expand Down Expand Up @@ -64,6 +65,7 @@
"bzrignore",
"cacheable",
"cafebabe",
"callout",
"canonicalization",
"canonicalized",
"chartjs",
Expand Down Expand Up @@ -205,6 +207,7 @@
"Hewgill",
"HEXTET",
"hextets",
"hgcheck",
"hgignore",
"hmac",
"hokify",
Expand Down Expand Up @@ -301,6 +304,7 @@
"MITM",
"MJML",
"mkdir",
"mkdocs",
"mlen",
"moby",
"modlen",
Expand Down Expand Up @@ -352,6 +356,7 @@
"novuhq",
"novui",
"novutest",
"npmignore",
"npmjs",
"npmrc",
"nrwl",
Expand All @@ -369,6 +374,7 @@
"opcodemap",
"opcodestr",
"openapi",
"OPENCOLLECTIVE",
"opentelemetry",
"orcid",
"Otel",
Expand All @@ -385,6 +391,7 @@
"permerrors",
"personalizations",
"PGID",
"picocolors",
"pino",
"PKCS",
"pkdata",
Expand All @@ -400,6 +407,7 @@
"prefixlen",
"preheader",
"prepopulating",
"prepush",
"presigner",
"prettierignore",
"printjson",
Expand Down Expand Up @@ -445,6 +453,7 @@
"Relabelings",
"releasewards",
"RELEASLY",
"relocator",
"replayable",
"replstate",
"reshard",
Expand All @@ -471,6 +480,7 @@
"scopsy",
"Scriptable",
"Segoe",
"sema",
"sendchamp",
"Sendchamp",
"sendgrid",
Expand Down Expand Up @@ -563,6 +573,7 @@
"TRANSID",
"transpiled",
"trunc",
"tsbuildinfo",
"TSIG",
"tspan",
"tsup",
Expand All @@ -587,6 +598,7 @@
"Usergroup",
"userid",
"uuidv",
"vercel",
"verifyspf",
"Vonage",
"WaitList",
Expand All @@ -598,8 +610,7 @@
"whatsappbusiness",
"xkeysib",
"zulip",
"zwnj",
"prepush"
"zwnj"
],
"flagWords": [],
"patterns": [
Expand Down Expand Up @@ -675,6 +686,7 @@
"packages/application-generic/src/.env.test",
"packages/notification-center/src/i18n/languages/**",
"packages/notification-center/rollup.config.mjs",
"packages/js/tsup.config.ts",
"apps/widget/public/iframeResizer.contentWindow.js",
".eslintrc.js",
".vscode/settings.json",
Expand Down
1 change: 0 additions & 1 deletion .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ runs:
shell: bash
run: pnpm install --frozen-lockfile


- name: Link submodules
shell: bash
if: ${{ inputs.submodules == 'true' }}
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ on:
jobs:
# This workflow contains a single job called "build"
e2e_web:
if: "!contains(github.event.head_commit.message, 'ci skip')"

strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
fail-fast: true
matrix:
# run 5 copies of the current job in parallel
containers: [1, 2, 3, 4, 5]
Expand Down
71 changes: 34 additions & 37 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,8 @@ jobs:
echo "test-libs=$(pnpm run get-affected test origin/${{steps.get-base-branch-name.outputs.branch}} libs | tail -n +5)" >> $GITHUB_OUTPUT
fi
test_web:
name: Test Web Playwright
needs: [get-affected]
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
ee: true

test_widget:
name: Test Widget Cypress
needs: [get-affected]
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
secrets: inherit

test_providers:
name: Unit Test Providers
test_unit_providers:
name: Unit test @novu/providers
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-providers)[0] }}
Expand All @@ -153,8 +133,8 @@ jobs:
parallel: 5
projects: ${{join(fromJson(needs.get-affected.outputs.test-providers), ',')}}

test_packages:
name: Unit Test Packages
test_unit_packages:
name: Unit test @novu/* public NPM packages (except providers)
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-packages)[0] }}
Expand All @@ -165,20 +145,15 @@ jobs:
deployments: write
id-token: write
steps:
- name: Display Test Packages
- name: Affected packages
run: echo '${{ needs.get-affected.outputs.test-packages }}'

- name: Checkout Code
uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Setup Project
uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-project
with:
slim: 'true'

- name: Setup Redis Cluster
uses: ./.github/actions/setup-redis-cluster

- name: Run Lint, Build, Test
uses: mansagroup/nrwl-nx-action@v3
env:
Expand All @@ -187,25 +162,28 @@ jobs:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-packages), ',')}}

test_libs:
name: Unit Test Libs
test_unit_libs:
name: Unit test internal novu lib packages
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-libs)[0] }}
timeout-minutes: 80
steps:
- run: echo '${{ needs.get-affected.outputs.test-libs }}'
- name: Affected libs
run: echo '${{ needs.get-affected.outputs.test-libs }}'
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-project
- uses: mansagroup/nrwl-nx-action@v3

- name: Run Lint, Build, Test
uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-libs), ',')}}

test_unit_api:
name: Test API
needs: [get-affected]
if: contains(github.event.pull_request.labels.*.name, 'run-e2e')
strategy:
# The order is important for ee to be first, otherwise outputs not work correctly
matrix:
Expand All @@ -218,6 +196,7 @@ jobs:
job-name: ${{ matrix.name }}
secrets: inherit

# TODO: Merge this step with test_unit_api
test_unit:
name: Unit Test
runs-on: ubuntu-latest
Expand Down Expand Up @@ -267,3 +246,21 @@ jobs:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}

- uses: ./.github/actions/validate-openapi

test_e2e_web:
name: Test E2E Web
needs: [get-affected]
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
ee: true

test_e2e_widget:
name: Test E2E Widget
needs: [get-affected]
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
secrets: inherit
2 changes: 1 addition & 1 deletion apps/api/src/app/events/dtos/trigger-event-request.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class TriggerEventRequestDto {

@ApiProperty({
description: `It is used to specify a tenant context during trigger event.
If a new tenant object is provided, we will create a new tenant.
Existing tenants will be updated with the provided details.
`,
oneOf: [
{ type: 'string', description: 'Unique identifier of a tenant in your system' },
Expand Down
3 changes: 2 additions & 1 deletion apps/api/src/app/widgets/dtos/message-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EmailBlockTypeEnum,
MessageActionStatusEnum,
TextAlignEnum,
INotificationDto,
} from '@novu/shared';
import { SubscriberResponseDto } from '../../subscribers/dtos';
import { WorkflowResponse } from '../../workflows/dto/workflow-response.dto';
Expand Down Expand Up @@ -85,7 +86,7 @@ class MessageCTA {
}

@ApiExtraModels(EmailBlock, MessageCTA)
export class MessageResponseDto {
export class MessageResponseDto implements INotificationDto {
@ApiPropertyOptional()
_id?: string;

Expand Down
2 changes: 1 addition & 1 deletion apps/web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: 2,
retries: 3,
/* Use 4 workers in CI, 50% of CPU count in local */
workers: process.env.CI ? 4 : '25%',
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
Expand Down
45 changes: 6 additions & 39 deletions apps/web/tests/activities-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createNotifications, SessionData } from './utils.ts/plugins';
import { FeatureFlagsMock } from './utils.ts/featureFlagsMock';

let featureFlagsMock: FeatureFlagsMock, session: SessionData;

test.beforeEach(async ({ page }) => {
({ featureFlagsMock, session } = await initializeSession(page));
featureFlagsMock.setFlagsToMock({
Expand All @@ -16,69 +17,35 @@ test.beforeEach(async ({ page }) => {
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('displays and filter activity feed', async ({ page }) => {
await createNotifications({
identifier: session.templates[0].triggers[0].identifier,
token: session.token,
count: 2,
count: 25,
organizationId: session.organization._id,
environmentId: session.environment._id,
});
});

test.skip('TODO - should be able to add a new channel', async ({ page }) => {
await page.goto('/activities');
const activitiesPage = await ActivitiesPage.goTo(page);
await expect(page).toHaveURL(/\/activities/);

const addChannelButton = page.getByTestId('activity-stats-weekly-sent');
await expect(addChannelButton).toContainText('25');
});

test.skip('TODO - Contains expected UI elements', async ({ page }) => {
const activitiesPage = await ActivitiesPage.goTo(page);
const locator = activitiesPage.getActivityRowElements().first();
await expect(locator).toContainText(session.templates[0].name);
await activitiesPage.assertContainsExpectedUIElements();
});

test.skip('TODO - when not having SMS activities, filtering by SMS should show empty result set', async ({ page }) => {
const activitiesPage = await ActivitiesPage.goTo(page);
await expect(activitiesPage.getEmailStep()).toHaveCount(10);
await activitiesPage.filterChannelSearchBy(FILTER_TERM.SMS);
await activitiesPage.submitFilters();
await expect(activitiesPage.getEmailStep()).toHaveCount(0);
});

test.skip('TODO - shows clear filters button when filters are present', async ({ page }) => {
const activitiesPage = await ActivitiesPage.goTo(page);
await activitiesPage.filterChannelSearchBy(FILTER_TERM.SMS);
await activitiesPage.assertHasClearFiltersButtonEnabled();
});

test.skip('TODO - should clear filters when clicking clear filters button', async ({ page }) => {
const activitiesPage = await ActivitiesPage.goTo(page);
await activitiesPage.filterChannelSearchBy(FILTER_TERM.SMS);
await activitiesPage.filterByFirstWorkflow();
await activitiesPage.filterByTransaction('some value');
await activitiesPage.filterBySubscriber('some value');
await activitiesPage.clearFiltersButton().click();
await activitiesPage.assertHasNoFilterValues();
});

// it('should show errors and warning', function () {
// cy.intercept(/.*notifications\?page.*/, (r) => {
// r.continue((res) => {
// if (!res.body?.data) return;
// res.body.data[0].jobs[0].status = JobStatusEnum.FAILED;
// res.send({ body: res.body });
// });
// });
// cy.visit('/activities');
// cy.waitForNetworkIdle(500);
// cy.getByTestId('activities-table')
// .find('button')
// .first()
// .getByTestId('status-badge-item')
// .eq(0)
// .should('have.css', 'color')
// .and('eq', 'rgb(229, 69, 69)');
// });
Loading

0 comments on commit 590a4d2

Please sign in to comment.