Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup test db #132

Merged
merged 8 commits into from
Feb 12, 2024
Merged

Setup test db #132

merged 8 commits into from
Feb 12, 2024

Conversation

tonioriol
Copy link
Contributor

@tonioriol tonioriol commented Feb 6, 2024

You'll need to:

  • Run docker compose down --volumes && docker compose up -d so the docker test db gets created.
  • Update the DATABASE_URL in the .env file. Copy the one from the .env.example.
  • Create an .env.test copying .env.test.example. The values are ok as they are in the .env.test.example.

Then you should be able to run npm test and the example test under /tests should run and pass. Maybe you'll need to run npx playwright update or similar, as it will ask you in the console so it updates the browsers.

@tonioriol tonioriol requested a review from leilabb February 6, 2024 20:39
@tonioriol tonioriol self-assigned this Feb 6, 2024
Copy link

render bot commented Feb 6, 2024

…action

Also adjust DATABASE_URL in env example
@tonioriol tonioriol force-pushed the setup-test-db branch 2 times, most recently from 8dc7e01 to 6b05863 Compare February 6, 2024 21:22
tests/test.ts Outdated
Comment on lines 9 to 22
test('should perform a test that touches the database', async ({ page }) => {
await page.goto('/signup')

await page.getByLabel('Name').fill('Test User')
await page.getByLabel('Email').fill('[email protected]')
await page.getByLabel('Password', { exact: true }).fill('password123')
await page.getByLabel('Confirm Password').fill('password123')

await page.getByText('Sign up').click()

console.log('INI-BEFORE')
console.log('INI-BEFORE')
console.log('INI-BEFORE')
console.log(await page.content())
console.log('END-BEFORE')
console.log('END-BEFORE')
console.log('END-BEFORE')

await page.waitForURL('/app/settings/teams')

console.log('INI-AFTER')
console.log('INI-AFTER')
console.log('INI-AFTER')
console.log(await page.content())
console.log('END-AFTER')
console.log('END-AFTER')
console.log('END-AFTER')

await expect(page).toHaveURL('/app/settings/teams')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you get this to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only locally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console logs can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally, I just left them because I didn't fix the issue in GH actions. So when/if erik tries it out has something to look at. But yep, they can be removed.

@leilabb
Copy link
Contributor

leilabb commented Feb 8, 2024

Then you should be able to run npm test and the example test under /tests should run and pass.
It should be "npx playwright test" right?

@tonioriol tonioriol merged commit 65bdb9a into dev Feb 12, 2024
1 check failed
@tonioriol tonioriol deleted the setup-test-db branch February 12, 2024 10:52
tonioriol added a commit that referenced this pull request Feb 22, 2024
* add test db in compose and gh actions

* add test db setup script

* move cleanDatabase to a helper file

* rm unused test

* adjustments to make it work

* remove header param from playwright and add NODE_ENV=test in gh test action

Also adjust DATABASE_URL in env example

* install browsers with deps

* fix seeds
tonioriol added a commit that referenced this pull request Mar 25, 2024
* add key perk to landing page (#107)

* add key perk to landing page

* fix spelling

* 98-clarify-copy-when-creating-a-team

* modify copy when creating a new team

* add missing env to gh action/workflow

---------

Co-authored-by: Toni Oriol <[email protected]>

* 104-change-the-word-fork-it-to-clone-including-icon

* Change 'fork' to 'clone' and change icon

* Change copy of modal after clicking 'Clone'

* replace fork with clone

* add missing env vars to example

* Create dependabot.yml

* Bump vite from 4.3.9 to 4.5.2 (#112)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.3.9 to 4.5.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update dependabot.yml

Include GitHub Actions version updates.

* Bump actions/checkout from 2 to 4 (#123)

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/setup-node from 2 to 4 (#122)

Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Upgrade to node 20

* Run tests on push to dev

* Bump axios, openai and postmark (#113)

* Bump axios, openai and postmark

Bumps [axios](https://github.com/axios/axios) to 1.6.5 and updates ancestor dependencies [axios](https://github.com/axios/axios), [openai](https://github.com/openai/openai-node) and [postmark](https://github.com/ActiveCampaign/postmark.js). These dependencies need to be updated together.


Updates `axios` from 0.25.0 to 1.6.5
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v0.25.0...v1.6.5)

Updates `openai` from 3.3.0 to 4.25.0
- [Release notes](https://github.com/openai/openai-node/releases)
- [Changelog](https://github.com/openai/openai-node/blob/master/CHANGELOG.md)
- [Commits](openai/openai-node@v3.3.0...v4.25.0)

Updates `postmark` from 3.0.19 to 4.0.2
- [Release notes](https://github.com/ActiveCampaign/postmark.js/releases)
- [Changelog](https://github.com/ActiveCampaign/postmark.js/blob/main/CHANGELOG.md)
- [Commits](ActiveCampaign/postmark.js@3.0.19...4.0.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
- dependency-name: openai
  dependency-type: direct:production
- dependency-name: postmark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* update to openai@4 fixes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Toni Oriol <[email protected]>

* 99 group chat history by monthyear (#111)

* add grouping to chats

* add last 30 days group

* add last year group

* refactor time functions

* change function name

* change func name

* add tests + new grouping function

* refactoring

* add grouping to all chats ever made

* add code fix

* change function name

* change type name

* refactor

* style code

* add tests

* catch future dates¨

* add final fixes

* Setup test db (#132)

* add test db in compose and gh actions

* add test db setup script

* move cleanDatabase to a helper file

* rm unused test

* adjustments to make it work

* remove header param from playwright and add NODE_ENV=test in gh test action

Also adjust DATABASE_URL in env example

* install browsers with deps

* fix seeds

* add local llm support with ollama

* add field validation wip

* finish ollama model implementation

* remove dupl code

* remove whitespace

* rm unused axios dept

* fix: seed file imports

* chore: update and organize deps

* fix: team validations

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Toni Oriol <[email protected]>
Co-authored-by: Erik Lindgren <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants