wooden-megabyte-23794
02/10/2023, 6:34 AMbillowy-pharmacist-61146
02/10/2023, 7:18 AM17:34:59 [vite] ✨ new dependencies optimized: vuetify/components, vuetify/lib/components/VAppBar/index.mjs, vuetify/lib/components/VDivider/index.mjs, vuetify/lib/components/VToolbar/index.mjs, @vueuse/core
17:34:59 [vite] ✨ optimized dependencies changed. reloading
1) An uncaught error was detected outside of a test
And the test fails... If I relaunch tests a second time, everything is okay. Anything I can do to prevent this ?
Thanks !billowy-smartphone-68952
02/10/2023, 7:34 AMcreamy-mouse-54087
02/10/2023, 2:50 PMdotenv
imported into my cypress.config.ts
and that's OK, but upgraded and now dotenv
is included in my nuxt dependancy, so I no longer need it for anywhere else in the project, and im reluctant to keep it just for cypress - so I thought OK, what if I put that in nuxt.config.js
like so
export default {
env: {
baseUrl: process.env.BASE_URL
}
}
and then back in cypress.config.ts
I have
import nuxtConfig from './nuxt.config.js'
const { baseUrl } = nuxtConfig.env
export default defineConfig({
e2e: {
env: {
baseUrl,
},
// rest of file
but this doesn't work. I also tried export default defineConfig({
e2e: {
baseUrl,
but again no joy. eventually anyway in my test file I have cy.visit('/')
but basically that baseUrl always results in the failrueeager-alarm-14284
02/10/2023, 3:42 PMgreat-kite-11257
02/10/2023, 7:44 PMTypeError: The following error originated from your test code, not from Cypress.
> Cannot read properties of undefined (reading 'type')
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Here's how I create my connection:
import {DataSource} from "typeorm";
export const AppDataSource = new DataSource({
type: "postgres",
host: "localhost",
port: 5432,
username: "postgres",
password: "123",
database: "test_typeorm",
synchronize: true,
logging: true,
})
delightful-guitar-3252
02/11/2023, 1:01 AMsome-cartoon-73108
02/13/2023, 6:58 AMfew-cpu-19533
02/12/2023, 3:47 PMconst selectors = require('../selectors');
describe('This is a first test', () => {
const getIframeBody= () => {
return cy
.get(selectors.loginIFrame)
.its('0.contentDocument.body').should('not.be.empty')
.then(cy.wrap)
};
it('should login user', () => {
cy.clearCookies();
cy.visit('/');
cy.get('#onetrust-accept-btn-handler').click();
cy.wait(5000);
getIframeBody().find(selectors.loginInputUser).type(Cypress.env('usernameForm'));
//
getIframeBody().find(selectors.loginInputPassword).type(Cypress.env('passwordForm'));
getIframeBody().find(selectors.loginInputSubmit).click();
cy.wait(5000);
});
});
I already read serveral github discussions and stackoverflow articles, handling similar topics, but unfortunately i did not find a solution yet.lemon-toothbrush-55306
02/12/2023, 10:02 PMCypress.env.json
with my env vars, is there any way to make a new file called for example: Cypress.env.local.json
and then I can keep Cypress.env.json
empty and only add the values in my Cypress.env.local.json
? Since It's a bit annoying do add the values when I'm in LocalHost and Remove when I'm pushing to environment.
Thanks you.kind-van-46599
02/13/2023, 2:53 AMlet indexInd = true;
let index: number;
indexInd ? (index = 0) : (index = 1);
let dataTestIdInd = 'lyactuals'
let dataTestId: string;
/* Indicator to choose the Deals table according to the validation*/
dataTestIdInd?.includes('lyactuals')
? (dataTestId = 'LastYearActualsTable')
: dataTestIdInd?.includes('proposed')
? (dataTestId = 'ReadonlyProposedTable')
: (dataTestId = 'SlottingBoardTable');
cy.findByTestId(dataTestId)
.scrollIntoView()
.find('tfoot tr')
.eq(index)
.find('td'). then(() => {})
brainy-queen-50380
02/13/2023, 7:58 AMmillions-flower-39293
02/13/2023, 8:15 AMcy.request()
if ever we implement it this way. One reason why we are planning to do this is to avoid writing the API request headers/body manually. Hope someone already tried this. Thanks!witty-van-98092
02/13/2023, 8:31 AMnutritious-honey-65632
02/13/2023, 9:20 AMsomeArray.forEach(item => {
it('test', () => {
if (item === 'foo') {
cy.request('foobar').then(() => {
if (bar) {
// skip the rest of the test
}
})
}
}
}
red-honey-44438
02/13/2023, 10:50 AMbroad-window-45549
02/13/2023, 10:54 AMlemon-toothbrush-55306
02/13/2023, 1:40 PMCongrats your HBAR has been sent successfully
appear, I'm using cy.wait(10000)
is there any other way to do this?
js
cy.getBySel('confirm-transaction').click();
// Waiting for the transaction to be registered in Hedera
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(10000);
cy.contains('¡Tus HBAR se han enviado con éxito!').should('be.visible');
stocky-insurance-27750
02/13/2023, 4:05 PMModule parse failed: Unexpected token (1:0)
I've npm installed vue-loader
and vue-loader-plugin
and added this to the cypress.config.ts:
import preprocessor from '@cypress/webpack-preprocessor'
e2e: {
setupNodeEvents(on, config) {
const options = webpackPreprocessor.defaultOptions
options.webpackOptions.module.rules[0].use[0].options.presets.push('vue-loader')
on('file:preprocessor', webpackPreprocessor(options))
}
But get the error: Module parse failed: Unexpected token (21:12)
I get no errors if I'm not trying to import consts or have any webpack config in the cypress.config.ts.
Read this as 'adding to the default options' - https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor#modifying-default-options
We want to be able to handle .vue files and everything else continue as normal.
Any ideas?green-vr-66806
02/13/2023, 5:44 PMkind-van-46599
02/13/2023, 9:15 PM[type="button"]
).click();
});
}`salmon-hairdresser-39856
02/13/2023, 10:23 PMimportant-country-59976
02/14/2023, 1:14 PMgorgeous-wolf-24355
02/14/2023, 5:13 PMlemon-toothbrush-55306
02/14/2023, 7:46 PMjs
Cypress.Commands.add('getBySel', (selector, ...args) => {
return cy.get(`[data-test-id="${selector}"]`, ...args);
});
js
cy.getBySel('SUPPLY KEY').then((key) => {
console.log('Key - cy.getBySel',key);
let SUPPLY_KEY = key;
cy.wrap(SUPPLY_KEY).as('wags');
});
But the val I'm getting is (Attach to second Image).
Any help pls?hundreds-jackal-17102
02/14/2023, 10:27 PMcold-author-79999
02/15/2023, 3:41 AMhundreds-spoon-43121
02/15/2023, 4:08 AMcolossal-table-38461
02/15/2023, 5:14 AMhallowed-ability-2849
02/15/2023, 10:30 AM