-
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(#562): add cypress tests to docs site * chore(#562): add druxtjs.org test job to ci * chore(#562): add additional test coverage
- Loading branch information
Showing
14 changed files
with
1,232 additions
and
49 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 |
---|---|---|
@@ -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,13 @@ | ||
it('DruxtJS.org: API documentation', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// Then I click on "API documentation" | ||
cy.get('.hero .btn-primary').click() | ||
|
||
// And I should be on "/api" | ||
cy.url().should('include', '/api') | ||
|
||
// And I should see the "API Documentation" heading. | ||
cy.get('.text-4xl').should('have.text', 'API Documentation') | ||
}) |
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,13 @@ | ||
it('DruxtJS.org: Get started', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// Then I click on "Get Started" | ||
cy.get('.hero .btn-secondary').click() | ||
|
||
// And I should be on "/guide" | ||
cy.url().should('include', '/guide') | ||
|
||
// And I should see the "Guide" heading. | ||
cy.get('.text-4xl').should('have.text', 'Guide') | ||
}) |
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 @@ | ||
it('DruxtJS.org: Homepage', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// I should see the Navbar | ||
cy.get('.navbar').should('exist') | ||
|
||
// And I should see the Hero block | ||
// And have a heading of DruxtJS | ||
cy.get('.hero').should('exist') | ||
.find('.text-5xl').should('have.text', 'DruxtJS') | ||
|
||
// And I should see the CTAs: | ||
// - Get Started | ||
cy.get('.hero .btn-secondary').should('have.text', 'Get started') | ||
// - Druxt Modules | ||
cy.get('.hero .btn-accent').should('have.text', 'Druxt modules') | ||
// - API Documentation | ||
cy.get('.hero .btn-primary').should('have.text', 'API documentation') | ||
}) |
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,13 @@ | ||
it('DruxtJS.org: Modules', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// Then I click on "Modules" | ||
cy.get('.hero .btn-accent').click() | ||
|
||
// And I should be on "/modules" | ||
cy.url().should('include', '/modules') | ||
|
||
// And I should see the "Modules" heading. | ||
cy.get('.text-4xl').should('have.text', '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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
it('DruxtJS.org: Search', () => { | ||
// Given I visit the homepage. | ||
cy.visit('/') | ||
|
||
// Then I open the menu. | ||
cy.get('.navbar > :nth-child(1) > .btn').click() | ||
|
||
// And I search for "Entity". | ||
cy.get('.input').type('Entity') | ||
|
||
// @TODO - Assert results. | ||
}) |
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.