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

feat: E2E testing #780

Merged
merged 28 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ Supports [evergreen](https://nuxt.com/blog/v3#the-browser-and-nodejs-support) br
The core browser set targets the 2 most recent major versions of Chrome, Firefox, and Edge on a monthly basis and Safari
on a yearly basis.

## Tooling
## Testing

This project uses [Applitools Visual AI](https://applitools.com/) as part of its automated testing.
This project uses [Cypress](https://cypress.io/) for e2e testing. Tests can be executed using the command ```yarn e2e:open```.

## Contribution

Expand Down
23 changes: 23 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from 'cypress'

export default defineConfig({
env: {
accountAddress: 'ak_gZ55FLJoGEfF5gJ2xJU7j9uSH3fEjoTZq3ygQG8gYA4no6GFW',
contractAddress: 'ct_s5ZB6cGCqS5QbUboQBK8CWwpknKRSajrt8b1EQRp4t4R5D47e',
microblockAddress: 'mh_27HKqcut9U9xDwEAf3Lz6evTxY4rfy7odKeSnQaqu45iQesjyj',
nftAddress: 'ct_2UVjVLvt2NycqbfJWywixyYm68iVvkiVS9wubiQRjp9WeQtfpK',
transactionAddress: 'th_2Yafj84tsuxskvJnzqGcvthrpDUX8gZE84RXVUwXvkSJxmxbc1',
oracleAddress: 'ok_2w2Gkp9mwThn6jWdJi5Leuh3P5Zj7oJ6gyoHa8KnKzWwEVSnKf',
tokenAddress: 'ct_2qyFRzXzTyPCtPKZQ32EPXqxxAcgiWqtADV3amcBVVPYQRKZm7',
stateChannelAddress: 'ch_2Qo4r6u3Bq1ZMnPL7GpjLLsATaEgMK5BnYnoi68hzLL5QuKbev',
name: 'testaensrawpointers.chain',
keyblockId: '947025',
},
e2e: {
baseUrl: 'http://localhost:8080',
experimentalRunAllSpecs: true,
},
viewportWidth: 1280,
viewportHeight: 720,
defaultCommandTimeout: 30000,
})
17 changes: 17 additions & 0 deletions cypress/e2e/app/accountDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('account detail', () => {
it('should display account detail', () => {
cy.visit(`/accounts/${Cypress.env('accountAddress')}`)

cy.get('.account-details-panel').should('be.visible')
cy.get('.account-activities-panel table').should('be.visible')

cy.contains('.tabs__item', 'Transactions').click()
cy.get('.account-transactions-panel table').should('be.visible')

cy.contains('.tabs__item', 'AENS Names').click()
cy.get('.account-names-panel table').should('be.visible')

cy.contains('.tabs__item', 'Tokens').click()
cy.get('.account-tokens-panel table').should('be.visible')
})
})
15 changes: 15 additions & 0 deletions cypress/e2e/app/contractDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('contract detail', () => {
it('should display contract detail', () => {
cy.visit(`/contracts/${Cypress.env('contractAddress')}`)

cy.get('.contract-details-panel').should('be.visible')
cy.get('.contract-call-transactions-panel table').should('be.visible')

cy.contains('.tabs__item', 'Events').click()
cy.get('.contract-events-panel table').should('be.visible')

cy.contains('.tabs__item', 'Contract').click()
cy.get('.contract-verified-table').should('be.visible')
cy.get('.code-editor').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/contracts.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('contracts', () => {
it('should display contracts', () => {
cy.visit('/contracts')

cy.get('.contracts-table').should('be.visible')
cy.get('.line-chart').should('be.visible')
})
})
12 changes: 12 additions & 0 deletions cypress/e2e/app/homepage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('homepage', () => {
it('should display homepage', () => {
cy.visit('/')

cy.get('.stats-panel').should('be.visible')
cy.get('.dashboard-state-channels-panel table').should('be.visible')
cy.get('.dashboard-auctions-panel table').should('be.visible')
cy.get('.dashboard-names-panel table').should('be.visible')
cy.get('.dashboard-keyblock-panel table').should('be.visible')
cy.get('.search-bar').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/keyblockDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('keyblock details', () => {
it('should display keyblock detail', () => {
cy.visit(`/keyblocks/${Cypress.env('keyblockId')}`)

cy.get('.keyblock-details-panel__controls').should('be.visible')
cy.get('.keyblock-microblock-panel').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/microblockDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('microblock details', () => {
it('should display microblock detail', () => {
cy.visit(`/microblocks/${Cypress.env('microblockAddress')}`)

cy.get('.microblock-details-panel table').should('be.visible')
cy.get('.microblock-transactions-panel table').should('be.visible')
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/app/nameDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('name detail', () => {
it('should display name detail', () => {
cy.visit(`/names/${Cypress.env('name')}`)

cy.get('.name-details-panel').should('be.visible')
cy.get('.name-pointers-special-panel table').should('be.visible')
cy.get('.name-history-panel table').should('be.visible')
})
})
14 changes: 14 additions & 0 deletions cypress/e2e/app/names.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('names', () => {
it('should display names', () => {
cy.visit('/names')

cy.get('.line-chart').should('be.visible')
cy.get('.names-active-table').should('be.visible')

cy.contains('.tabs__item', 'In Auction').click()
cy.get('.names-in-auction-table').should('be.visible')

cy.contains('.tabs__item', 'Expired').click()
cy.get('.names-expired-table').should('be.visible')
})
})
11 changes: 11 additions & 0 deletions cypress/e2e/app/nftDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('nft detail', () => {
it('should display nft detail', () => {
cy.visit(`/nfts/${Cypress.env('nftAddress')}`)

cy.get('.nfts-details-panel table').should('be.visible')
cy.get('.nfts-transfers-table').should('be.visible')

cy.contains('.tabs__item', 'Inventory').click()
cy.get('.nfts-owners-panel__table').should('be.visible')
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/app/nfts.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('nfts', () => {
it('should display nfts', () => {
cy.visit('/nfts')

cy.get('.nfts-table').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/oracleDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('oracle detail', () => {
it('should display oracle detail', () => {
cy.visit(`/oracles/${Cypress.env('oracleAddress')}`)

cy.get('.oracle-details-panel table').should('be.visible')
cy.get('.oracle-events-panel table').should('be.visible')
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/app/oracles.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('oracles', () => {
it('should display oracles', () => {
cy.visit('/oracles')

cy.get('.oracles-table').should('be.visible')
})
})
19 changes: 19 additions & 0 deletions cypress/e2e/app/search.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe('search', () => {
it('should display search', () => {
cy.visit('/')

// loading waiting workaround
cy.get('.stats-panel').should('be.visible')

cy.get('.search-bar__input').type('c')
cy.get('.search-bar__submit').click()

cy.get('.search-names-table').should('be.visible')

cy.contains('.tabs__item', 'Tokens').click()
cy.get('.search-tokens-table').should('be.visible')

cy.contains('.tabs__item', 'NFTs').click()
cy.get('.search-nfts-table').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/stateChannelDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('state channel detail', () => {
it('should display state channel detail', () => {
cy.visit(`/state-channels/${Cypress.env('stateChannelAddress')}`)

cy.get('.state-channel-details-panel table').should('be.visible')
cy.get('.state-channel-transactions-panel table').should('be.visible')
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/app/stateChannels.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('state channels', () => {
it('should display oracles', () => {
cy.visit('/state-channels')

cy.get('.state-channels-table').should('be.visible')
})
})
11 changes: 11 additions & 0 deletions cypress/e2e/app/tokenDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('token detail', () => {
it('should display token detail', () => {
cy.visit(`/tokens/${Cypress.env('tokenAddress')}`)

cy.get('.token-details-panel table').should('be.visible')
cy.get('.token-holders-panel table').should('be.visible')

cy.contains('.tabs__item', 'Events').click()
cy.get('.token-events-panel table').should('be.visible')
})
})
7 changes: 7 additions & 0 deletions cypress/e2e/app/tokens.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('tokens', () => {
it('should display tokens', () => {
cy.visit('/tokens')

cy.get('.tokens-panel').should('be.visible')
})
})
8 changes: 8 additions & 0 deletions cypress/e2e/app/transactionDetail.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('transaction detail', () => {
it('transaction detail', () => {
cy.visit(`/transactions/${Cypress.env('transactionAddress')}`)

cy.get('.transaction-general-panel table').should('be.visible')
cy.get('.transaction-type-panel table').should('be.visible')
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/app/transactions.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('transactions', () => {
it('should display transactions', () => {
cy.visit('/transactions')

cy.get('.transactions-table').should('be.visible')
cy.get('.line-chart').should('be.visible')
cy.get('.transaction-statistics__panel').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 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"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" />
// ***********************************************
// 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 @@
// ***********************************************************
// 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')
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"lint:fix": "yarn lint:js --fix && yarn lint:style --fix",
"lint:js": "eslint --ext .ts,.js,.vue src",
"lint:style": "stylelint \"./src/**/*.vue\" \"src/**/*.css\"",
"reinstall": "rm -rf node_modules/ && yarn cache clean && yarn install"
"reinstall": "rm -rf node_modules/ && yarn cache clean && yarn install",
"e2e:run": "cypress run",
"e2e:open": "cypress open"
},
"dependencies": {
"@aeternity/aepp-sdk": "^13.3.2",
Expand Down Expand Up @@ -56,6 +58,7 @@
"@nuxtjs/plausible": "^0.2.4",
"@pinia/nuxt": "^0.5.1",
"@vitejs/plugin-vue": "^5.0.4",
"cypress": "^13.8.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
Expand Down
9 changes: 3 additions & 6 deletions src/components/ContractVerifiedTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<table class="contract-verified-table__table">
<table class="contract-verified-table">
<tr class="contract-verified-table__row">
<th class="contract-verified-table__header">
License
Expand Down Expand Up @@ -74,10 +74,8 @@ defineProps({

<style scoped>
.contract-verified-table {
&__table {
padding: 0 var(--space-1) var(--space-7);
margin-bottom: var(--space-5);
}
padding: 0 var(--space-1) var(--space-7);
margin-bottom: var(--space-5);

&__header {
border-bottom: 1px solid var(--color-midnight-25);
Expand All @@ -90,6 +88,5 @@ defineProps({
&__data {
text-align: right;
}

}
</style>
2 changes: 1 addition & 1 deletion src/components/DashboardNamesPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<app-panel class="names-panel">
<app-panel class="dashboard-names-panel">
<dashboard-panel-header
level="h3"
title="NAMES RECENTLY ACTIVATED"
Expand Down
1 change: 0 additions & 1 deletion src/components/TheFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const links = {
{ label: 'Middleware API documentation', url: `${MIDDLEWARE_URL}/swagger` },
{ label: 'Contribute on Github', url: 'https://github.com/aeternity/aescan' },
{ label: 'Join the Forum', url: 'https://forum.aeternity.com' },

],
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenHoldersPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<app-panel>
<app-panel class="token-holders-panel">
<paginated-content
:entities="tokenHolders"
@prev-clicked="loadPrevHolders"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/transactions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</template>
</page-header>
<template v-if="!isLoading">
<transactions-stats class="transactions-panel"/>
<transactions-statistics class="transactions-panel"/>
<transactions-chart-panel
:has-select="false"
:range="CHART_INTERVALS_OPTIONS[0]"
Expand Down
Loading
Loading