mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-05 11:40:06 +00:00
chore: cypress added and sasjs test written
This commit is contained in:
12
cypress.json
Normal file
12
cypress.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"chromeWebSecurity": false,
|
||||||
|
"defaultCommandTimeout": 20000,
|
||||||
|
"env": {
|
||||||
|
"sasjsTestsUrl": "",
|
||||||
|
"username": "",
|
||||||
|
"password": "",
|
||||||
|
"screenshotOnRunFailure": false,
|
||||||
|
"testingFinishTimeout": 10000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
5
cypress/fixtures/example.json
Normal file
5
cypress/fixtures/example.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
30
cypress/integration/sasjs.tests.ts
Normal file
30
cypress/integration/sasjs.tests.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
const sasjsTestsUrl = Cypress.env('sasjsTestsUrl')
|
||||||
|
const username = Cypress.env('username')
|
||||||
|
const password = Cypress.env('password')
|
||||||
|
const testingFinishTimeout = Cypress.env('testingFinishTimeout')
|
||||||
|
|
||||||
|
context('sasjs-tests', function() {
|
||||||
|
this.beforeAll(() => {
|
||||||
|
cy.visit(sasjsTestsUrl)
|
||||||
|
})
|
||||||
|
|
||||||
|
it ('Should have all tests successfull', (done) => {
|
||||||
|
cy.get('body').then($body => {
|
||||||
|
if ($body.find('input[placeholder="User Name"]').length > 0) {
|
||||||
|
cy.get('input[placeholder="User Name"]').type(username)
|
||||||
|
cy.get('input[placeholder="Password"]').type(password)
|
||||||
|
cy.get('.submit-button').click()
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.get('input[placeholder="User Name"]', {timeout: 40000}).should('not.exist').then(() => {
|
||||||
|
cy.get('.ui.massive.icon.primary.left.labeled.button').click().then(() => {
|
||||||
|
cy.get('.ui.massive.loading.primary.button').should('not.exist').then(() => {
|
||||||
|
cy.get('span.icon.failed', {timeout: testingFinishTimeout}).should('not.exist').then(() => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
31
cypress/plugins/cy-ts-preprocessor.js
Normal file
31
cypress/plugins/cy-ts-preprocessor.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
const wp = require('@cypress/webpack-preprocessor')
|
||||||
|
|
||||||
|
const webpackOptions = {
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.ts', '.js']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.ts$/,
|
||||||
|
loaders: ['ts-loader', 'angular2-template-loader'],
|
||||||
|
exclude: [/node_modules/],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(html|css)$/,
|
||||||
|
loader: 'raw-loader',
|
||||||
|
exclude: /\.async\.(html|css)$/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.async\.(html|css)$/,
|
||||||
|
loaders: ['file?name=[name].[hash].[ext]', 'extract']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
webpackOptions
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = wp(options)
|
||||||
42
cypress/plugins/index.js
Normal file
42
cypress/plugins/index.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/// <reference types="cypress" />
|
||||||
|
// ***********************************************************
|
||||||
|
// This example plugins/index.js 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)
|
||||||
|
|
||||||
|
const wp = require("@cypress/webpack-preprocessor");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Cypress.PluginConfig}
|
||||||
|
*/
|
||||||
|
module.exports = (on, config) => {
|
||||||
|
// `on` is used to hook into various events Cypress emits
|
||||||
|
// `config` is the resolved Cypress config
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
webpackOptions: require("../webpack.config.js")
|
||||||
|
};
|
||||||
|
on("file:preprocessor", wp(options));
|
||||||
|
|
||||||
|
on("before:browser:launch", (browser = {}, launchOptions) => {
|
||||||
|
if (browser.name === "chrome") {
|
||||||
|
launchOptions.args.push("--disable-site-isolation-trials");
|
||||||
|
launchOptions.args.push("--auto-open-devtools-for-tabs");
|
||||||
|
launchOptions.args.push("--aggressive-cache-discard")
|
||||||
|
launchOptions.args.push("--disable-cache")
|
||||||
|
launchOptions.args.push("--disable-application-cache")
|
||||||
|
launchOptions.args.push("--disable-offline-load-stale-cache")
|
||||||
|
launchOptions.args.push("--disk-cache-size=0")
|
||||||
|
|
||||||
|
return launchOptions;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
25
cypress/support/commands.ts
Normal file
25
cypress/support/commands.ts
Normal file
@@ -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) => { ... })
|
||||||
20
cypress/support/index.js
Normal file
20
cypress/support/index.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// ***********************************************************
|
||||||
|
// 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
|
||||||
|
// ***********************************************************
|
||||||
|
|
||||||
|
// Import commands.js using ES2015 syntax:
|
||||||
|
import './commands.ts'
|
||||||
|
|
||||||
|
// Alternatively you can use CommonJS syntax:
|
||||||
|
// require('./commands')
|
||||||
10
cypress/tsconfig.json
Normal file
10
cypress/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"baseUrl": "../node_modules",
|
||||||
|
"target": "es6",
|
||||||
|
"lib": ["es2019", "dom"],
|
||||||
|
"types": ["cypress"]
|
||||||
|
},
|
||||||
|
"include": ["**/*.ts"]
|
||||||
|
}
|
||||||
23
cypress/webpack.config.js
Normal file
23
cypress/webpack.config.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
module.exports = {
|
||||||
|
mode: "development",
|
||||||
|
resolve: {
|
||||||
|
extensions: [".ts", ".js"]
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.ts$/,
|
||||||
|
exclude: [/node_modules/],
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: "ts-loader",
|
||||||
|
options: {
|
||||||
|
// skip typechecking for speed
|
||||||
|
transpileOnly: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
836
package-lock.json
generated
836
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,8 @@
|
|||||||
"postpublish": "git clean -fd",
|
"postpublish": "git clean -fd",
|
||||||
"semantic-release": "semantic-release",
|
"semantic-release": "semantic-release",
|
||||||
"typedoc": "typedoc",
|
"typedoc": "typedoc",
|
||||||
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks && git config core.autocrlf false || true"
|
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks && git config core.autocrlf false || true",
|
||||||
|
"cypress": "cypress open"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@@ -38,11 +39,13 @@
|
|||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@cypress/webpack-preprocessor": "^5.9.1",
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^26.0.23",
|
||||||
"@types/mime": "^2.0.3",
|
"@types/mime": "^2.0.3",
|
||||||
"@types/tough-cookie": "^4.0.0",
|
"@types/tough-cookie": "^4.0.0",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"cp": "^0.2.0",
|
"cp": "^0.2.0",
|
||||||
|
"cypress": "^7.7.0",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"jest": "^27.0.6",
|
"jest": "^27.0.6",
|
||||||
"jest-extended": "^0.11.5",
|
"jest-extended": "^0.11.5",
|
||||||
|
|||||||
Reference in New Issue
Block a user