-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore(#92): add steps to create local and Gitpod development environments * chore(#92): add cypress to package.json and add test/cypress directory * chore(#92): added scripts to package.json * chore(#92): wip * chore(#92): yarn lock update * chore(#92): Add cypress scripts to package.json and added dev environment setup info in CONTRIBUTING.md. * chore(#92): improved dev environment setup info * chore(#92): added cyprus dependency and scripts * chore(#92): fixed error in druxt-site dependency * chore(#92): added login command * chore(#92): removed extraneous .gitkeep file * chore(#92): update contributing guide * chore(#92): updated cypress docs position * chore(#92): fix contributing guide issues * chore(#92): add cypress to gitpod dockerfile * chore: update jest config * chore(#92): update test scripts * chore: temporarily disable login command * chore(#92): test against dev * chore: removed cypress examples * chore(#92): add test open script * chore(#92): update cypress test and config * chore: remove example fixture * chore(#92): update circleci config * chore(#92): update cypress docs Co-authored-by: Stuart Clark <[email protected]>
- Loading branch information
1 parent
22a4015
commit ae9d019
Showing
11 changed files
with
1,221 additions
and
54 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
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 |
---|---|---|
@@ -1,19 +1,30 @@ | ||
{ | ||
"name": "druxt-site", | ||
"scripts": { | ||
"cypress:open": "npx cypress open --project test", | ||
"cypress:run": "npx cypress run --project test", | ||
"dev": "nuxt dev", | ||
"generate": "nuxt generate", | ||
"serve": "yarn generate && yarn start", | ||
"start": "nuxt start", | ||
"storybook": "nuxt storybook" | ||
"storybook": "nuxt storybook", | ||
"test": "start-server-and-test 'yarn dev' http://localhost:3000 'yarn cypress:run'", | ||
"test:open": "start-server-and-test 'yarn dev' http://localhost:3000 'yarn cypress:open'", | ||
"test:cypress:run": "yarn cypress:run", | ||
"test:cypress:run:mobile": "yarn cypress:run --config viewportWidth=375,viewportHeight=667", | ||
"test:cypress:open": "yarn cypress:open", | ||
"test:cypress:open:mobile": "yarn cypress:open --config viewportWidth=375,viewportHeight=667" | ||
}, | ||
"dependencies": { | ||
"druxt-auth": "^0.1.0", | ||
"druxt-site": "link:../../../packages/druxt-site", | ||
"druxt-site": "link:../../packages/druxt-site", | ||
"nuxt": "latest" | ||
}, | ||
"devDependencies": { | ||
"@nuxt/postcss8": "latest", | ||
"@nuxtjs/storybook": "latest", | ||
"postcss": "latest" | ||
"cypress": "^10.3.0", | ||
"postcss": "latest", | ||
"start-server-and-test": "^1.14.0" | ||
} | ||
} |
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,10 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
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,28 @@ | ||
it('Umami: Homepage', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// Language Switcher block. | ||
const languageBlock = '[data-fetch-key^="DruxtBlockLanguageBlock"]' | ||
|
||
// I see an English link in the LanguageBlock. | ||
cy.get(languageBlock) | ||
.find('li') | ||
.should('have.length', 2) | ||
.first() | ||
.should('have.text', 'English') | ||
|
||
// And I see a Spanish link in the LanguageBlock. | ||
cy.get(languageBlock) | ||
.find('li') | ||
.last() | ||
.should('have.text', 'Spanish') | ||
|
||
// Account menu should have a login link. | ||
const accountMenu = '[data-fetch-key^="DruxtMenu:account"]' | ||
cy.get(accountMenu) | ||
.find('li') | ||
.should('have.length', 1) | ||
.first() | ||
.should('have.text', 'Log in') | ||
}) |
Empty file.
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,65 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
|
||
// Cypress.Commands.add("login", ({ username = 'admin' }, { password = 'admin' }, { rememberUser = false } = {}) => { | ||
|
||
// const signInUrl = "http://localhost:3000" | ||
// const signInPath = "/user/login" | ||
// cy.visit(signInUrl + signInPath) | ||
|
||
// const log = Cypress.log({ | ||
// name: "login", | ||
// displayName: "LOGIN", | ||
// message: [`🔐 Authenticating | ${username}`], | ||
// // @ts-ignore | ||
// autoEnd: false, | ||
// }); | ||
|
||
// log.snapshot("before"); | ||
|
||
// // Fill out login form fields. | ||
// cy.get("#edit-name").type(username); | ||
// cy.get("edit-pass").type(password); | ||
|
||
// // Submit login form. | ||
// cy.get("edit-submit").click(); | ||
|
||
// cy.wait("@loginUser").then((loginUser: any) => { | ||
// log.set({ | ||
// consoleProps() { | ||
// return { | ||
// username, | ||
// password, | ||
// // userId: loginUser.response.statusCode !== 401 && loginUser.response.body.user.id, | ||
// }; | ||
// }, | ||
// }); | ||
|
||
// log.snapshot("after"); | ||
// log.end(); | ||
// }); | ||
// }); | ||
|
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,20 @@ | ||
// *********************************************************** | ||
// 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 | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.