diff --git a/.env.example b/.env.example
index a16f82a..ecf6629 100644
--- a/.env.example
+++ b/.env.example
@@ -1,23 +1,13 @@
-# Since the ".env" file is gitignored, you can use the ".env.example" file to
-# build a new ".env" file when you clone the repo. Keep this file up-to-date
-# when you add new variables to `.env`.
+DATABASE_URL=""
-# This file will be committed to version control, so make sure not to have any
-# secrets in it. If you are cloning this repo, create a copy of this file named
-# ".env" and populate it with your secrets.
+NEXT_PUBLIC_SITE_URL=""
-# When adding additional environment variables, the schema in "/src/env.mjs"
-# should be updated accordingly.
-
-# Prisma
-# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
-DATABASE_URL="file:./db.sqlite"
-
-# Next Auth
-# You can generate a new secret on the command line with:
-# openssl rand -base64 32
-# https://next-auth.js.org/configuration/options#secret
-# NEXTAUTH_SECRET=""
-NEXTAUTH_URL="http://localhost:3000"
+AUTH0_CLIENT_ID=""
+AUTH0_CLIENT_SECRET=""
+AUTH0_ISSUER=""
+CYPRESS_TEST_USER_EMAIL=""
+CYPRESS_TEST_USER_PASSWORD=""
+TEST_USER_EMAIL=""
+TEST_USER_PASSWORD=""
\ No newline at end of file
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index daa4df9..ab1b798 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -9,6 +9,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
+ # Write the cypress.env.json file
+ - name: Write the cypress.env.json file 📝
+ run: |
+ echo '${{ secrets.CYPRESS_ENV_CI }}' > cypress.env.json && cat cypress.env.json
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
@@ -25,3 +29,6 @@ jobs:
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
AUTH0_ISSUER: ${{ secrets.AUTH0_ISSUER }}
+ TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
+ TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
+ CYPRESS_ENV_CI: ${{ secrets.CYPRESS_ENV_CI }}
diff --git a/.gitignore b/.gitignore
index f54bd33..c9388fd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,5 @@ yarn-error.log*
cypress/videos
cypress/screenshots
+cypress/downloads
+cypress.env.json
diff --git a/cypress.config.ts b/cypress.config.ts
index b859024..3f443dc 100644
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -1,9 +1,6 @@
import { defineConfig } from "cypress";
export default defineConfig({
- env: {
- NEXT_PUBLIC_SITE_URL: "http://localhost:3000",
- },
viewportHeight: 1000,
e2e: {
setupNodeEvents(on, config) {
diff --git a/cypress/e2e/study/controls.cy.ts b/cypress/e2e/study/controls.cy.ts
index 9e0a902..3f58e23 100644
--- a/cypress/e2e/study/controls.cy.ts
+++ b/cypress/e2e/study/controls.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../utils/gamesBySquares";
describe("Check that controls move around", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
cy.playGame(gamesBySquares.shortExample);
});
diff --git a/cypress/e2e/study/fen.cy.ts b/cypress/e2e/study/fen.cy.ts
index b947833..a3fee6e 100644
--- a/cypress/e2e/study/fen.cy.ts
+++ b/cypress/e2e/study/fen.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../utils/gamesBySquares";
describe("Check that controls move around", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
diff --git a/cypress/e2e/study/moves.cy.ts b/cypress/e2e/study/moves.cy.ts
index cefe18a..f14ddeb 100644
--- a/cypress/e2e/study/moves.cy.ts
+++ b/cypress/e2e/study/moves.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../utils/gamesBySquares";
describe("Check that PgnViewer component works as expected", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
diff --git a/cypress/e2e/study/pgnTools/copyPgn.cy.ts b/cypress/e2e/study/pgnTools/copyPgn.cy.ts
index 546cde9..fd876bc 100644
--- a/cypress/e2e/study/pgnTools/copyPgn.cy.ts
+++ b/cypress/e2e/study/pgnTools/copyPgn.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../../utils/gamesBySquares";
describe("Check functioning of PGN copying", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
diff --git a/cypress/e2e/study/pgnTools/downloadPgn.cy.ts b/cypress/e2e/study/pgnTools/downloadPgn.cy.ts
index 1812fd1..3d48c7b 100644
--- a/cypress/e2e/study/pgnTools/downloadPgn.cy.ts
+++ b/cypress/e2e/study/pgnTools/downloadPgn.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../../utils/gamesBySquares";
describe("Check functioning of PGN download", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
@@ -14,7 +15,7 @@ describe("Check functioning of PGN download", () => {
cy.data("download-pgn").should("be.enabled");
});
- it.only("Should copy PGN to clipboard", () => {
+ it("Should copy PGN to clipboard", () => {
cy.playGame(gamesBySquares.shortExample);
cy.data("pgn-tools-menu").click();
cy.data("download-pgn").click();
diff --git a/cypress/e2e/study/pgnViewer.cy.ts b/cypress/e2e/study/pgnViewer.cy.ts
index 0fd372d..733d604 100644
--- a/cypress/e2e/study/pgnViewer.cy.ts
+++ b/cypress/e2e/study/pgnViewer.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../utils/gamesBySquares";
describe("Check that PgnViewer shows correct moves", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
diff --git a/cypress/e2e/study/study.cy.ts b/cypress/e2e/study/study.cy.ts
index 0bfd47a..1cf46dd 100644
--- a/cypress/e2e/study/study.cy.ts
+++ b/cypress/e2e/study/study.cy.ts
@@ -2,6 +2,7 @@ import gamesBySquares from "../../utils/gamesBySquares";
describe("Check basic moves in study", () => {
beforeEach(() => {
+ cy.login();
cy.visit(`${Cypress.env("NEXT_PUBLIC_SITE_URL")}/study`);
});
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index 1ff5c88..606aaae 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -15,6 +15,7 @@ declare global {
testBoardStore(): Chainable