magnificent-finland-58048
06/23/2022, 3:20 PMgray-kilobyte-89541
06/23/2022, 3:24 PMgray-kilobyte-89541
06/23/2022, 3:43 PMable-gold-91287
06/23/2022, 3:53 PMit
method?gray-toothbrush-44079
06/23/2022, 3:57 PMflaky-airport-12178
06/23/2022, 3:59 PMmagnificent-finland-58048
06/23/2022, 4:12 PMmagnificent-finland-58048
06/23/2022, 4:13 PMbland-pharmacist-88362
06/23/2022, 4:13 PMvar found = false
function checkButton() {
cy.wait(500)
cy.get('body').then(($body) => {
if ($body.find('.startButton').filter(':visible').length) {
found = true
}
})
console.log(found)
return found;
};
cy.get('mat-panel-title').should('be.visible')
.then(
each(
($el) => {
console.log(found)
if (found === false) {
cy.wrap($el).click();
}
},
() => checkButton() === true,
),
)
magnificent-finland-58048
06/23/2022, 4:16 PMgray-toothbrush-44079
06/23/2022, 4:17 PMmagnificent-finland-58048
06/23/2022, 4:18 PMswift-kitchen-62493
06/24/2022, 6:21 AMtall-thailand-5343
06/24/2022, 7:15 AMCypress.Commands.add("checkWaitNoSkeletonLoaders", (timeout = undefined) => {
cy.get(
.react-loading-skeleton`, { timeout }).then(($elements) => {
if ($elements.length < 1) return true;
cy.wrap($elements, { timeout }).each(($el) => {
cy.wrap($el, { timeout }).should("not.exist");
});
});
});`
Why I would need point 2 at the same time? Because on CI for some weird reason some tests fail at this command (timeout waiting for the element). When running locally but using the same url where our CI tests, it always passes.fresh-doctor-14925
06/24/2022, 8:13 AM.get(".react-loading-skeleton").should("not.exist")
assertion will pass before the loader element has even appeared
Is there another element that will appear when the loader appears, but will remain after? You could assert on that one, then do the check for the loadertall-thailand-5343
06/24/2022, 8:45 AMquaint-airplane-96634
06/24/2022, 8:54 AMfresh-doctor-14925
06/24/2022, 9:01 AMlemon-grass-56782
06/24/2022, 9:18 AMlemon-grass-56782
06/24/2022, 9:21 AMmillions-analyst-19851
06/24/2022, 9:28 AMastonishing-electrician-44897
06/24/2022, 10:39 AMif (producsCounter === PRODUCTS_AMOUNT) {
i = MAX_AMOUNT+1;
}
cuddly-thailand-33926
06/24/2022, 12:47 PMfresh-painter-19247
06/24/2022, 12:57 PMbitter-fountain-36713
06/24/2022, 2:28 PMcuddly-thailand-33926
06/24/2022, 2:46 PMlate-twilight-22806
06/24/2022, 3:27 PMsquare-pilot-83868
06/24/2022, 6:22 PMcurved-zebra-35162
06/24/2022, 6:31 PMtypescript
describe('CompanyDetails.cy.ts', () => {
it('should render', () => {
cy.mount(<CompanyDetails />, '/company/1')
})
})
And here is component.tsx file:
typescript
Cypress.Commands.add('mount', (Component, initialRoute = '/company/1', path, options = {}) => {
const wrapped = <MemoryRouter initialEntries={['companies/1']}> {Component} </MemoryRouter>
return mount(wrapped)
})
Do you have any idea what am I doing wrong? Thanks!high-optician-91398
06/24/2022, 9:03 PMcypress
folder in the root (which contains a tsconfig.json
) and a cypress.config.ts
at root level. There I am trying to import a file from my angular app which sits at ./src/app/foo
. If I try to import that, I get a TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"