Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/main_text-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
npm install
npm run build:azure
npm run test:headless
npm run e2e:headless

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main_text-compare2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
npm install
npm run build:azure
npm run test:headless
npm run e2e:headless

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ npm-debug.log
yarn-error.log
testem.log
/typings
/cypress/videos/

# System Files
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"base": "dist"
},
"index": "src/index.html",
"tsConfig": "src/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"polyfills": [
"src/polyfills.ts"
],
Expand Down Expand Up @@ -176,7 +176,7 @@
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"tsConfig": "tsconfig.spec.json",
"scripts": [],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ stages:
npm run test:headless
displayName: 'Run unit tests (headless)'

- script: |
# Run e2e tests in headless Chrome
npm run e2e:headless
displayName: 'Run e2e tests (headless)'

- stage: Build
displayName: 'Build'
dependsOn:
Expand Down
9 changes: 9 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"integrationFolder": "cypress/integration",
"supportFile": "cypress/support/index.ts",
"videosFolder": "cypress/videos",
"screenshotsFolder": "cypress/screenshots",
"pluginsFile": "cypress/plugins/index.js",
"fixturesFolder": "cypress/fixtures",
"baseUrl": "https://text-compare.netlify.app/"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
32 changes: 32 additions & 0 deletions cypress/integration/home.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// <reference types="Cypress" />

describe('Text Compare App', () => {
beforeEach(() => {
cy.visit('https://text-compare.netlify.app/');
});

it('should display the app name on the home page', () => {
cy.visit('/');
cy.contains('Text Compare');
cy.contains('Netlify');
cy.get('h1').should('contain.text', 'Text Compare');
});

it('should display two text boxes and a compare button', () => {
cy.visit('/');
cy.get('#editor1').should('be.visible');
cy.get('#editor2').should('be.visible');
cy.contains('button', 'Compare').should('be.visible');
});

it('should compare two text inputs', () => {
const left = 'Hello World';
const right = 'Hello world';

cy.get('#editor1').clear().type(left);
cy.get('#editor2').clear().type(right);

cy.contains('button', 'Compare').click();
cy.get('#diffeditor').should('be.visible');
});
});
1 change: 1 addition & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = (on, config) => {};
43 changes: 43 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// ***********************************************
// This example namespace declaration will help
// with Intellisense and code completion in your
// IDE or Text Editor.
// ***********************************************
// declare namespace Cypress {
// interface Chainable<Subject = any> {
// customCommand(param: any): typeof customCommand;
// }
// }
//
// function customCommand(param: any): void {
// console.warn(param);
// }
//
// NOTE: You can use it like so:
// Cypress.Commands.add('customCommand', customCommand);
//
// ***********************************************
// 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) => { ... })
17 changes: 17 additions & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.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
// ***********************************************************

// When a command from ./commands is ready to use, import with `import './commands'` syntax
// import './commands';
8 changes: 8 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"include": ["**/*.cy.ts"],
"compilerOptions": {
"sourceMap": false,
"types": ["cypress"]
}
}
4 changes: 3 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const compat = new FlatCompat({
export default defineConfig([globalIgnores([
".angular/*",
"projects/**/*",
"cypress/*",
"dist/*",
"coverage/*",
"**/*.d.ts",
Expand Down Expand Up @@ -168,7 +169,8 @@ export default defineConfig([globalIgnores([
"@typescript-eslint/no-inferrable-types": ["error", {
ignoreParameters: true,
}],

"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
Expand Down
Loading