forked from cypress-io/cypress-realworld-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Elliott King <[email protected]> Co-authored-by: Akshay K <[email protected]>
- Loading branch information
1 parent
8739661
commit aac03eb
Showing
27 changed files
with
349 additions
and
2,382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
name: Cypress Tests | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "renovate/**" | ||
on: [pull_request] | ||
|
||
jobs: | ||
install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Run E2E Tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
run-cypress-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Cypress install | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
runTests: false | ||
- name: Save build folder | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
if-no-files-found: error | ||
path: dist | ||
|
||
- run: yarn cypress info | ||
- run: node --version | ||
- run: node -p 'os.cpus()' | ||
- run: yarn types | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '18.16.1' | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Integrate Shipyard | ||
uses: shipyard/github-action/[email protected] | ||
with: | ||
api-token: ${{ secrets.SHIPYARD_API_TOKEN }} | ||
timeout-minutes: "10" | ||
app-name: "cypress-realworld-app" | ||
- name: Print Env Data | ||
run: | | ||
echo "CYPRESS_BASE_URL=${SHIPYARD_ENVIRONMENT_URL}" >> $GITHUB_ENV | ||
echo "CYPRESS_BYPASS_TOKEN=${SHIPYARD_BYPASS_TOKEN}" >> $GITHUB_ENV | ||
echo "${SHIPYARD_DOMAIN}" | ||
echo "${CYPRESS_BASE_URL}" | ||
env | grep -e SHIPYARD -e CYPRESS | ||
shell: bash | ||
- name: Run E2E tests against the ephemeral environment | ||
run: | | ||
echo $SHIPYARD_ENVIRONMENT_URL | ||
yarn cypress:run --spec "cypress/tests/shipyard/manage-user.spec.ts" | ||
shell: bash | ||
env: | ||
CYPRESS_BASE_URL: ${{ env.CYPRESS_BASE_URL }} | ||
CYPRESS_BYPASS_TOKEN: ${{ env.CYPRESS_BYPASS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"printWidth": 100, | ||
"printWidth": 160, | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:18.16.1-alpine AS build | ||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock .yarnrc vite.config.ts ./ | ||
|
||
RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install | ||
|
||
COPY . . | ||
|
||
# start app | ||
CMD ["yarn", "dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { User } from "models"; | ||
const userId = Cypress._.random(1000, 9999); | ||
describe("Create new user", function () { | ||
beforeEach(function () { | ||
//console.log(process.env.SHIPYARD_DOMAIN_FRONTEND) | ||
const urlToVisit = "/signup"; | ||
cy.visit(urlToVisit); | ||
cy.url().then((url) => { | ||
cy.log(`Current URL: ${url}`); | ||
}); | ||
//cy.task("db:seed"); | ||
}); | ||
// go to sign up page and register | ||
it("should create a new user", function () { | ||
//cy.visit('/signup') | ||
const username = `user${userId}`; | ||
const firstName = `Name${userId}` | ||
const lastName = `T${userId}` | ||
cy.get("input[name='username']").type(username); | ||
cy.get("input[name='firstName']").type(firstName); | ||
cy.get("input[name='lastName']").type(lastName); | ||
// only field that really matters is username because uses ID | ||
// maybe we track user by the auto assigned ID instead of username? | ||
cy.get("input[name='password']").type("testingPwd"); | ||
cy.get("input[name='confirmPassword']").type("testingPwd"); | ||
|
||
// add user to db | ||
cy.get("button[type='submit']").click(); | ||
|
||
}); | ||
}); | ||
|
||
describe("Login as new user", function () { | ||
it("should log in as the user we just created", function () { | ||
cy.visit('/'); | ||
const username = `user${userId}`; | ||
const password = "testingPwd"; | ||
cy.get("input[name='username']").type(username); | ||
cy.get("input[name='password']").type(password); | ||
cy.get("button[type='submit']").click(); | ||
}); | ||
}); | ||
|
||
describe("Initialize user", function() { | ||
beforeEach(function () { | ||
cy.visit('/signup'); | ||
const username = `user${userId}`; | ||
const firstName = `Name${userId}` | ||
const lastName = `T${userId}` | ||
cy.get("input[name='username']").type(username); | ||
cy.get("input[name='firstName']").type(firstName); | ||
cy.get("input[name='lastName']").type(lastName); | ||
// only field that really matters is username because uses ID | ||
// maybe we track user by the auto assigned ID instead of username? | ||
cy.get("input[name='password']").type("testingPwd"); | ||
cy.get("input[name='confirmPassword']").type("testingPwd"); | ||
|
||
// add user to db | ||
cy.get("button[type='submit']").click(); | ||
|
||
cy.visit('/'); | ||
const password = "testingPwd"; | ||
cy.get("input[name='username']").type(username); | ||
cy.get("input[name='password']").type(password); | ||
cy.get("button[type='submit']").click(); | ||
}); | ||
it("should register user for a bank account", function() { | ||
cy.contains('button', 'Next').click(); | ||
cy.get("input[name='bankName']").type("US Bank"); | ||
cy.get("input[name='routingNumber']").type("987123745"); | ||
cy.get("input[name='accountNumber']").type("112987234"); | ||
cy.get("button[type='submit']").click(); | ||
cy.contains('button', 'Done').click(); | ||
|
||
}); | ||
it("should edit a user's information", function () { | ||
cy.getBySel("sidenav-user-settings").click(); | ||
|
||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3' | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: '.' | ||
labels: | ||
shipyard.route: '/' | ||
shipyard.primary-route: 'true' | ||
environment: | ||
SHIPYARD_DOMAIN_BACKEND: ${SHIPYARD_DOMAIN_BACKEND-} | ||
SHIPYARD_DOMAIN: ${SHIPYARD_DOMAIN} | ||
ports: | ||
- '3000:3000' | ||
env_file: | ||
- .env | ||
|
||
backend: | ||
build: | ||
context: '.' | ||
labels: | ||
shipyard.route: '/' | ||
environment: | ||
SHIPYARD_DOMAIN_FRONTEND: ${SHIPYARD_DOMAIN_FRONTEND-} | ||
SHIPYARD_DOMAIN: ${SHIPYARD_DOMAIN} | ||
ports: | ||
- '3001:3001' | ||
volumes: | ||
- 'dbdata:/app/data/database' | ||
env_file: | ||
- .env | ||
|
||
volumes: | ||
dbdata: |
Oops, something went wrong.