Skip to content

Commit

Permalink
Merge pull request #222 from ElioDiNino/refactor/v4
Browse files Browse the repository at this point in the history
refactor: v4 of the website
  • Loading branch information
ElioDiNino authored Aug 4, 2024
2 parents fbbe936 + f73cfc6 commit 66828f8
Show file tree
Hide file tree
Showing 37 changed files with 1,628 additions and 938 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v4
4 changes: 4 additions & 0 deletions website/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore artifacts:
build
coverage
node_modules
3 changes: 3 additions & 0 deletions website/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
45 changes: 22 additions & 23 deletions website/applitools.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
// It applies to all tests in this project.

module.exports = {
// Concurrency refers to the number of visual checkpoints Applitools will perform in parallel.
testConcurrency: 5,

// Concurrency refers to the number of visual checkpoints Applitools will perform in parallel.
testConcurrency: 5,
// To connect visual test results to your account,
// you must set the `APPLITOOLS_API_KEY` environment variable to your Applitools API key.
// To find it: https://applitools.com/tutorials/getting-started/setting-up-your-environment.html
// If you don't explicitly set the API key here,
// then the SDK will automatically read the `APPLITOOLS_API_KEY` environment variable to fetch it.
apiKey: 'APPLITOOLS_API_KEY',

// To connect visual test results to your account,
// you must set the `APPLITOOLS_API_KEY` environment variable to your Applitools API key.
// To find it: https://applitools.com/tutorials/getting-started/setting-up-your-environment.html
// If you don't explicitly set the API key here,
// then the SDK will automatically read the `APPLITOOLS_API_KEY` environment variable to fetch it.
apiKey: 'APPLITOOLS_API_KEY',
// A batch is the collection of visual checkpoints for a test suite.
// Batches are displayed in the Eyes Test Manager, so use meaningful names.
batchName: 'Full Site Evaluation',

// A batch is the collection of visual checkpoints for a test suite.
// Batches are displayed in the Eyes Test Manager, so use meaningful names.
batchName: 'Full Site Evaluation',
// Applitools can run checkpoints for snapshots against any browser in the Ultrafast Grid.
// This setting defines 5 unique browser configurations to test.
browser: [
{ width: 3840, height: 2160, name: 'chrome' },
{ width: 1600, height: 1200, name: 'firefox' },
{ width: 1024, height: 768, name: 'safari' },

// Applitools can run checkpoints for snapshots against any browser in the Ultrafast Grid.
// This setting defines 5 unique browser configurations to test.
browser: [
{width: 3840, height: 2160, name: 'chrome'},
{width: 1600, height: 1200, name: 'firefox'},
{width: 1024, height: 768, name: 'safari'},

{deviceName: 'iPhone 11', screenOrientation: 'portrait'},
{deviceName: 'Pixel 2', screenOrientation: 'landscape'},
{deviceName: 'Galaxy S22', screenOrientation: 'portrait'},
]
}
{ deviceName: 'iPhone 11', screenOrientation: 'portrait' },
{ deviceName: 'Pixel 2', screenOrientation: 'landscape' },
{ deviceName: 'Galaxy S22', screenOrientation: 'portrait' },
],
};
20 changes: 11 additions & 9 deletions website/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineConfig } from "cypress";
import eyesPlugin from '@applitools/eyes-cypress'
import { defineConfig } from 'cypress';
import eyesPlugin from '@applitools/eyes-cypress';

export default eyesPlugin(defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
// implement node event listeners here
export default eyesPlugin(
defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
},
}));
}),
);
50 changes: 28 additions & 22 deletions website/cypress/e2e/contact.cy.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
/// <reference types="cypress" />

describe('Contact Page', () => {
beforeEach(() => {
cy.visit('/contact')
})
beforeEach(() => {
cy.visit('/contact');
});

it('Contact Page Layout', () => {
cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
})
cy.eyesCheckWindow({
tag: "Contact Page",
target: 'window',
fully: true,
});
it('Contact Page Layout', () => {
cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
});
cy.eyesCheckWindow({
tag: 'Contact Page',
target: 'window',
fully: true,
});

cy.contains('Submit')
cy.eyesClose()
})
cy.contains('Submit');
cy.eyesClose();
});

it('Contact Page Form', () => {
cy.get('input[name="user_name"]').type('Elio Di Nino').should('have.value', 'Elio Di Nino')
cy.get('input[name="user_email"]').type('[email protected]').should('have.value', '[email protected]')
cy.get('textarea[name="message"]').type('This is a test message').should('have.value', 'This is a test message')
})
})
it('Contact Page Form', () => {
cy.get('input[name="user_name"]')
.type('Elio Di Nino')
.should('have.value', 'Elio Di Nino');
cy.get('input[name="user_email"]')
.type('[email protected]')
.should('have.value', '[email protected]');
cy.get('textarea[name="message"]')
.type('This is a test message')
.should('have.value', 'This is a test message');
});
});
44 changes: 22 additions & 22 deletions website/cypress/e2e/home.cy.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/// <reference types="cypress" />

describe('Home Page', () => {
beforeEach(() => {
cy.visit('/')
beforeEach(() => {
cy.visit('/');

cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
})
})
cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
});
});

it('Home Page Layout', () => {
cy.contains('Resume')
cy.contains('Links')
cy.contains('GitHub')
it('Home Page Layout', () => {
cy.contains('Resume');
cy.contains('Links');
cy.contains('GitHub');

cy.eyesCheckWindow({
tag: "Home Page",
target: 'window',
fully: true,
matchLevel: 'Layout'
});
})
cy.eyesCheckWindow({
tag: 'Home Page',
target: 'window',
fully: true,
matchLevel: 'Layout',
});
});

afterEach(() => {
cy.eyesClose()
})
})
afterEach(() => {
cy.eyesClose();
});
});
62 changes: 31 additions & 31 deletions website/cypress/e2e/links.cy.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
/// <reference types="cypress" />

describe('Links Page', () => {
beforeEach(() => {
cy.visit('/links')
// Wait up to 10 seconds for the background image to load
cy.get('.background', { timeout: 10000 })
.should('be.visible')
.then($el => {
const url = $el.css('background-image').match(/url\("(.*)"\)/)[1]
cy.request({url, failOnStatusCode: false})
.its('status')
.should('eq', 200)
})
.wait(1000)
beforeEach(() => {
cy.visit('/links');
// Wait up to 10 seconds for the background image to load
cy.get('.background', { timeout: 10000 })
.should('be.visible')
.then(($el) => {
const url = $el.css('background-image').match(/url\("(.*)"\)/)[1];
cy.request({ url, failOnStatusCode: false })
.its('status')
.should('eq', 200);
})
.wait(1000);

cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
})
})
cy.eyesOpen({
appName: 'Personal Website',
testName: Cypress.currentTest.title,
});
});

it('Links Page Layout', () => {
cy.eyesCheckWindow({
tag: "Links Page",
target: 'window',
fully: true,
});
it('Links Page Layout', () => {
cy.eyesCheckWindow({
tag: 'Links Page',
target: 'window',
fully: true,
});

cy.contains('Website')
cy.contains('Contact')
cy.contains('Resume')
})
cy.contains('Website');
cy.contains('Contact');
cy.contains('Resume');
});

afterEach(() => {
cy.eyesClose()
})
})
afterEach(() => {
cy.eyesClose();
});
});
2 changes: 1 addition & 1 deletion website/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
// }
7 changes: 3 additions & 4 deletions website/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
// https://on.cypress.io/configuration
// ***********************************************************

import '@applitools/eyes-cypress/commands'

import '@applitools/eyes-cypress/commands';

// Import commands.js using ES2015 syntax:
import './commands'
import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
// require('./commands')
2 changes: 1 addition & 1 deletion website/cypress/support/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "@applitools/eyes-cypress"
import '@applitools/eyes-cypress';
14 changes: 7 additions & 7 deletions website/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
Loading

0 comments on commit 66828f8

Please sign in to comment.