Skip to content

Commit

Permalink
Adds Puppeteer Tests for Google, Proton, and Skiff
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansampson committed Jul 6, 2023
1 parent 732b32b commit 437ad63
Show file tree
Hide file tree
Showing 25 changed files with 2,438 additions and 373 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ calendar.pem
build/
node_modules/
dist/
.env
tmp/
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,33 @@ Build this extension:
npm install
npm run build

Go to "brave://extensions",
enable Developer Mode,
click on "Load unpacked",
navigate to the `dist` directory created by `npm run build`.
and click on 'Select`.

Now go to [Google Calendar](https://calendar.google.com/) and start the creation process for an appointment.
Towards the bottom of the pop-up window, you should see a button with the icon to add a meeting".
Extension files will be found in the `/dist` directory.

## Manual Testing

Go to `brave://extensions`, enable _Developer Mode_, click on _Load unpacked_, navigate to the `/dist` directory (created by running `npm run build`) and click _Select_.

Now go to a supported calendar (e.g. [Google Calendar](https://calendar.google.com/), [Proton Calendar](https://calendar.proton.me/), [Skiff Calendar](https://app.skiff.com/calendar/)) and begin the process of creating a new event. During the event-creation process, you should see an option to add a Brave Talk meeting.

## Automated Testing

Testing is done against live calendars. For this reason a `.env` file needs to be created in the root of the project directory, and given credentials for the calendar you wish to test. For example, if you would like to test Proton Calendar, your `.env` will need to look something like the following:

```
GOOGLE_AUTH_URL="https://accounts.google.com"
GOOGLE_USERNAME="…"
GOOGLE_PASSWORD="…"
GOOGLE_STAY_SIGNED_IN="false"
PROTON_AUTH_URL="https://calendar.proton.me"
PROTON_USERNAME="…"
PROTON_PASSWORD="…"
PROTON_STAY_SIGNED_IN="false"
SKIFF_AUTH_URL="https://app.skiff.com/calendar/"
SKIFF_USERNAME="…"
SKIFF_PASSWORD="…"
SKIFF_STAY_SIGNED_IN="false"
```

Tests are Puppeteer driven. After running `npm install` and `npm run build` (and creating your `.env` file), you can run `npm run test` to run tests for all calendars. You may also run tests for a single calendar by passing its name along (e.g. `npm run test skiff`, `npm run test proton`).
22 changes: 19 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
const puppeteerPreset = require("jest-puppeteer/jest-preset");

module.exports = {
verbose: true,
testTimeout: 30_000,
preset: "ts-jest",
testEnvironment: "jsdom",
testPathIgnorePatterns: ["/node_modules/", "/build/", "/dist/"],
...puppeteerPreset,
// testEnvironment: "jsdom",
setupFilesAfterEnv: [...(puppeteerPreset.setupFilesAfterEnv || []), "./src/tests/jest.setup.ts"],
transform: {
"^.+\\.ts?$": [
"ts-jest",
{
isolatedModules: true,
},
],
},
globals: {
...puppeteerPreset.globals,
},
testPathIgnorePatterns: ["/node_modules/", "/build/", "/dist/", "/tmp/"],
};
Loading

0 comments on commit 437ad63

Please sign in to comment.