diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af5891d..582411d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,7 @@ env: jobs: test: + if: false runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 5cd4136..1cb7244 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,13 @@ Example for a blog post about nginx docker compose Set your environment variables & initialize submodules ```bash cp .env.sample .env +echo "GH_TOKEN=" > .env source .env git submodule sync git submodule update --init --recursive + +./bin/build_local.sh ``` @@ -57,3 +60,13 @@ Once the container is up and running, you can hit `http://localhost:8089/` it `/ `http://localhost:8089/backend/` will route you to the backend service. `http://localhost:8089/api/` will route you to the backend service with the api path. + + +## Running the Test suite + +In the directory `test` you'll find a cypress test suite. In here is our business logic testing. It is a marvel of modern cypriotic book approval/censorship. After you have `bin/build_local.sh` running, follow the instructions in `./test/README.md` and boot up the Cypress tests. + +## What on earth are these services? +React1(localhost:8089/) - a frontend application allowing users to reccomend books for listing. +React2(localhost:8089/backend) - Super secret admin panel app allowing admins to approve or deny books for listing +Rails(localhost:8089/api/books) - Api holding the data, performing business logic. ¡Truly revolutionary! diff --git a/bin/build_github.sh b/bin/build_github.sh index 36f822c..a613af4 100755 --- a/bin/build_github.sh +++ b/bin/build_github.sh @@ -3,11 +3,9 @@ if [ ! -f .env ]; then export FRONTEND_BUILD_CONTEXT="https://${GH_TOKEN}@${FRONTEND_REPO_URL}#${FRONTEND_REF}" export API_BUILD_CONTEXT="https://${GH_TOKEN}@${API_REPO_URL}#${API_REF}" export BACKEND_BUILD_CONTEXT="https://${GH_TOKEN}@${BACKEND_REPO_URL}#${BACKEND_REF}" - - echo "" >> .env - echo "FRONTEND_BUILD_CONTEXT='${FRONTEND_BUILD_CONTEXT}'" >> .env - echo "API_BUILD_CONTEXT='${API_BUILD_CONTEXT}'" >> .env - echo "BACKEND_BUILD_CONTEXT='${BACKEND_BUILD_CONTEXT}'" >> .env + echo "FRONTEND_BUILD_CONTEXT=${FRONTEND_BUILD_CONTEXT}" >> .env + echo "API_BUILD_CONTEXT=${API_BUILD_CONTEXT}" >> .env + echo "BACKEND_BUILD_CONTEXT=${BACKEND_BUILD_CONTEXT}" >> .env fi source .env diff --git a/repo_refs/react1-app b/repo_refs/react1-app index b8bbbc2..06a5ac9 160000 --- a/repo_refs/react1-app +++ b/repo_refs/react1-app @@ -1 +1 @@ -Subproject commit b8bbbc2b9e501d359b3e0f1238883703987c02b0 +Subproject commit 06a5ac987bcad09e75074f517e8e9e66fe21999c diff --git a/test/README.md b/test/README.md index 96e0819..6fcaf77 100644 --- a/test/README.md +++ b/test/README.md @@ -24,7 +24,7 @@ npm install ```bash # Open Cypress GUI for development -npm run test:local +npm run test:gui # Run tests headlessly npm test diff --git a/test/cypress/e2e/books_flow.cy.js b/test/cypress/e2e/books_flow.cy.js index 5525214..44af61d 100644 --- a/test/cypress/e2e/books_flow.cy.js +++ b/test/cypress/e2e/books_flow.cy.js @@ -4,6 +4,13 @@ describe("Books Flow", () => { cy.resetTestData(); }); + function fillInBookForm({title, publisher, author, isbn}) { + cy.get('input[placeholder="Enter book title"]').type(title); + cy.get('input[placeholder="Enter book publisher"]').type(publisher); + cy.get('input[placeholder="Enter book author"]').type(author); + cy.get('input[placeholder="Enter book ISBN"]').type(isbn); + } + it("allows proposing and approving books", () => { // Visit React1 app (root path) cy.visit("/"); @@ -11,14 +18,12 @@ describe("Books Flow", () => { // Propose a new book cy.contains("button", "Propose New Book").click(); - cy.get('input[placeholder="Enter book title"]').type("Test Book Title"); - cy.get('input[placeholder="Enter book publisher"]').type( - "Test Author Name" - ); - cy.get('input[placeholder="Enter book author"]').type( - "Test Publisher Name" - ); - cy.get('input[placeholder="Enter book ISBN"]').type("1234567890"); + fillInBookForm({ + title: "Test Book Title", + publisher: "Test Author Name", + author: "Test Publisher Name", + isbn: "1234567890", + }); cy.contains("button", "Submit").click(); // Visit React2 app (/backend path) @@ -45,21 +50,20 @@ describe("Books Flow", () => { it("allows denying provisional books", () => { // Visit React1 app - cy.visit("/backend"); - + cy.visit("/"); // Propose a new book cy.contains("button", "Propose New Book").click(); - cy.get('input[placeholder="Enter book title"]').type("Book To Deny"); - cy.get('input[placeholder="Enter book publisher"]').type( - "Test Author Name" - ); - cy.get('input[placeholder="Enter book author"]').type( - "Test Publisher Name" - ); + fillInBookForm({ + title: "Book To Deny", + publisher: "Test Author Name", + author: "Test Publisher Name", + isbn: "1234567890", + }); cy.contains("button", "Submit").click(); // Visit React2 app and deny the book cy.visit("/backend/"); + cy.contains("Provisional Books"); cy.contains(".book-item", "Book To Deny") .contains("button", "Deny") .click();