1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

chore(lint): fixed lint issues in cypress folder

This commit is contained in:
Yury Shkoda
2022-05-12 09:06:52 +03:00
parent dd237ceeec
commit 54a33ac98a
5 changed files with 111 additions and 90 deletions

View File

@@ -3,55 +3,76 @@ const username = Cypress.env('username')
const password = Cypress.env('password') const password = Cypress.env('password')
const testingFinishTimeout = Cypress.env('testingFinishTimeout') const testingFinishTimeout = Cypress.env('testingFinishTimeout')
context('sasjs-tests', function() { context('sasjs-tests', function () {
this.beforeAll(() => { this.beforeAll(() => {
cy.visit(sasjsTestsUrl) cy.visit(sasjsTestsUrl)
})
this.beforeEach(() => {
cy.reload()
})
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', {
timeout: testingFinishTimeout
})
.should('not.exist')
.then(() => {
cy.get('span.icon.failed')
.should('not.exist')
.then(() => {
done()
})
})
})
})
}) })
})
this.beforeEach(() => { it('Should have all tests successfull with debug on', (done) => {
cy.reload() 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()
}
it('Should have all tests successfull', (done) => { cy.get('.ui.fitted.toggle.checkbox label')
cy.get('body').then($body => { .click()
if ($body.find('input[placeholder="User Name"]').length > 0) { .then(() => {
cy.get('input[placeholder="User Name"]').type(username) cy.get('input[placeholder="User Name"]', { timeout: 40000 })
cy.get('input[placeholder="Password"]').type(password) .should('not.exist')
cy.get('.submit-button').click() .then(() => {
} cy.get('.ui.massive.icon.primary.left.labeled.button')
.click()
cy.get('input[placeholder="User Name"]', {timeout: 40000}).should('not.exist').then(() => { .then(() => {
cy.get('.ui.massive.icon.primary.left.labeled.button').click().then(() => { cy.get('.ui.massive.loading.primary.button', {
cy.get('.ui.massive.loading.primary.button', {timeout: testingFinishTimeout}).should('not.exist').then(() => { timeout: testingFinishTimeout
cy.get('span.icon.failed').should('not.exist').then(() => { })
done() .should('not.exist')
.then(() => {
cy.get('span.icon.failed')
.should('not.exist')
.then(() => {
done()
}) })
}) })
}) })
}) })
}) })
}) })
})
it('Should have all tests successfull with debug on', (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('.ui.fitted.toggle.checkbox label').click().then(() => {
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', {timeout: testingFinishTimeout}).should('not.exist').then(() => {
cy.get('span.icon.failed').should('not.exist').then(() => {
done()
})
})
})
})
})
})
})
}) })

View File

@@ -9,7 +9,7 @@ const webpackOptions = {
{ {
test: /\.ts$/, test: /\.ts$/,
loaders: ['ts-loader'], loaders: ['ts-loader'],
exclude: [/node_modules/], exclude: [/node_modules/]
}, },
{ {
test: /\.(html|css)$/, test: /\.(html|css)$/,

View File

@@ -12,7 +12,7 @@
// This function is called when a project is opened or re-opened (e.g. due to // This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing) // the project's config changing)
const wp = require("@cypress/webpack-preprocessor"); const wp = require('@cypress/webpack-preprocessor')
/** /**
* @type {Cypress.PluginConfig} * @type {Cypress.PluginConfig}
@@ -22,21 +22,21 @@ module.exports = (on, config) => {
// `config` is the resolved Cypress config // `config` is the resolved Cypress config
const options = { const options = {
webpackOptions: require("../webpack.config.js") webpackOptions: require('../webpack.config.js')
}; }
on("file:preprocessor", wp(options)); on('file:preprocessor', wp(options))
on("before:browser:launch", (browser = {}, launchOptions) => { on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.name === "chrome") { if (browser.name === 'chrome') {
launchOptions.args.push("--disable-site-isolation-trials"); launchOptions.args.push('--disable-site-isolation-trials')
launchOptions.args.push("--auto-open-devtools-for-tabs"); launchOptions.args.push('--auto-open-devtools-for-tabs')
launchOptions.args.push("--aggressive-cache-discard") launchOptions.args.push('--aggressive-cache-discard')
launchOptions.args.push("--disable-cache") launchOptions.args.push('--disable-cache')
launchOptions.args.push("--disable-application-cache") launchOptions.args.push('--disable-application-cache')
launchOptions.args.push("--disable-offline-load-stale-cache") launchOptions.args.push('--disable-offline-load-stale-cache')
launchOptions.args.push("--disk-cache-size=0") launchOptions.args.push('--disk-cache-size=0')
return launchOptions; return launchOptions
} }
}); })
} }

View File

@@ -1,10 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"strict": true, "strict": true,
"baseUrl": "../node_modules", "baseUrl": "../node_modules",
"target": "es6", "target": "es6",
"lib": ["es2019", "dom"], "lib": ["es2019", "dom"],
"types": ["cypress"] "types": ["cypress"]
}, },
"include": ["**/*.ts"] "include": ["**/*.ts"]
} }

View File

@@ -1,23 +1,23 @@
module.exports = { module.exports = {
mode: "development", mode: 'development',
resolve: { resolve: {
extensions: [".ts", ".js"] extensions: ['.ts', '.js']
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.ts$/, test: /\.ts$/,
exclude: [/node_modules/], exclude: [/node_modules/],
use: [ use: [
{ {
loader: "ts-loader", loader: 'ts-loader',
options: { options: {
// skip typechecking for speed // skip typechecking for speed
transpileOnly: true transpileOnly: true
}
} }
] }
} ]
] }
} ]
}; }
}