cuddly-memory-8324
03/07/2023, 1:01 PMthousands-house-85089
03/07/2023, 1:52 PMcolossal-table-38461
03/07/2023, 2:56 PMfaint-teacher-38938
03/07/2023, 3:28 PMmagnificent-processor-78564
03/07/2023, 3:53 PMstocky-insurance-27750
03/07/2023, 4:23 PMcy.window().then(win => {
win.addEventListener('beforeunload', () => {
I'm getting errors with promises when trying to set the cookie using datalayer.find(event => event.dpdItem === 'header-2')
or if I manage to get to the click - then the cookie is null. Even when I don't try capturing anything and just use a string 'hello' - the cookie is null.
Anyone got this working?bumpy-insurance-8581
03/07/2023, 4:37 PMlinks
from the response have a specific value.
For example I want to check that they all have status isEnabled
.
I know how to do it in C# using Assert.IsTrue(response.Any(a => a.isEnabled));
But I donβt find a way to convert this to Cypress usage, any idea ?modern-librarian-14184
03/07/2023, 5:37 PMripe-fountain-23857
03/07/2023, 7:16 PMdazzling-horse-31955
03/07/2023, 10:09 PMbulky-sundown-7164
03/08/2023, 12:52 AMalert-tiger-26761
03/08/2023, 2:30 AMworried-shampoo-96177
03/08/2023, 7:12 AMquick-city-89997
03/08/2023, 11:00 AMtype
, because each key stroke triggers a validation function. And it happens often that some requests get stuck in cypress (network tab is showing the correct behavior, cancelled and finished requests).
Is there a way to directly set a value into the input, so my validation would only trigger once?
Because currently there is an issue with cancelled requests, I just discovered
https://github.com/cypress-io/cypress/issues/19326famous-secretary-98668
03/08/2023, 12:21 PMtestIsolation
set to true at a global level. I'd like certain describe blocks to run without testIsolation
, so that I can run several it
commands in sequence, each with an assertion.
According to the docs, I can define testIsolation
at a describe
level. My interpretation is that is would apply to block only, but it doesn't appear to work like that, or perhaps I'm misunderstanding.
Here's an example, for a given spec file
describe('Some tests', () => {
describe('Test A', { testIsolation: false }, () => {
it('C1: verifies something', () => {
// run some assertion
});
it('C2: verifies something else', () => {
// run some assertion
});
});
describe('Test B', { testIsolation: false } () => {
it('C3: verifies something', () => {
// run some assertion
});
it('C4: verifies something else', () => {
// run some assertion
});
});
});
In this case, I'd expect testIsolation
to only be applicable to the "inner" it
commands. That is, "Test A" and "Test B" would run in isolation of each other. In practice, I'm observing "Test B" doesn't clear the browser session, etc.
Thanks!calm-megabyte-76235
03/08/2023, 12:23 PMhelpful-coat-87654
03/08/2023, 12:27 PMstraight-rose-89671
03/08/2023, 2:18 PMcy.get('canvas').click({position: 'topLeft', force: true, x: 50, y: 50})
cy.get('canvas').click({position: 'topLeft', force: true, x: 50, y: 50})
cy.get('canvas').click({position: 'topLeft', force: true, x: 500, y: 500})
After that i click on the canvas:
cy.get('canvas').click()
Everything works local, but on github actions it fails..
So why is it when adding: cy.wait(1000)
before the cy.get('canvas').click()
it doesn't fail on github actions ?busy-soccer-31234
03/08/2023, 5:22 PMts
let id;
it('create_category', () => {
cy.login();
cy.visit('/backoffice/communication/category/create');
cy.get('.ng-tns-c22-15 > .ant-form-item-control > .ant-form-item-children > .ant-input').clear();
cy.get('.ng-tns-c22-15 > .ant-form-item-control > .ant-form-item-children > .ant-input').type('teste');
cy.get('.ng-tns-c22-4 > .ant-form-item-control > .ant-form-item-children > .ant-input').clear();
cy.get('.ng-tns-c22-4 > .ant-form-item-control > .ant-form-item-children > .ant-input').type('12');
cy.get('.ant-switch').click();
cy.intercept('POST', '/api/communication/categories').as('createCategory');
cy.get('.button-submit').click();
cy.wait('@createCategory').then((interception) => {
id = interception.response.body.data[0].id
console.log(id)
expect(interception.response.statusCode).to.eq(200)
});
})
it('delete_category', () => {
cy.login();
cy.visit('/backoffice/communication/category/list');
cy.intercept('DELETE', '/backoffice/communication/categories/' + id).as('deleteCategory');
cy.get(':nth-child(1) > .text-right > .options_button').click();
cy.get('.ant-dropdown-menu > :nth-child(2)').click();
cy.get('.ant-btn-danger').click();
cy.wait('@deleteCategory').then((interception) => {
expect(interception.response.statusCode).to.eq(200)
});
})
I try this...enough-summer-50273
03/08/2023, 5:37 PMJavaScript
beforeEach(() => {
cy.login();
cy.visit("/");
});
it('Correct user is logged in', () => {
cy.log(JSON.stringify(Cypress.env()));
// the token set in the cy.login() command is present
});
This doesn't.
JavaScript
it.only('Correct user is logged in', () => {
cy.login();
cy.visit("/");
cy.log(JSON.stringify(Cypress.env()));
// the token set in the cy.login() command is not present
// but all of the hardcoded enviroment variables are
});
some-cartoon-73108
03/08/2023, 8:28 PMstocky-grass-9933
03/08/2023, 8:53 PMcool-businessperson-62347
03/08/2023, 10:58 PMcurved-agent-32333
03/08/2023, 11:30 PMand()
and 'then()'
functions to my base page object and they only returns the instance of the page object by return this;
. Then I just chain this functions on the test as following.
Please let me know about your thought and ideas regarding this. Maybe there is a better way to achieve thisbillowy-sandwich-34737
03/09/2023, 3:23 AMbright-gold-91786
03/09/2023, 7:33 AMstocky-insurance-27750
03/09/2023, 8:31 AM--headed
test and turn on developer tools, go to console and enter dataLayer
- I get an error that dataLayer is not defined
. This isn't the case in Chrome with the app running. I've entered window.dataLayer = window.dataLayer || []
and then clicked buttons (that should be firing events into the dataLayer) but it remains blank.
I previously had a test that was asserting the dataLayer fine, so this is really puzzling why the dataLayer is now disappeared. Have I done something daft in a config or something?
cy.window()
.its('dataLayer')
.then(dataLayer => {
const size = Cypress.$(dataLayer).length - 1
const event = dataLayer[size]
expect(event.event).to.equal(expectedEvents.event)
expect(event.action).to.equal(expectedEvents.action)
})
lively-library-21721
03/09/2023, 9:14 AMgreat-cricket-75245
03/09/2023, 11:33 AM