From 54a33ac98a3b5ad81e3fe37f3c0fbe810edfeb45 Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Thu, 12 May 2022 09:06:52 +0300 Subject: [PATCH] chore(lint): fixed lint issues in cypress folder --- cypress/integration/sasjs.tests.ts | 107 +++++++++++++++----------- cypress/plugins/cy-ts-preprocessor.js | 2 +- cypress/plugins/index.js | 32 ++++---- cypress/tsconfig.json | 18 ++--- cypress/webpack.config.js | 42 +++++----- 5 files changed, 111 insertions(+), 90 deletions(-) diff --git a/cypress/integration/sasjs.tests.ts b/cypress/integration/sasjs.tests.ts index 3d96c7a..74fa950 100644 --- a/cypress/integration/sasjs.tests.ts +++ b/cypress/integration/sasjs.tests.ts @@ -3,55 +3,76 @@ const username = Cypress.env('username') const password = Cypress.env('password') const testingFinishTimeout = Cypress.env('testingFinishTimeout') -context('sasjs-tests', function() { - this.beforeAll(() => { - cy.visit(sasjsTestsUrl) +context('sasjs-tests', function () { + this.beforeAll(() => { + 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(() => { - cy.reload() - }) + 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() + } - 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() + 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() }) }) }) }) }) }) - - 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() - }) - }) - }) - }) - }) - - }) - }) -}) \ No newline at end of file + }) +}) diff --git a/cypress/plugins/cy-ts-preprocessor.js b/cypress/plugins/cy-ts-preprocessor.js index 9d3c777..2071410 100644 --- a/cypress/plugins/cy-ts-preprocessor.js +++ b/cypress/plugins/cy-ts-preprocessor.js @@ -9,7 +9,7 @@ const webpackOptions = { { test: /\.ts$/, loaders: ['ts-loader'], - exclude: [/node_modules/], + exclude: [/node_modules/] }, { test: /\.(html|css)$/, diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index c9a7e27..81a1d46 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -12,7 +12,7 @@ // 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"); +const wp = require('@cypress/webpack-preprocessor') /** * @type {Cypress.PluginConfig} @@ -22,21 +22,21 @@ module.exports = (on, config) => { // `config` is the resolved Cypress config const options = { - webpackOptions: require("../webpack.config.js") - }; - on("file:preprocessor", wp(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; + 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 } - }); + }) } diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 0cbecb6..05b1056 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -1,10 +1,10 @@ { - "compilerOptions": { - "strict": true, - "baseUrl": "../node_modules", - "target": "es6", - "lib": ["es2019", "dom"], - "types": ["cypress"] - }, - "include": ["**/*.ts"] - } + "compilerOptions": { + "strict": true, + "baseUrl": "../node_modules", + "target": "es6", + "lib": ["es2019", "dom"], + "types": ["cypress"] + }, + "include": ["**/*.ts"] +} diff --git a/cypress/webpack.config.js b/cypress/webpack.config.js index a76f911..a71cf88 100644 --- a/cypress/webpack.config.js +++ b/cypress/webpack.config.js @@ -1,23 +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 - } + mode: 'development', + resolve: { + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + exclude: [/node_modules/], + use: [ + { + loader: 'ts-loader', + options: { + // skip typechecking for speed + transpileOnly: true } - ] - } - ] - } - }; + } + ] + } + ] + } +}