colossal-oxygen-29599
05/05/2023, 2:58 AMcypress run
?brave-portugal-44828
05/05/2023, 5:52 AMhttps://cdn.discordapp.com/attachments/1103922036872589382/1103922037027782778/Screenshot_2566-05-05_at_12.44.35.png▾
helpful-receptionist-4197
05/05/2023, 2:03 PMts
// cypress/support/component.ts
import "./commands";
import { mount } from "cypress/vue";
import { app } from "../src/main.js";
// do something with `app` so it's actually used
Cypress.Commands.add('mount', mount)
damp-flag-99346
05/05/2023, 2:47 PMsilly-lawyer-32382
05/05/2023, 3:19 PMhttps://cdn.discordapp.com/attachments/1104064720341844039/1104064720530591824/image.png▾
https://cdn.discordapp.com/attachments/1104064720341844039/1104064720861925476/image.png▾
https://cdn.discordapp.com/attachments/1104064720341844039/1104064721142956052/image.png▾
https://cdn.discordapp.com/attachments/1104064720341844039/1104064721675636867/image.png▾
https://cdn.discordapp.com/attachments/1104064720341844039/1104064721948250152/image.png▾
flat-painter-96557
05/05/2023, 7:24 PMplain-potato-68806
05/05/2023, 8:22 PMjavascript
cy.get('.my-class-name).then((list) => {
const count = list.length
})
However, the test will fail when the element is not visible at all. Please could you help?quiet-dream-68129
05/06/2023, 4:14 AMquick-activity-91603
05/07/2023, 7:56 AMexamples
contains the full contents of the fixture
examples.forEach((example) => {
// Do something with each example
});
});
});
content of the fixture file (examples.json) :
{
"email": "sam_blogs@webdriveruni.com",
"otheremail": "sam_blogs@webdriveruni.com"
}
Do you have any idea what I'm doing wrong please ?
Thanks !
Leila
https://cdn.discordapp.com/attachments/1104678206390423583/1104678206633685073/fixture_issue.png▾
millions-flower-39293
05/07/2023, 12:36 PMimport "./api-commands/administration/organization/branchCommands";
import "./api-commands/administration/organization/depositoryAccountCommands";
import "./api-commands/administration/generalledger/transactionCategoriesCommands";
How can I import these at their folder level like:
import "./api-commands/administration/organization
import "./api-commands/administration/generalledger
So that whatever custom command files will be added in the existing folder, I'll no longer specify the whole path including its file name?
Thanks!wonderful-army-80507
05/07/2023, 5:09 PMit('Post button works', () => {
cy.contains('Posts').click();
cy.get('h1').should('include.text', 'Posts 1–5 of ');
});
This works fine when run in chrome or electron, but fails in firefox with the error
> error loading dynamically imported module
My site is a sveltekit site.
I searched but didn't find any obvious solutions. Any suggestions?adorable-terabyte-75237
05/07/2023, 9:35 PMflat-painter-96557
05/08/2023, 3:03 PMwonderful-carpenter-84941
05/08/2023, 3:15 PMbig-quill-7500
05/08/2023, 5:29 PMelegant-insurance-66438
05/08/2023, 6:52 PMstart:ci
- there is no mention of what commands are in this script elsewhere in the documentation that I could find - if someone knows that would be great.red-jordan-59778
05/08/2023, 11:33 PMwide-evening-76256
05/09/2023, 1:58 PMhttps://cdn.discordapp.com/attachments/1105494008815419464/1105494009222275134/Screenshot_399.png▾
helpful-receptionist-4197
05/09/2023, 2:59 PMfetch("path/to/dump.yaml").then(...)
it returns 200, but it's this HTML instead of the YAML i'm expecting.
works fine outside of cypress. components which don't load this work fine too.
html
<!DOCTYPE html>
<html>
<head>
<script type="module" src="/__cypress/src/@vite/client"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
<script>// This file is merged in a <script type=module> into index.html
// it will be used to load and kick start the selected spec
const CypressInstance = window.Cypress = parent.Cypress
const importsToLoad = []
/* Support file import logic, this should be removed once we
* are able to return relative paths from the supportFile
* Jira #UNIFY-1260
*/
const supportFile = CypressInstance.config('supportFile')
const projectRoot = CypressInstance.config('projectRoot')
const devServerPublicPathRoute = CypressInstance.config('devServerPublicPathRoute')
if (supportFile) {
let supportRelativeToProjectRoot = supportFile.replace(projectRoot, '')
if (CypressInstance.config('platform') === 'win32') {
const platformProjectRoot = projectRoot.replaceAll('/', '\\')
supportRelativeToProjectRoot = supportFile.replace(platformProjectRoot, '')
}
// We need a slash before /cypress/supportFile.js, this happens by default
// with the current string replacement logic.
importsToLoad.push({
load: () => import(`${devServerPublicPathRoute}${supportRelativeToProjectRoot}`),
absolute: supportFile,
relative: supportRelativeToProjectRoot,
relativeUrl: `${devServerPublicPathRoute}${supportRelativeToProjectRoot}`,
})
}
// Using relative path wouldn't allow to load tests outside Vite project root folder
// So we use the "@fs" bit to load the test file using its absolute path
// Normalize path to not include a leading slash (different on Win32 vs Unix)
const normalizedAbsolutePath = CypressInstance.spec.absolute.replace(/^\//, '')
const testFileAbsolutePathRoute = `${devServerPublicPathRoute}/@fs/${normalizedAbsolutePath}`
/* Spec file import logic */
// We need a slash before /src/my-spec.js, this does not happen by default.
importsToLoad.push({
load: () => import(testFileAbsolutePathRoute),
absolute: CypressInstance.spec.absolute,
relative: CypressInstance.spec.relative,
relativeUrl: testFileAbsolutePathRoute,
})
if (!CypressInstance) {
throw new Error('Tests cannot run without a reference to Cypress!')
}
// load the support and spec
CypressInstance.onSpecWindow(window, importsToLoad)
// then start the test process
CypressInstance.action('app:window:before:load', window)
// Before all tests we are mounting the root element,
// Cleaning up platform between tests is the responsibility of the specific adapter
// because unmounting react/vue component should be done using specific framework API
// (for devtools and to get rid of global event listeners from previous tests.)
CypressInstance.on('test:before:run', () => {
// leave the error overlay alone if it exists
if (document.body.querySelectorAll('vite-error-overlay').length) {
// make the error more readable by giving it more space
Cypress.action('cy:viewport:changed', { viewportWidth: 1000, viewportHeight: 500 })
return
}
// reset the viewport to default when in normal mode
Cypress.action('cy:viewport:changed', {
viewportWidth: Cypress.config('viewportWidth'),
viewportHeight: Cypress.config('viewportHeight'),
})
})
// Make usage of node test plugins possible
window.global = window
window.process = typeof process !== 'undefined' ? process : {}
</script>
</body>
</html>
little-nail-2574
05/09/2023, 4:13 PMdescribe('TEST.cy.tsx', () => {
it('playground', () => {
cy.mount(<BillingListPage/>)
cy.log( 'true' )
})
})
The project uses React, **Webpack **bundler, and Single-SPA.
The idea is to run it in standalone mode, but this is not happening.
Initially, the project was running on version 6.0.0, and I am migrating it to version ^12.0.0.
When executing the project, the component return this var_ = _non_webpack_require__(... :
and in the console:
My cypress.config.ts file:
import { defineConfig } from 'cypress';
import webpackConfig from './webpack.config';
export default defineConfig({
component: {
devServer: {
framework: 'react',
bundler: 'webpack',
webpackConfig,
},
viewportWidth: 1000,
viewportHeight: 660,
},
});
Is there any missing configuration to be able to execute the components in standalone mode?
https://cdn.discordapp.com/attachments/1105527942697721887/1105527943242973275/b64013aa-92a8-45c4-b41f-8ba26f62bfbc.png▾
https://cdn.discordapp.com/attachments/1105527942697721887/1105527943616274514/5698335f-412a-4811-a11d-d79d7335f16b.png▾
gorgeous-butcher-63283
05/09/2023, 4:17 PMhttps://cdn.discordapp.com/attachments/1105529078938869892/1105529079316348948/Screenshot_2023-05-09_at_17.16.30.png▾
proud-answer-20715
05/09/2023, 4:31 PMhelpful-receptionist-4197
05/09/2023, 4:37 PMhtml
<script setup>
defineExpose({foo: 1337})
</script>
<template>
Hello!
</template>
ts
describe("<MyComponent />", () => {
it("renders", () => {
cy.mount(MyComponent).then(({wrapper, component}) => {
expect(component.foo).to.equal(1337) // fails; component.foo is undefined
})
});
});
magnificent-lamp-44201
05/09/2023, 8:00 PMdazzling-salesclerk-15570
05/09/2023, 8:45 PMsquare-toothbrush-32850
05/10/2023, 6:57 AMhttps://cdn.discordapp.com/attachments/1105750462562582528/1105750462835195934/cypresserror.png▾
curved-dress-90603
05/10/2023, 9:47 AMbumpy-insurance-8581
05/10/2023, 10:08 AMhttps://cdn.discordapp.com/attachments/1105798408704368661/1105798408872144906/IMG_4128.jpg▾
brash-nest-96339
05/10/2023, 10:28 AMhttps://cdn.discordapp.com/attachments/1105803451855818772/1105803452057141268/cypress_error.png▾
cold-branch-74205
05/10/2023, 10:28 AMhttps://cdn.discordapp.com/attachments/1105803599101034556/1105803599222685777/image.png▾