-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CyConf followups #5961
CyConf followups #5961
Changes from 36 commits
f7a6f8b
96d1adf
5a453ff
cbc459f
3290283
c1033bc
5890e3b
a60387c
b54487f
ca90ac6
b28fbb4
f379d03
e868bc9
86f39e4
17cd90a
eae7c48
2cbec11
39b513c
070df53
8f96aed
e57bbd3
4c29362
622a233
41066bd
a1f7cd5
66b44a1
f232123
2707d0a
21c6680
431ef2e
e8d78a5
6351829
f624be2
4b7c078
18cdba4
c01633a
e01587e
bf58697
2941dd5
be35162
a37503e
f685b23
a651831
7f20710
4309c08
0bc65c3
3f0b903
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { defineConfig } from "cypress"; | ||
import { readdirSync } from 'fs' | ||
import { join } from 'path' | ||
|
||
export default defineConfig({ | ||
projectId: 'imown1', | ||
viewportHeight: 800, | ||
viewportWidth: 1200, | ||
experimentalMemoryManagement: true, | ||
e2e: { | ||
baseUrl: "http://localhost:3000", | ||
setupNodeEvents(on, config) { | ||
on("task", { | ||
"createFileTree"({ path }) { | ||
// take the given path and create an array of all file paths | ||
// with each files and the directory path of the file as strings | ||
// for example: given 'accessibility' return | ||
// ['accessibility/get-started/introduction', 'accessibility/core-concepts/how-it-works'] | ||
path = 'docs/' + path; | ||
|
||
function walk(dir: string): string[] { | ||
return readdirSync(dir, { withFileTypes: true }).flatMap((file) => { | ||
if (file.name.includes('_category_.json') || file.name.includes('.DS_Store')) { | ||
return [] | ||
} | ||
|
||
if (file.name.includes('.mdx')) { | ||
// remove the .mdx file extension | ||
file.name = file.name.slice(0, -4) | ||
} | ||
|
||
if (file.isDirectory()) { | ||
return walk(join(dir, file.name)) | ||
} else { | ||
return [join(dir, file.name)] | ||
} | ||
}) | ||
} | ||
|
||
return walk(path).filter((file) => file !== undefined).map((file) => file.slice(5)) | ||
} | ||
}) | ||
} | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Visit a11y pages', () => { | ||
before(() => { | ||
cy.task('createFileTree', { path: 'accessibility' }).then((urls) => { | ||
// console.log('urlsLength', urls.length) | ||
Cypress.env({ urls }) | ||
}) | ||
}) | ||
|
||
// Well, this number is hardcoded and should match the length of urls | ||
Cypress._.range(0, 12).forEach(index => { | ||
it(`Visit a11y page ${index} `, () => { | ||
cy.visit(Cypress.env().urls[index]) | ||
cy.get('h1').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Visit API pages', () => { | ||
before(() => { | ||
cy.task('createFileTree', { path: 'api' }).then((urls) => { | ||
// console.log('urlsLength', urls.length) | ||
Cypress.env({ urls }) | ||
}) | ||
}) | ||
|
||
// Well, this number is hardcoded and should match the length of urls | ||
Cypress._.range(0, 132).forEach(index => { | ||
it(`Visit API page ${index} `, () => { | ||
cy.visit(Cypress.env().urls[index]) | ||
cy.get('h1').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Visit App pages', () => { | ||
before(() => { | ||
cy.task('createFileTree', { path: 'app' }).then((urls) => { | ||
console.log('urlsLength', urls.length) | ||
Cypress.env({ urls }) | ||
}) | ||
}) | ||
|
||
// Well, this number is hardcoded and should match the length of urls | ||
Cypress._.range(0, 81).forEach(index => { | ||
it(`Visit App page ${index} `, () => { | ||
cy.visit(Cypress.env().urls[index]) | ||
cy.get('h1').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
describe('Basic tests', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
}) | ||
|
||
it('root reroutes to App ', () => { | ||
cy.url().should('include', '/app/get-started/why-cypress') | ||
}) | ||
|
||
describe('Main Nav', () => { | ||
it('App', () => { | ||
cy.get('nav a').contains('App').click() | ||
cy.url().should('include', '/app/get-started/why-cypress') | ||
cy.get('[aria-current="page"]').should('contain', 'App') | ||
}) | ||
|
||
it('API', () => { | ||
cy.get('nav a').contains('API').click() | ||
cy.url().should('include', '/api/table-of-contents') | ||
cy.get('[aria-current="page"]').should('contain', 'API') | ||
}) | ||
|
||
it('Cloud', () => { | ||
cy.get('nav a').contains('Cloud').click() | ||
cy.url().should('include', '/cloud/get-started/introduction') | ||
cy.get('[aria-current="page"]').should('contain', 'Cloud') | ||
}) | ||
|
||
it('UI Coverage', () => { | ||
cy.get('nav a').contains('UI Coverage').click() | ||
cy.url().should('include', '/ui-coverage/get-started/introduction') | ||
cy.get('[aria-current="page"]').should('contain', 'UI Coverage') | ||
}) | ||
|
||
it('Accessibility', () => { | ||
cy.get('nav a').contains('Accessibility').click() | ||
cy.url().should('include', '/accessibility/get-started/introduction') | ||
cy.get('[aria-current="page"]').should('contain', 'Accessibility') | ||
}) | ||
}) | ||
|
||
describe('Announcement Bar', () => { | ||
it('should close when clicking close btn', () => { | ||
cy.get('[role="banner"]').should('be.visible') | ||
cy.get('.close').click() | ||
cy.get('[role="banner"]').should('not.exist') | ||
}) | ||
}) | ||
|
||
describe('Dark mode', () => { | ||
it('switch to dark mode when clicked', () => { | ||
cy.get('[data-theme=light]').should('have.css', 'background-color', 'rgb(255, 255, 255)') // white | ||
cy.get('[aria-label="Switch to dark mode"]').click() | ||
cy.get('[data-theme=dark]').should('have.css', 'background-color', 'rgb(27, 30, 46)') // dark gray | ||
}) | ||
}) | ||
|
||
describe('Search', () => { | ||
it('search opens search popup', () => { | ||
cy.contains('Search ⌘K').click() | ||
cy.get('.DocSearch-Modal').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Visit Cloud pages', () => { | ||
before(() => { | ||
cy.task('createFileTree', { path: 'cloud' }).then((urls) => { | ||
// console.log('urlsLength', urls.length) | ||
Cypress.env({ urls }) | ||
}) | ||
}) | ||
|
||
// Well, this number is hardcoded and should match the length of urls | ||
Cypress._.range(0, 29).forEach(index => { | ||
it(`Visit Cloud page ${index} `, () => { | ||
cy.visit(Cypress.env().urls[index]) | ||
cy.get('h1').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('Visit UI Cov pages', () => { | ||
before(() => { | ||
cy.task('createFileTree', { path: 'ui-coverage' }).then((urls) => { | ||
console.log('urlsLength', urls.length) | ||
Cypress.env({ urls }) | ||
}) | ||
}) | ||
|
||
// Well, this number is hardcoded and should match the length of urls | ||
Cypress._.range(0, 16).forEach(index => { | ||
it(`Visit UI Cov page ${index} `, () => { | ||
cy.visit(Cypress.env().urls[index]) | ||
cy.get('h1').should('be.visible') | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// <reference types="cypress" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to check this in? |
||
// *********************************************** | ||
// This example commands.ts 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) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should configure this to false There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yah just didn't even look at these, I'll turn them off |
||
// This example support/e2e.ts 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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use this fixture?