fresh-doctor-14925
12/19/2022, 2:19 PMlemon-wall-91819
12/19/2022, 2:19 PMhappy-dinner-13480
12/19/2022, 3:32 PMtypescript
if (cy.el('btnSyncCostCenters').children().find('input').should('not.have.attr', 'ng-reflect-model', 'true')) {
cy.el('btnSyncCostCenters').children().find('input').click();
}
> assertexpected not to have attribute ng-reflect-model with the value true, but the value was true
if it's true I just want to do nothing thoughthankful-wire-37848
12/19/2022, 3:37 PMcy.should(...)
or expect(...).to...
) if the condition is not met, and also never return with true
or false
values.gray-kilobyte-89541
12/19/2022, 3:48 PMlittle-kitchen-65586
12/19/2022, 4:07 PMgray-kilobyte-89541
12/19/2022, 4:10 PMlittle-kitchen-65586
12/19/2022, 4:12 PMlittle-kitchen-65586
12/19/2022, 4:14 PMhallowed-wolf-18137
12/20/2022, 2:59 AMbitter-fountain-36713
12/20/2022, 5:32 AMnutritious-analyst-96582
12/20/2022, 5:32 AMbest-lunch-5240
12/20/2022, 9:27 AMhappy-dinner-13480
12/20/2022, 9:43 AMtypescript
cy.get('[data-cy=btnSyncCostCenters]')
.children()
.find('input')
.then(($toggle) => {
if (!$toggle[0].attributes.getNamedItem('ng-reflect-model').value) {
cy.el('btnSyncCostCenters').children().find('input').click();
}
});
which seems to workfresh-doctor-14925
12/20/2022, 10:36 AMbest-lunch-5240
12/20/2022, 10:40 AMhallowed-wolf-18137
12/20/2022, 10:54 AMthankful-wire-37848
12/20/2022, 11:21 AM<select multiple>
because that cannot be a dropdown? Or are you referring to a special component?hallowed-wolf-18137
12/20/2022, 11:22 AMfresh-doctor-14925
12/20/2022, 12:19 PMclean-processor-42509
12/20/2022, 12:45 PMcypress/config/${testEnvironment}.json
))
const values = JSON.parse(text)
config.env = {
...values
}
Now I have implemented the code to connect the DB. I am passing all the credentials from the sit.json file except the password as I want to pass it from the CLI argument. Since all the DB configuration resides in db object of env obj as shown below, how can we set the password to it which we are passing as CLI arg
env:{
baseURL:’XXXXX’,
testEnv:’XXXXX’,
ClientId:’XXXXX’,
db:{host:
}powerful-gigabyte-69168
12/20/2022, 1:36 PMbeforeEach()
hooks called cy.setupGameAsP0()
and it basically initializes a game by:
1. Making an api request to wipe the database
2. Visiting the app root url
3. Signing up two accounts
4. Creating and joining the game as both players
5. Readying as both players
At which point the game launches. This works ~99% of the time but fails with a forbidden error often enough to fail our CI pipeline ~50% of the time across our ~200 tests.
I think the issue has something to do with the way cypress handles promises and the fact that our app logic makes api requests using a lib that has callback-style handlers rather than regular promises.
Here's the command:
Cypress.Commands.add('setupGameAsP0', (isRanked = false) => {
cy.wipeDatabase();
cy.visit('/');
cy.signupPlayer(username, validPassword);
cy.createGamePlayer({ gameName: 'Test Game', isRanked }).then((gameSummary) => {
cy.window().its('cuttle.app.$store').invoke('dispatch', 'requestSubscribe', gameSummary.gameId);
cy.log(`Subscribed to game ${gameSummary.gameId}`);
cy.vueRoute(`/lobby/${gameSummary.gameId}`);
cy.wrap(gameSummary).as('gameSummary');
cy.get('[data-cy=ready-button]').click();
if (!alreadyAuthenticated) {
cy.signupOpponent(opponentUsername, opponentPassword);
}
cy.subscribeOpponent(gameSummary.gameId);
cy.readyOpponent();
// Asserting 5 cards in players hand confirms game has loaded
cy.get('#player-hand-cards .player-card').should('have.length', 5);
});
});
strong-football-17493
12/20/2022, 2:08 PMcy.intercept()
ending the request and then NOT reach the actual endpoint.
I'm stubbing via the req.reply()
by returning a staticResponse (json file fixture), there is an aliasing chained to the intercept().
Every time I try, it's always showing the real network call in network tab in console.
I'm almost in the same situation as described in this old and fixed issue : https://github.com/cypress-io/cypress/issues/15841#issue-852063225
Thanks in advance & hope someone already faced this and would be able to help me 😅
Cypress version 12.1.0gray-kilobyte-89541
12/20/2022, 2:50 PMgreen-book-63455
12/20/2022, 2:57 PMstrong-football-17493
12/20/2022, 2:57 PMtypescript
cy.intercept(
{
method: 'GET',
pathname: `/my/endpoint*`,
query: { q: `${myVar}` },
},
(req) => {
req.reply({ statusCode: 200, fixture: `my-json-file.json` });
}
).as('my-alias');
The thing is that I also have a monitoring tool (in addition with the console network) which is also showing that network calls are REALLY made.
That's why I'm a little bit confused :/
I've found this issue where it seems that this person encountered same issue as I do: https://github.com/cypress-io/cypress/discussions/9320#discussion-37482 (but the callback trick with send() function does not work for me)strong-football-17493
12/20/2022, 3:36 PMplain-elephant-20908
12/20/2022, 4:31 PMplain-elephant-20908
12/20/2022, 4:36 PMnpm run cy:open -- --arg1=1 --arg2='arg2'
Except the options given in the Cypress Command : https://docs.cypress.io/guides/guides/command-line#Commands
Reference |`https://github.com/npm/npm/pull/5518`polite-garage-57372
12/20/2022, 5:00 PMnpm run cy:open --env=uat