Skip to content
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

Merged
merged 47 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f7a6f8b
Add notes about Test Replay to UI Cov + a11y guides
jennifer-shehane Oct 22, 2024
96d1adf
Add infos + SEO
jennifer-shehane Oct 22, 2024
5a453ff
Slack integration updates from Emily
jennifer-shehane Oct 22, 2024
cbc459f
more updates
jennifer-shehane Oct 22, 2024
3290283
more SEO + info
jennifer-shehane Oct 22, 2024
c1033bc
Add cypress tests
jennifer-shehane Oct 22, 2024
5890e3b
fix job name
jennifer-shehane Oct 22, 2024
a60387c
make build required also
jennifer-shehane Oct 22, 2024
b54487f
Fix link
jennifer-shehane Oct 22, 2024
ca90ac6
lint fix + add start command
jennifer-shehane Oct 22, 2024
b28fbb4
wait to start to test
jennifer-shehane Oct 22, 2024
f379d03
move to beforeEach
jennifer-shehane Oct 22, 2024
e868bc9
remove start server flow
jennifer-shehane Oct 22, 2024
86f39e4
npx
jennifer-shehane Oct 22, 2024
17cd90a
a
jennifer-shehane Oct 22, 2024
eae7c48
Add wait-on to wait for URL
jennifer-shehane Oct 23, 2024
2cbec11
Remove parallelism since there's only one spec
jennifer-shehane Oct 23, 2024
39b513c
Add test to visit a11y pages
jennifer-shehane Oct 23, 2024
070df53
some styles to address a11y
jennifer-shehane Oct 23, 2024
8f96aed
Add tests for all pages
jennifer-shehane Oct 23, 2024
e57bbd3
fix another link that needs underline in announcement
jennifer-shehane Oct 23, 2024
4c29362
run tests in parallel
jennifer-shehane Oct 23, 2024
622a233
ignore non visitable file
jennifer-shehane Oct 23, 2024
41066bd
Add tests for app pages
jennifer-shehane Oct 23, 2024
a1f7cd5
update config
jennifer-shehane Oct 23, 2024
66b44a1
fix some links
jennifer-shehane Oct 23, 2024
f232123
update links to be case insensitive
jennifer-shehane Oct 23, 2024
2707d0a
Fix broken links
jennifer-shehane Oct 23, 2024
21c6680
some fixes for links
jennifer-shehane Oct 23, 2024
431ef2e
Add titles to all embedded videos
jennifer-shehane Oct 23, 2024
e8d78a5
lint
jennifer-shehane Oct 23, 2024
6351829
Add some more test coverage
jennifer-shehane Oct 23, 2024
f624be2
Add table headers
jennifer-shehane Oct 23, 2024
4b7c078
fix failing tests
jennifer-shehane Oct 23, 2024
18cdba4
Add alt text to images where missing
jennifer-shehane Oct 23, 2024
c01633a
Fix missing alt
jennifer-shehane Oct 23, 2024
e01587e
Update docs/accessibility/core-concepts/how-it-works.mdx
jennifer-shehane Oct 24, 2024
bf58697
Update docs/accessibility/get-started/introduction.mdx
jennifer-shehane Oct 24, 2024
2941dd5
Update docs/api/commands/session.mdx
jennifer-shehane Oct 24, 2024
be35162
Update docs/app/core-concepts/writing-and-organizing-tests.mdx
jennifer-shehane Oct 24, 2024
a37503e
remove unnecessary folders
jennifer-shehane Oct 24, 2024
f685b23
Merge branch 'cy-conf-followups' of https://github.com/cypress-io/cyp…
jennifer-shehane Oct 24, 2024
a651831
Add some missing reroutes
jennifer-shehane Oct 24, 2024
7f20710
Fix reroutes that were missed
jennifer-shehane Oct 24, 2024
4309c08
lint
jennifer-shehane Oct 24, 2024
0bc65c3
disable support file
jennifer-shehane Oct 24, 2024
3f0b903
move supportFile config option to e2e
jennifer-shehane Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
cypress: cypress-io/cypress@3

executors:
node-executor:
resource_class: medium+
Expand Down Expand Up @@ -51,7 +54,27 @@ jobs:
- attach_workspace:
at: ~/repo
- run: npm run lint


install-and-persist:
executor: cypress/default
steps:
- cypress/install
- persist_to_workspace:
root: ~/
paths:
- .cache/Cypress
- project

run-tests-in-parallel:
executor: cypress/default
parallelism: 6
steps:
- attach_workspace:
at: ~/
- cypress/run-tests:
start-command: 'npm run start'
cypress-command: 'npx wait-on http://localhost:3000 && npx cypress run --parallel --record'

release:
<<: *job-defaults
steps:
Expand All @@ -67,15 +90,20 @@ jobs:
node ./scripts/search/scrape-and-compare-algolia-index.mjs

workflows:
version: 2
build-and-test:
jobs:
- build
- lint:
name: "Lint JS/CSS/Markdown"
requires:
- build

- install-and-persist:
name: Install & Persist To Workspace
- run-tests-in-parallel:
name: Run Tests in Parallel
requires:
- build
- Install & Persist To Workspace
# Run Algolia scraper only on main.
- release:
name: 'Run Algolia scraper'
Expand Down
45 changes: 45 additions & 0 deletions cypress.config.ts
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))
}
})
}
},
});
16 changes: 16 additions & 0 deletions cypress/e2e/a11y_pages.cy.ts
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')
})
})
})
16 changes: 16 additions & 0 deletions cypress/e2e/api_pages.cy.ts
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')
})
})
})
16 changes: 16 additions & 0 deletions cypress/e2e/app_pages.cy.ts
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')
})
})
})
64 changes: 64 additions & 0 deletions cypress/e2e/basic_tests.cy.ts
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')
})
})
})
16 changes: 16 additions & 0 deletions cypress/e2e/cloud_pages.cy.ts
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')
})
})
})
16 changes: 16 additions & 0 deletions cypress/e2e/ui_cov_pages.cy.ts
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')
})
})
})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
Copy link
Member

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?

"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
Copy link
Member

Choose a reason for hiding this comment

The 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>
// }
// }
// }
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should configure this to false

Copy link
Member Author

Choose a reason for hiding this comment

The 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')
4 changes: 2 additions & 2 deletions docs/accessibility/core-concepts/how-it-works.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ This means that a 100% axe score does not mean all possible accessibility errors

The value of this form of testing in Cypress Accessibility is to give you fast, reliable, easy-to-understand feedback about common accessibility mistakes that are found in most projects. Providing these results automatically as part of your test run means that you can find and fix these issues with minimal friction, shifting accessibility left in your software development lifecycle.

## Test Replay limitations
## Powered by Test Replay

Because Cypress Accessibility uses data captured through the Test Replay protocol, it is subject to any [limitations of that protocol](https://docs.cypress.io/faq/questions/cloud-faq#Is-everything-captured-and-replayed-in-Test-Replay) related to data capture or browser support.
Because Cypress Accessibility uses data captured through Cypress Test Replay, it is subject to any [limitations of Test Replay](https://docs.cypress.io/faq/questions/cloud-faq#Is-everything-captured-and-replayed-in-Test-Replay) data captured and browser support.
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions docs/accessibility/get-started/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Cypress Accessibility generates a sortable, filterable report, to see scores and

## How are reports created?

:::caution

Cypress Accessibility generates reports using [Test Replay](/cloud/features/test-replay) data and requires Cypress v13+.
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved

:::

Cypress Cloud generates an accessibility report for each unique state reached during your tests on a given Cypress run. This includes pages visited in end-to-end tests, as well as individual components rendered in component tests, and any states or pages that were encountered as a result of interactions performed during test execution.

All of these page or component states are detected using the same protocol that powers [Test Replay](/cloud/features/test-replay), meaning no additional code or setup is needed anywhere in your tests.
Expand Down
5 changes: 4 additions & 1 deletion docs/api/commands/origin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ Cypress.Commands.add('login', (username, password) => {

### How to Test Multiple Origins

<DocsVideo src="https://youtube.com/embed/Fohrq5GZSD8" />
<DocsVideo
src="https://youtube.com/embed/Fohrq5GZSD8"
title="How to test multiple domains or origins with Cypress"
/>

In this video we walk through how to test multiple origins in a single test. We
also look at how to use the `cy.session()` command to cache session information
Expand Down
3 changes: 1 addition & 2 deletions docs/api/commands/scrollintoview.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: scrollIntoView
slug: /api/commands/scrollIntoView
---

Scroll an element into view.
Expand Down Expand Up @@ -131,4 +130,4 @@ console outputs the following:

## See also

- [`cy.scrollTo()`](/api/commands/scrollTo)
- [`cy.scrollTo()`](/api/commands/scrollto)
3 changes: 1 addition & 2 deletions docs/api/commands/scrollto.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: scrollTo
slug: /api/commands/scrollTo
---

Scroll to a specific position.
Expand Down Expand Up @@ -224,4 +223,4 @@ following:

## See also

- [`.scrollIntoView()`](/api/commands/scrollIntoView)
- [`.scrollIntoView()`](/api/commands/scrollintoview)
Loading