Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cypress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lambdatest/cypress-driver",
"version": "1.0.9-beta.1",
"version": "1.0.9-beta.2",
"description": "Cypress driver for all Lambdatest functionalities",
"main": "index.js",
"types": "types/index.d.ts",
Expand Down
18 changes: 10 additions & 8 deletions packages/cypress/src/smartui.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { log } = require('./utils/logger');
// const { log } = require('./utils/logger');
const client = require('./utils/httpClient');
const testType = 'cypress-driver';
const CY_TIMEOUT = 30 * 1000 * 1.5;
Expand All @@ -9,7 +9,7 @@ function smartuiSnapshot(name, options = {}) {

return cy.then({ timeout: CY_TIMEOUT }, async () => {
if (Cypress.config('isInteractive') && !Cypress.config('enableSmartUIInteractiveMode')) {
cy.task('log', log('info', 'SmartUI snapshot skipped in interactive mode; use "cypress run" instead of "cypress open"'));
// cy.task('log', log('info', 'SmartUI snapshot skipped in interactive mode; use "cypress run" instead of "cypress open"'));
return;
}

Expand All @@ -29,16 +29,18 @@ function smartuiSnapshot(name, options = {}) {
options
}, testType).then(resp => {
if (resp.status >= 200 && resp.status < 300) {
if (resp.body.data.warnings.length) {
resp.body.data.warnings.map(e => cy.task('log', log('warn', e)));
}
cy.task('log', log('info', `Snapshot captured: ${name}`));
// if (resp.body.data.warnings.length) {
// resp.body.data.warnings.map(
// // cy.task('log', log('warn', e))
// );
// }
// cy.task('log', log('info', `Snapshot captured: ${name}`));
} else {
throw new Error(resp.body.error.message);
}
}).catch(error => {
cy.task('log', log('error', `SmartUI snapshot failed "${name}"`));
cy.task('log', log('error', error.message));
// cy.task('log', log('error', `SmartUI snapshot failed "${name}"`));
// cy.task('log', log('error', error.message));
});
});
});
Expand Down
20 changes: 0 additions & 20 deletions packages/cypress/src/utils/logger.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
const chalk = require('chalk');
const pkgName = require('../../package.json').name;

function log(level, message) {
if (typeof message === 'object') {
message = JSON.stringify(message);
}
switch (level) {
case 'debug':
message = chalk.blue(message);
break;
case 'warn':
message = chalk.yellow(`Warning: ${message}`);
break;
case 'error':
message = chalk.red(`Error: ${message}`);
break;
}
return `[${pkgName}] ${message}`;
}

module.exports = {
log
}