Skip to content

Commit

Permalink
chore(#29): add e2e tests (#31)
Browse files Browse the repository at this point in the history
* chore(#29): add e2e tests

* chore(#29): update e2e job

* chore(#29): add cypress tests

* chore(#29): add artifact step
  • Loading branch information
Decipher authored Sep 12, 2022
1 parent 95dc79d commit 90d15a1
Show file tree
Hide file tree
Showing 8 changed files with 13,647 additions and 42,707 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: test-e2e

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [14]

steps:
- name: Checkout 🛎
uses: actions/checkout@master

- name: Setup node env 🏗
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
check-latest: true

- name: Get yarn cache directory path 🛠
id: yarn-cache-dir-path
run: cd nuxt && echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node_modules 📦
uses: actions/[email protected]
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup ddev
uses: jonaseberle/github-action-setup-ddev@v1
with:
autostart: false
- name: Start ddev
run: cd drupal && ddev start

- name: Install Drupal 👨🏻‍💻
run: cd drupal && ddev drupal-install

- name: Install Nuxt.js 👨🏻‍💻
run: cd nuxt && yarn

# - name: Run linting 🔎
# run: cd nuxt && yarn lint

# - name: Run Jest tests 🧪
# run: cd nuxt && yarn test:jest

- name: Run end-to-end tests 🧪
run: cd nuxt && NODE_TLS_REJECT_UNAUTHORIZED=0 yarn test:e2e

- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: nuxt/cypress/screenshots
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: nuxt/cypress/videos

# - uses: codecov/codecov-action@v3
# with:
# files: ./nuxt/coverage/clover.xml
# name: codecov-umbrella
# fail_ci_if_error: true
# verbose: true
10 changes: 10 additions & 0 deletions nuxt/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
3 changes: 3 additions & 0 deletions nuxt/cypress/e2e/homepage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it('Homepage', () => {
cy.visit('/')
})
14 changes: 14 additions & 0 deletions nuxt/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
2 changes: 1 addition & 1 deletion nuxt/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import opn from 'opn'

const baseUrl = process.env.BASE_URL
const baseUrl = process.env.BASE_URL || 'http://druxtfoundry.ddev.site'

export default {
// Global page headers: https://go.nuxtjs.dev/config-head
Expand Down
Loading

0 comments on commit 90d15a1

Please sign in to comment.