-
Notifications
You must be signed in to change notification settings - Fork 122
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
Cypress tests #69
Draft
talyguryn
wants to merge
5
commits into
master
Choose a base branch
from
cypress-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Cypress tests #69
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1461bd0
Create bump-version.yml
talyguryn 2487db6
cypress tests initial
talyguryn e9ff5df
Bump version up to 2.6.2
github-actions[bot] 4dbd5dd
Update cypress.yml
talyguryn a39b317
Merge branch 'cypress-tests' of https://github.com/editor-js/header i…
talyguryn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,61 @@ | ||
name: Bump version in PR | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
# If pull request was merged then we should check for a package version update | ||
check-version-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout to target branch | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Get package new version name | ||
- name: Get package info | ||
id: packageNew | ||
uses: codex-team/action-nodejs-package-info@v1 | ||
|
||
# Checkout to the base commit before merge | ||
- name: Checkout to the base commit before merge | ||
run: git checkout ${{ github.event.pull_request.base.sha }} | ||
|
||
# Get package old version name | ||
- name: Get package info | ||
id: packageOld | ||
uses: codex-team/action-nodejs-package-info@v1 | ||
|
||
# Stop workflow and do not bump version if it was changed already | ||
- name: Stop workflow and do not bump version if it was changed already | ||
uses: andymckay/cancel-action@0.2 | ||
if: steps.packageOld.outputs.version != steps.packageNew.outputs.version | ||
|
||
bump-version: | ||
needs: check-version-update | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout to target branch | ||
- uses: actions/checkout@v2 | ||
|
||
# Setup node environment | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 15 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
# Bump version to the next prerelease (patch) with rc suffix | ||
- name: Suggest the new version | ||
run: yarn version --patch --no-git-tag-version | ||
|
||
# Get package new version name | ||
- name: Get package info | ||
id: package | ||
uses: codex-team/action-nodejs-package-info@v1 | ||
|
||
# Commit version upgrade | ||
- uses: EndBug/add-and-commit@v7 | ||
with: | ||
author_name: github-actions | ||
author_email: 41898282+github-actions[bot]@users.noreply.github.com | ||
message: "Bump version up to ${{ steps.package.outputs.version }}" |
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,37 @@ | ||
name: Tests | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
firefox: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: cypress/browsers:node14.16.0-chrome89-ff86 | ||
options: --user 1001 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cypress-io/github-action@v2 | ||
with: | ||
config: video=false | ||
browser: firefox | ||
build: yarn build | ||
|
||
chrome: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cypress-io/github-action@v2 | ||
with: | ||
config: video=false | ||
browser: chrome | ||
build: yarn build | ||
|
||
edge: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cypress-io/github-action@v2 | ||
with: | ||
config: video=false | ||
browser: edge | ||
build: yarn build |
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 @@ | ||
{} |
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 @@ | ||
{} |
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 @@ | ||
{ | ||
"data": { | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"data": {} | ||
} | ||
] | ||
} | ||
} |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Header Tool</title> | ||
</head> | ||
<body> | ||
<div id="editorjs" data-cy="editorjs"></div> | ||
|
||
<script src="../../node_modules/@editorjs/editorjs/dist/editor.js"></script> | ||
<script src="../../dist/bundle.js"></script> | ||
</body> | ||
</html> |
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,21 @@ | ||
import {EditorConfig} from "@editorjs/editorjs"; | ||
|
||
describe('Header', () => { | ||
beforeEach(function () { | ||
/** | ||
* Init editor with an empty header block | ||
*/ | ||
cy.fixture('editor-config-empty-block') | ||
.then(editorConfig => { | ||
cy.initEditor(editorConfig).as('EditorJS'); | ||
}) | ||
}) | ||
|
||
it('should type into block', () => { | ||
const headerContent = 'CodeX Team'; | ||
|
||
cy.getBlock() | ||
.type(headerContent) | ||
.should('contain', headerContent); | ||
}); | ||
}); |
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,61 @@ | ||
import EditorJS, {OutputData} from "@editorjs/editorjs"; | ||
|
||
describe('Saving', () => { | ||
beforeEach(function () { | ||
/** | ||
* Init editor with an empty header block | ||
*/ | ||
cy.fixture('editor-config-empty-block') | ||
.then(editorConfig => { | ||
cy.initEditor(editorConfig).as('EditorJS'); | ||
}); | ||
}) | ||
|
||
it('should save correct type', function () { | ||
const headerContent = 'CodeX Team'; | ||
|
||
cy.getBlock() | ||
.type(headerContent); | ||
|
||
cy.get<EditorJS>('@EditorJS') | ||
.then(editor => { | ||
editor.save() | ||
.then((data: OutputData) => { | ||
console.log(data); | ||
expect(data.blocks[0].type).to.eq('header'); | ||
}); | ||
}) | ||
}); | ||
|
||
it('should save correct data', function () { | ||
const headerContent = 'CodeX Team'; | ||
|
||
cy.getBlock() | ||
.type(headerContent); | ||
|
||
cy.get<EditorJS>('@EditorJS') | ||
.then(editor => { | ||
editor.save() | ||
.then((data: OutputData) => { | ||
console.log(data); | ||
expect(data.blocks[0].data.text).to.eq(headerContent); | ||
}); | ||
}) | ||
}); | ||
|
||
it('should save correct level', function () { | ||
const headerContent = 'CodeX Team'; | ||
|
||
cy.getBlock() | ||
.type(headerContent); | ||
|
||
cy.get<EditorJS>('@EditorJS') | ||
.then(editor => { | ||
editor.save() | ||
.then((data: OutputData) => { | ||
console.log(data); | ||
expect(data.blocks[0].data.level).to.eq(2); | ||
}); | ||
}) | ||
}); | ||
}); |
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,33 @@ | ||
describe('Toolbox icon', () => { | ||
beforeEach(function () { | ||
cy.initEditor().as('EditorJS'); | ||
}) | ||
|
||
it('should render default icon', function () { | ||
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. this test is not related to the Header tool, but to the Editor core |
||
cy.getBlock(); | ||
|
||
cy.getEditor() | ||
.find('div.ce-toolbar__plus') | ||
.click(); | ||
|
||
cy.getEditor() | ||
.find('li.ce-toolbox__button[data-tool=header]') | ||
.should('exist'); | ||
}); | ||
|
||
it('should render block on click on toolbox icon', function () { | ||
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. same |
||
cy.getBlock(); | ||
|
||
cy.getEditor() | ||
.find('div.ce-toolbar__plus') | ||
.click(); | ||
|
||
cy.getEditor() | ||
.find('li.ce-toolbox__button[data-tool=header]') | ||
.click() | ||
|
||
cy.getEditor() | ||
.find('.ce-header') | ||
.should('exist'); | ||
}); | ||
}); |
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 @@ | ||
import {EditorConfig} from "@editorjs/editorjs"; | ||
|
||
describe('Tunes', () => { | ||
context('with default configuration', function () { | ||
beforeEach(function () { | ||
/** | ||
* Init editor with an empty header block | ||
*/ | ||
cy.fixture('editor-config-empty-block') | ||
.then(editorConfig => { | ||
cy.initEditor(editorConfig).as('EditorJS'); | ||
}) | ||
|
||
cy.getBlock() | ||
.openTunes(); | ||
}) | ||
|
||
it('render default items'); | ||
|
||
it('tune click updates header level'); | ||
|
||
it('tune click updates header level and tune icon highlights'); | ||
}) | ||
|
||
context('with user configuration', function () { | ||
|
||
}) | ||
}); |
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,19 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.test.ts can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfig) => { | ||
// `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,25 @@ | ||
// *********************************************** | ||
// 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) => { ... }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.