Skip to content

Commit

Permalink
289 unsub page (#328)
Browse files Browse the repository at this point in the history
* unsub tsx

* refactor styled SubmitButton into its own tsx

* get memberId from the url

* 404 if list member is not found

* add noindex tag to header

* create a list by default

* show lists on settings page

* Squashed commit of the following:

commit cbf32b6
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 22:01:27 2022 -0700

    rm commented

commit a3e2597
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 16:07:28 2022 -0700

    duh yarn

commit 2aadb2a
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 16:04:56 2022 -0700

    oops

commit 932e535
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 16:00:20 2022 -0700

    try using cypress-io/github-action@v4

commit 1e48a86
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 15:51:50 2022 -0700

    fix github action

commit 802adf3
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 14:59:50 2022 -0700

    test signup form errors

commit 1c57a3a
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 14:47:14 2022 -0700

    test login form errors

commit abb7cbe
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 14:17:34 2022 -0700

    test logout

commit c45816d
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 14:02:06 2022 -0700

    test api key functionality

commit 2314f1a
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 13:53:52 2022 -0700

    add a login test

commit fb34f09
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 12:51:25 2022 -0700

    oops fix ts

commit d083b6c
Merge: 2ee5a4b ff8c73a
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 12:46:21 2022 -0700

    Merge branch 'main' into 257-add-cypress-tests-that-use-the-integration-db

commit 2ee5a4b
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 12:39:20 2022 -0700

    will it run in github

commit 44eb61d
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 12:29:42 2022 -0700

    fix bug on /settings page

commit 2cc18ad
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:49:25 2022 -0700

    add cy test that duplicates the bug

commit 6c30a6e
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:49:18 2022 -0700

    add headed option

commit f03213e
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:49:10 2022 -0700

    wtf well i guess it allows some imports?

commit 34e262c
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:20:14 2022 -0700

    working clear web db

commit 577aff0
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:18:51 2022 -0700

    working clear dev database, imports are all screwy

commit 7fbd7ac
Author: Alex Farrill <[email protected]>
Date:   Thu Oct 27 11:18:36 2022 -0700

    resolve typescript declared twice warning

commit 8166192
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 18:40:00 2022 -0700

    small refactor for readability

commit 449a706
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 18:32:13 2022 -0700

    beforeAll is just called "before" in cypress

commit 518832c
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 18:29:53 2022 -0700

    demo of a function that counts

commit 2ff61ef
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 18:20:47 2022 -0700

    hook for db:reset

commit 1c97000
Merge: 85dcdd3 43a6c92
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:33:09 2022 -0700

    Merge branch 'bugfix-assert-free-ports' into 257-add-cypress-tests-that-use-the-integration-db

commit 43a6c92
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:32:03 2022 -0700

    now you can't fuck it up

commit 85dcdd3
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:30:34 2022 -0700

    move ./scripts/assert-free-ports.sh check to integration:servers:start

commit 54ff0c8
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:26:45 2022 -0700

    add precheck for servers running to test:integration:cypress

commit dcd138d
Merge: f3db9b2 cb22607
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:25:41 2022 -0700

    Merge branch 'bugfix-assert-free-ports' into 257-add-cypress-tests-that-use-the-integration-db

commit cb22607
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:11:20 2022 -0700

    can i also refactor "ci:test" to use "integration:servers:start" ?
    the difference is adding MAILING_CLI=true, was that ommitted intentionally or no?

commit ecaa58d
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:09:59 2022 -0700

    refactor big block of shell into "yarn integration:servers:start"

commit 50a962e
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 17:06:39 2022 -0700

    assert-free-ports should exit 0 if nothing is running on :3000 or :3883, otherwise it should exit 1.  the commands after it in yarn should run with && not ;

commit f3db9b2
Author: Alex Farrill <[email protected]>
Date:   Wed Oct 26 16:43:28 2022 -0700

    init cypress integration

* subscribe page

* subscribe

* handle 500

* maybe build this out later

* change list name to Default

* save

* form success state

* kind of working

* partition lists into default and not

* save

* isDefault: false

* show error

* catch error, but it doesn't actually work

* make it easy to use for now

* save

* some styling

* form styling

* styling

* capture formstate

* display the correct formState for each checkbox

* useState with formState

* function curry

* default list checkbox behavior

* tiny bugfix

* serialize the form

* it updates

* form initial state

* working form

* do the subscription in packages/cli/src/pages/api/messages/index.ts

* unsub url

* remove console.log

* fix tests

* jest

* update snapshot

* add /audiences

* audience.cy.integration.js

* fix command

* use this code temporarily to check for errors since prisma doc code is not working

* log the error

* fix logic

* fix a bug where mailOptions should be splatted

* save

* use URL

* fix api url passed to instrumentHTML

* url does not need to be decoded in click.ts

* remove logging

* no longer base64

* MAILING_DATABASE_URL is no longer part of the analytics check

* Revert "MAILING_DATABASE_URL is no longer part of the analytics check"

This reverts commit 458b8f7.

* MAILING_DATABASE_URL is no longer part of the analytics check

* fix jest related to click

* definitely add e to error

* idk

* ts

* make the copy commands more similar

* fix test

* rm SubmitButton for now

* Add Subcriber button

* style

* ui/Table; sort; counts

* style table:

* style settings and unsubscribe pages

* pagination control

* do not highlight settings on login

* fixed position nav

* 'no' nav active hover state

* style auth error msg

* bottom pad settings

* try /previews redirects to first preview

* make a button look like button button

* 1-index pages

* use Table for settings page tables

* don't base64 encode url's

* save

* fix and add tests

* save

* test for unsubscribe

* fix capy integration tests

* don't add components to pages directory
https://nextjs.org/docs/messages/prerender-error

* show email instead of [email protected]

* add mailing to web

* navbar should not show on the unsubscribe page

* remove NEXT_PUBLIC_NAV ff

* kill nav feature flag

* move magic "MM_EMAIL_PREFERENCES_URL" to a const EMAIL_PREFERENCES_URL in mailing-core

* cover case 2 - it should throw an error if you're using listId and your template doesn't include an unsubscribe link
"Templates sent to a list must include an unsubscribe link. Add an unsubscribe link or remove the list parameter from your sendMail call."

* cover case 4

* add displayName to lists

* use list name instead of id

* create list if it doesn't exist

* session should login

* remove New List button

* parse the date string

* Update packages/cli/src/pages/api/unsubscribe/[memberId].ts

* refactor findOrCreateDefaultList

* navbar renders in dev

* use displayName

* return error

* add displayName

* fix tests

* fix tests

* golf i couldn't stop thinking about

* add emails dir to web

* check-in mailing.config.json in web

* - add test:cypress:integration:open command
- add a test for the unsubscribe page: it should not show the nav

* add some more tests

* e2e unsubscribe

* refactor sendMail test

* wrapError when you can't tell where an error is coming from

* make it so that you can hook in and get ApiSendMail.defaultFormData
but don't mutate it!

* allow you to skip api key validation with magic api key "testApiKey" if MAILING_CI = true

* you can also truncate cli tables

* add LISTS.md

* oops, with last commit

* with the valid api key in the db, without using the magic MAILING_API_KEY

* finish happy path tests

* add tests

* sendmail tests

* more tests

* failing tests

* save

* working integration tests for sendMail, Minimal template for now

* working

* breaking and fixing

* fix tests related to Minimal.tsx template

* jest tests need to be run without MAILING_CI=true

* blah

* maybe this works

* Revert "maybe this works"

This reverts commit 892ecd8.

* update note

* enable retries in cypress integration

* try to upload artifacts

* working on e2e tests

* update next commands in e2e

* --save-cache works again

* --update-snapshot command

* update the snapshot

* update CONTRIBUTING.md

* fix type-o

* * * * * * * * * * * * * * * * * *
          ⚠️ WARNING ⚠️ Expected mailing.config.json to have typescript set to true but was not!

          In other words, mailing init did not correctly detect that this was a typescript project

          Please implement #338 and then have this raise an error instead or move this check to a jest test

          Until #338 is implemented, the e2e tests will override this by passing the --typescript flag to `npx mailing init` in typescript frameworks.
          * * * * * * * * * * * * * * * * *

* also need jsx so can use same snapshot for js frameworks

* fix tests related to add Minimal.jsx template

* update snapshot - but this doesn't render locally.... hmmmmm

* refactor idk

* idk

* blah

* typo

* await truncate

* await and click buttons

* - refactor out Minimal template.  instead, Footer component accepts a "includeUnsubscribe" prop and some templates use it and others don't
- fix integration tests
- update framework jest test snapshots

* rename MAILING_CI -> MAILING_INTEGRATION_TEST
i think this is much clearer

* vscode

* delete LISTS.md, covering in docs-site

Co-authored-by: Peter Sugihara <[email protected]>
Co-authored-by: Monica Kogler <[email protected]>
  • Loading branch information
3 people authored Nov 17, 2022
1 parent 7d51f68 commit 5a76c14
Show file tree
Hide file tree
Showing 95 changed files with 3,566 additions and 685 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/cypress_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ jobs:
run: yarn build
- name: Cypress run integration tests
run: yarn test:integration:cypress
- name: cypress-integration-upload-artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-integration-artifacts
path: |
packages/cli/cypress/screenshots
packages/cli/cypress/videos
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dev-app
tmp-testMailQueue.json
dist
mailing.config.json
!packages/web/mailing.config.json
previews_html
out
.mailing
Expand Down Expand Up @@ -113,6 +114,7 @@ typings/
emails
!packages/cli/src/generator_templates/ts/emails/
!packages/cli/src/generator_templates/js/emails/
!packages/web/emails

# E2E tests
e2e/runs
Expand Down
19 changes: 11 additions & 8 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ For development, you may want to have a demo next app that pulls in your changes

### Run embedded jest tests for the preview server

During the smoke test process described below, the jest tests in `scripts/e2e_test/jest_tests` are copied into the directory where each target framework is installed and run. Before testing them in the framework install context, however, you will want to make sure they pass on the latest build by running `yarn build` and then `yarn e2e:jest` in the mailing project root.
During the framework test process described below, the jest tests in `scripts/e2e_test/jest_tests` are copied into the directory where each target framework is installed and run. Before testing them in the framework install context, however, you will want to make sure they pass on the latest build by running `yarn build` and then `yarn e2e:jest` in the mailing project root.

## Smoke tests

The directory `scripts/e2e_test` contains smoke tests targeting supported frameworks that should be run before every public npm release. Each test uses the `yarn create` command to create new projects from their `create-*` starter kits and then runs the cypress cli tests contained in `packages/cli/cypress` and the jest tests contained in `scripts/e2e_test/jest_tests`.
The directory `scripts/e2e_test` contains framework tests targeting supported frameworks that should be run before every public npm release. Each test uses the `yarn create` command to create new projects from their `create-*` starter kits and then runs the cypress cli tests contained in `packages/cli/cypress` and the jest tests contained in `scripts/e2e_test/jest_tests`.

The frameworks currently covered by the tests are:

Expand All @@ -60,25 +60,28 @@ The frameworks currently covered by the tests are:
- redwood_ts (Redwood with Typescript)
- redwood_js (Redwood without Typescript)
- remix_ts (Remix with Typescript)
- remid_js (Remix without Typescript)
- remix_js (Remix without Typescript)

**Initial test setup**

- In the project root, run `asdf install` to install ruby 3.1.2
- In the directory `scripts/e2e_test`, run `bundle install` to install the required ruby gems

**Run the smoke tests**
**Run the framework tests**

- In the project root, run `yarn e2e` to run the full smoke test suite, including cypress and jest tests.
- In the project root, run `yarn test:e2e` to run the full framework test suite, including cypress and jest tests for all supported frameworks.

This will instantiate each framework, add mailing with yalc, and then run the cypress tests contained in `packages/cli/cypress` and the jest tests contained in `scripts/e2e_test/jest_tests`.

The script supports some options for running:
**Run the framework tests with advanced options**

- `--only=redwood_ts` to run the tests only on the specified framework. See TestRunner::E2E_CONFIG for a list of frameworks that are currently supported.
The underlying ruby script `bundle exec ruby e2e/cli.rb` supports some options for running:

- `--app=redwood_ts` to run the tests only on the specified framework. See `e2e/app.rb` for the list of supported frameworks
- `--skip-build` to skip the yarn build part of the script, useful when debugging something unrelated to the build
- `--update-snapshot` if you need to update the snapshots in the framework tests. This will run jest with the `-u` option and then copy the updated snapshots back to mailing.
- `--rerun` to skip the framework install part of the script, useful when debugging something in your cypress tests unrelated to the build or the framework install. This will use the framework installs that are present in the runs/latest directory, i.e. the assumption is you've run a test against some framework(s) and you now want to re-running them after adjusting your cypress tests.

**Cache the framework installs for faster runs**

- Use the `--save-cache` flag to save each framework install (before mailing is added) to the `cache` directory. Subsequent test runs will use the cache instead of running `yarn create` and `yarn install`, which will speed things up 🏎 If you need to reset the cache, e.g. if you want to test a newer version of the framework or if the framework install process changes, you can delete the cache directory or the subdirectory containing the specific framework you are targeting.
- Use the `--save-cache` flag to save each framework install (before mailing is added) to the `cache` directory. Subsequent test runs will start with a copy of the cache instead of running `yarn create` and `yarn install`, which will speed things up 🏎 If you need to reset the cache, e.g. if you want to test a newer version of the framework or if the framework install process changes, you can delete the cache directory or the subdirectory containing the specific framework you are targeting.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
"test": "yarn link:emails; yarn jest",
"test:integration": "yarn integration:servers:start \"yarn link:emails; yarn jest -c jest.integration.config.ts $TEST_FLAGS\"",
"test:integration:watch": "yarn integration:servers:start \"yarn link:emails; yarn jest -c jest.integration.config.ts --watch\"",
"test:integration:cypress": "yarn integration:servers:start \"cd packages/cli && yarn cypress run -C cypressIntegration.config.ts\"",
"test:integration:cypress:headed": "yarn integration:servers:start \"cd packages/cli && yarn cypress run -C cypressIntegration.config.ts --headed\"",
"ci:test": "yarn integration:servers:start test",
"ci:test": "yarn test:servers:start test",
"ci:test:integration": "yarn integration:servers:start \"yarn link:emails; yarn jest -c jest.integration.config.ts\"",
"test:integration:cypress": "yarn integration:servers:start \"cd packages/cli && yarn cypress run -C cypressIntegration.config.ts\"",
"test:integration:cypress:open": "yarn integration:servers:start \"cd packages/cli && yarn cypress open -C cypressIntegration.config.ts\"",
"ci:cli": "cd packages/cli && yarn ci:server",
"ci:web": "cd packages/web && yarn ci:server",
"test:e2e": "bundle && bundle exec ruby e2e/cli.rb run-all",
"integration:servers:start": "./scripts/assert-free-ports.sh && MAILING_CI=true MAILING_DATABASE_URL=$MAILING_DATABASE_URL_TEST WEB_DATABASE_URL=$WEB_DATABASE_URL_TEST start-test ci:cli :3883 ci:web :3000",
"test:servers:start": "./scripts/assert-free-ports.sh && MAILING_API_KEY=testApiKey MAILING_API_URL=http://localhost:3883 MAILING_DATABASE_URL=$MAILING_DATABASE_URL_TEST WEB_DATABASE_URL=$WEB_DATABASE_URL_TEST start-test ci:cli :3883 ci:web :3000",
"integration:servers:start": "MAILING_INTEGRATION_TEST=true yarn test:servers:start",
"prepublish": "yarn build",
"postinstall": "husky install && preconstruct dev",
"watch": "preconstruct watch",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe("audience", () => {
before(() => {
cy.task("db:reset");
});

it("should show subscribers on the /audiences page", () => {
cy.signup();

// subscribe a user to the default list
cy.visit("/settings");
cy.get("a").contains("Subscribe").click();
cy.get("input#email").type("[email protected]");
cy.get("button[type=submit]").click();
cy.get("body").should("contain", "Thanks for subscribing!");

// ok@ok.com should appear on the /audiences page
cy.visit("/audiences");
cy.get(".table-data").should("contain", "[email protected]");
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
describe("login tests", () => {
describe("signup and authenticate", () => {
const email = "[email protected]";
const password = "password";

before(() => {
cy.task("db:reset");
});

it("should be able to signup, login, and everything else", () => {
const email = "[email protected]";
cy.visit("/signup");
cy.location("pathname").should("eq", "/signup");

Expand All @@ -13,46 +15,37 @@ describe("login tests", () => {

// invalid email should give an error
cy.get("input#email").type("test");
cy.get("form").submit();
cy.get("button[type=submit]").click();
cy.get(".form-error").should("contain", "email is invalid");

// invalid password (blank) should give an error
cy.get("input#email").clear().type(email);
cy.get("form").submit();
cy.get("button[type=submit]").click();
cy.get(".form-error").should(
"contain",
"password should be at least 8 characters"
);

// fill in email and passord fields with valid values and then submit the form
cy.get("input#email").clear().type(email);
cy.get("input#password").type("password");
cy.get("form").submit();

// it should redirect to the login page
cy.location("pathname").should("eq", "/login");
cy.get("h1").should("contain", "Log in");

// fill in email and passord fields and then submit the form
cy.get("input#email").type(email);
cy.get("input#password").type("password");
cy.get("form").submit();
cy.get("input#password").type(password);
cy.get("button[type=submit]").click();

// it should redirect you to the settings page
cy.location("pathname").should("eq", "/settings");
cy.get("h1").should("contain", "Settings");
cy.get("h1").should("contain", "Account");

// you should see a default api key that was created
cy.get("#api-keys tbody tr").should("have.length", 1);
cy.get("#api-keys .table-data").should("have.length", 3);

// you should see a button to add an API key
cy.get("button").should("contain", "New API Key");

// click the button to add an API key
cy.get("button").click();
cy.get("button").contains("New API Key").click();

// you should see 2 api keys in the tbody instead of 1
cy.get("#api-keys tbody tr").should("have.length", 2);
cy.get("#api-keys .table-data").should("have.length", 6);

// you should get a 404 if you try to go back to /signup, only 1 user is allowed to signup
cy.visit("/signup", { failOnStatusCode: false });
Expand Down Expand Up @@ -90,7 +83,7 @@ describe("login tests", () => {
// it should give you an error if you try to login with the wrong password
cy.get("input#email").type(email);
cy.get("input#password").type("wrongpassword");
cy.get("form").submit();
cy.get("button[type=submit]").click();

cy.get(".form-error").should("contain", "invalid password");
});
Expand All @@ -104,12 +97,12 @@ describe("login tests", () => {
// fill in email and passord fields and then submit the form
cy.get("input#email").type("[email protected]");
cy.get("input#password").type("password");
cy.get("form").submit();
cy.get("button[type=submit]").click();

// it should show an error message
cy.get("div.form-error").should(
"contain",
"no user exists with that email"
"No user exists with that email."
);
});

Expand All @@ -123,5 +116,14 @@ describe("login tests", () => {
expect(response.status).to.eq(307);
expect(response.redirectedToUrl).to.eq("http://localhost:3883/login");
});

// it should redirect to the login page
cy.visit("/login");
cy.get("h1").should("contain", "Log in");

// fill in email and passord fields and then submit the form
cy.get("input#email").type(email);
cy.get("input#password").type(password);
cy.get("button[type=submit]").click();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
describe("unsubscribe page", () => {
before(() => {
cy.task("db:reset");
});

it("should not show the nav", async () => {
cy.signup();

// get the defalt list id from the database
cy.request({
url: `/api/lists`,
}).then((response) => {
expect(response.status).to.eq(200);

const listId = response.body.lists[0].id;
expect(listId).to.be.a("string");

// subscribe a user to the default list
cy.request({
url: `/api/lists/${listId}/subscribe`,
method: "POST",
body: {
email: "[email protected]",
},
}).then((response) => {
expect(response.status).to.eq(201);
const {
member: { id: memberId },
} = response.body;

expect(memberId).to.be.a("string");

// unsubscribe the user
cy.visit(`/unsubscribe/${memberId}`);
cy.get("h1").should("contain", "Email preferences");
cy.get("nav").should("not.exist");

// check that the user is not unsubscribed
cy.get("label").should("have.length", 1);
cy.get("label").should("contain", "Unsubscribe from all emails");
cy.get("input[type=checkbox]").should("have.length", 1);
cy.get("input[type=checkbox]").should("not.be.checked");

// check the unsubscribe all checkbox
cy.get("input[type=checkbox]").check();
// click the submit button
cy.get("button").click();

// should see "Saved!" message
cy.get("div").should("contain", "Saved!");

// the user's status should be unsubscribed
cy.request({
url: `/api/lists/${listId}/members/${memberId}`,
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.member.status).to.eq("unsubscribed");
});
});
});
});
});
30 changes: 20 additions & 10 deletions packages/cli/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

/* eslint-disable-next-line @typescript-eslint/no-namespace */
declare namespace Cypress {
interface Chainable {
signup(): Chainable<void>;
}
}

Cypress.Commands.add("signup", () => {
const email = "[email protected]";
cy.visit("/signup");
cy.get("h1").should("contain", "Sign up");
cy.location("pathname").should("eq", "/signup");

cy.get("input#email").type(email);
cy.get("input#password").type("password");
cy.get("button[type=submit]").click();

cy.location("pathname").should("eq", "/settings");
});
4 changes: 4 additions & 0 deletions packages/cli/cypressIntegration.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default defineConfig({
specPattern: "**/*.cy.integration.{js,jsx,ts,tsx}",
defaultCommandTimeout: 10000,
baseUrl: "http://localhost:3883",
retries: {
runMode: 2,
openMode: 0,
},
setupNodeEvents(on, _config) {
on("task", {
"db:reset": resetDb,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "List" ADD COLUMN "isDefault" BOOLEAN NOT NULL DEFAULT false;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `updatedAt` to the `List` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Member` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "List" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;

-- AlterTable
ALTER TABLE "Member" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `List` will be added. If there are existing duplicate values, this will fail.
- Added the required column `displayName` to the `List` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "List" ADD COLUMN "displayName" TEXT NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "List_name_key" ON "List"("name");
17 changes: 12 additions & 5 deletions packages/cli/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,27 @@ model Click {

model List {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isDefault Boolean @default(false)
name String
displayName String
organizationId String
Organization Organization @relation(fields: [organizationId], references: [id])
Member Member[]
@@unique([name])
@@index([organizationId])
}

model Member {
id String @id @default(cuid())
email String
listId String
List List @relation(fields: [listId], references: [id])
status MemberStatus
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String
listId String
List List @relation(fields: [listId], references: [id])
status MemberStatus
@@unique([listId, email])
}
Expand Down
Loading

2 comments on commit 5a76c14

@vercel
Copy link

@vercel vercel bot commented on 5a76c14 Nov 17, 2022

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 5a76c14 Nov 18, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

web – ./packages/web

web-rho-puce.vercel.app
mailing.run
web-sofn.vercel.app
web-git-main-sofn.vercel.app
www.mailing.run

Please sign in to comment.