Merge pull request #37 from vegaprotocol/test/Cypress-BDD-integration

Test/cypress bdd integration
This commit is contained in:
Joe Tsang 2022-03-02 16:35:45 +00:00 committed by GitHub
commit 6ae06b1a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1074 additions and 97613 deletions

3
.env
View File

@ -1 +1,4 @@
NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-explorer-api"
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"

View File

@ -0,0 +1,3 @@
{
"stepDefinitions": "src/support/step_definitions"
}

View File

@ -1,12 +1,18 @@
{
"baseUrl": "http://localhost:4200",
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"fixturesFolder": false,
"pluginsFile": "./src/plugins/index.js",
"testFiles": "*.{ts,feature,features}",
"ignoreTestFiles": "**/*.js",
"integrationFolder": "./src/integration",
"modifyObstructiveCode": false,
"supportFile": "./src/support/index.ts",
"pluginsFile": false,
"video": true,
"videosFolder": "../../dist/cypress/apps/explorer-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/explorer-e2e/screenshots",
"chromeWebSecurity": false
"chromeWebSecurity": false,
"env": {
"tsConfig": "tsconfig.json"
}
}

View File

@ -1,13 +0,0 @@
import { getGreeting } from '../support/app.po';
describe('explorer', () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome explorer');
});
});

View File

@ -0,0 +1,4 @@
Feature: Home page
Scenario: Visit Home page
Given I go to the homepage

View File

@ -0,0 +1,75 @@
/// <reference types="cypress" />
const webpackPreprocessor = require('@cypress/webpack-preprocessor');
const webpack = require('webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
on(
'file:preprocessor',
webpackPreprocessor({
webpackOptions: {
resolve: {
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
plugins: [
new TsconfigPathsPlugin({
configFile: config.env.tsConfig,
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
}),
],
fallback: {
path: require.resolve('path-browserify'),
},
},
module: {
rules: [
{
test: /\.([jt])sx?$/,
loader: 'ts-loader',
exclude: [/node_modules/],
options: {
configFile: config.env.tsConfig,
// https://github.com/TypeStrong/ts-loader/pull/685
experimentalWatchApi: true,
transpileOnly: true,
},
},
{
test: /\.feature$/,
use: [
{
loader: 'cypress-cucumber-preprocessor/loader',
},
],
},
{
test: /\.features$/,
use: [
{
loader: 'cypress-cucumber-preprocessor/lib/featuresLoader',
},
],
},
],
},
plugins: [
new ForkTsCheckerWebpackPlugin({
typescript: {
enabled: true,
configFile: config.env.tsConfig,
},
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
externals: [nodeExternals()],
},
})
);
};

View File

@ -0,0 +1,5 @@
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
Given('I go to the homepage', () => {
cy.visit('/');
});

97505
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,8 @@
"@typescript-eslint/parser": "~5.10.0",
"babel-jest": "27.2.3",
"babel-loader": "8.1.0",
"cypress": "^9.1.0",
"cypress": "^9.5.1",
"cypress-cucumber-preprocessor": "^4.3.1",
"eslint": "~8.7.0",
"eslint-config-next": "12.0.7",
"eslint-config-prettier": "8.1.0",

1064
yarn.lock

File diff suppressed because it is too large Load Diff