-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): introduce cypress e2e testing (carbon-design-system#1451)
* chore(issue-templates): updating issue templates for the website * chore(issue-templates): updating feature request based on feedback * test(e2e): introduce cypress e2e testing * test(e2e): change workflow to only run on upstream * test(e2e): change workflow to only run on upstream * chore(yarn): update yarn offline mirror * fix(github-actions): fix e2e test script name * chore(github-actions): add cache for gatsby builds Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
90d846b
commit 1710a05
Showing
90 changed files
with
795 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/.cache/* | ||
/node_modules/* | ||
.github | ||
tests/e2e/cypress |
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,34 @@ | ||
name: e2e-tests-prod | ||
|
||
on: | ||
schedule: | ||
- cron: "0 */2 * * *" | ||
|
||
concurrency: | ||
group: e2e-tests-prod-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
e2e-tests: | ||
if: github.repository == 'carbon-design-system/carbon-for-ibm-dotcom-website' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['14.x'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
cache: yarn | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Run e2e tests | ||
run: yarn test:e2e:prod | ||
- uses: act10ns/slack@v1 | ||
if: failure() | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
with: | ||
status: ${{ job.status }} |
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,57 @@ | ||
name: e2e-tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
concurrency: | ||
group: e2e-tests-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
e2e-tests: | ||
if: github.repository == 'carbon-design-system/carbon-for-ibm-dotcom-website' | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['14.x'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
cache: yarn | ||
- name: Caching Gatsby | ||
id: gatsby-cache-build | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
public | ||
.cache | ||
key: ${{ runner.os }}-gatsby-build-${{ github.run_id }} | ||
restore-keys: | | ||
${{ runner.os }}-gatsby-build- | ||
- name: Install dependencies | ||
run: yarn install | ||
- name: Set env vars | ||
uses: ./.github/actions/set-dotenv | ||
with: | ||
env-file: .env.production | ||
env: | ||
GATSBY_CPU_COUNT: 1 | ||
- name: Building Gatsby | ||
run: yarn build | ||
env: | ||
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true | ||
CI: true | ||
- name: Run e2e tests | ||
run: yarn test:e2e:local | ||
- uses: act10ns/slack@v1 | ||
if: failure() | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
with: | ||
status: ${{ job.status }} |
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,9 @@ | ||
{ | ||
"*.js": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
], | ||
"*.{css,scss,json,html,yaml,md,mdx}": [ | ||
"prettier --write" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
.yarn | ||
.github | ||
public | ||
tests/e2e/cypress/fixtures |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,14 @@ | ||
{ | ||
"baseUrl": "https://www.ibm.com/standards/carbon", | ||
"browser": "chrome", | ||
"headless": true, | ||
"fixturesFolder": "tests/e2e/cypress/fixtures", | ||
"screenshotsFolder": "tests/e2e/cypress/screenshots", | ||
"videosFolder": "tests/e2e/cypress/videos", | ||
"integrationFolder": "tests/e2e/cypress/integration", | ||
"supportFile": "tests/e2e/cypress/support/index.js", | ||
"pluginsFile": "tests/e2e/cypress/plugins/index.js", | ||
"testFiles": "**/*.e2e.js", | ||
"pageLoadTimeout": 60000, | ||
"defaultCommandTimeout": 60000 | ||
} |
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,14 @@ | ||
{ | ||
"baseUrl": "http://localhost:8080", | ||
"browser": "chrome", | ||
"headless": true, | ||
"fixturesFolder": "tests/e2e/cypress/fixtures", | ||
"screenshotsFolder": "tests/e2e/cypress/screenshots", | ||
"videosFolder": "tests/e2e/cypress/videos", | ||
"integrationFolder": "tests/e2e/cypress/integration", | ||
"supportFile": "tests/e2e/cypress/support/index.js", | ||
"pluginsFile": "tests/e2e/cypress/plugins/index.js", | ||
"testFiles": "**/*.e2e.js", | ||
"pageLoadTimeout": 60000, | ||
"defaultCommandTimeout": 60000 | ||
} |
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,8 @@ | ||
/** | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = {} |
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,25 @@ | ||
/** | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
describe('Homepage', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.viewport(1280, 780); | ||
|
||
cy.waitUntil(() => cy.get('header').should('not.be.empty')); | ||
}); | ||
|
||
it('should have a functioning left navigation', () => { | ||
cy.get('.bx--side-nav__submenu').first().click(); | ||
|
||
cy.get('.bx--side-nav__link').first().should('be.visible').click(); | ||
|
||
cy.location('pathname').should('not.eq', '/'); | ||
}); | ||
}); |
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 @@ | ||
/** | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
}; |
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,8 @@ | ||
/** | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import 'cypress-wait-until'; |
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,15 @@ | ||
/** | ||
* Copyright IBM Corp. 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import './commands'; | ||
|
||
beforeEach(() => { | ||
// Block ibm-common.js | ||
cy.intercept('https://1.www.s81c.com/common/stats/ibm-common.js', { | ||
fixture: 'ibm-common.js', | ||
}); | ||
}); |
Oops, something went wrong.