gorgeous-bird-50464
08/22/2021, 2:14 AMloud-policeman-30507
08/25/2021, 3:26 PMfresh-needle-9968
08/25/2021, 7:14 PMsupportFile
config option just straight up not work? I've set it to false and it still runs my beforeEach hookfancy-airplane-60156
08/28/2021, 5:59 AMpolite-midnight-10174
08/30/2021, 1:11 AMwonderful-match-15836
08/30/2021, 1:35 AMpolite-midnight-10174
08/30/2021, 6:34 PMsalmon-mechanic-55727
08/31/2021, 10:48 PMhandsome-queen-5268
09/02/2021, 2:58 PMuser
09/03/2021, 5:13 PMuser
09/07/2021, 7:46 AM// using node-msal for azure
Cypress.Commands.add('authenticate', (role) => {
// TODO: ignore role for now
const usernamePasswordRequest = {
scopes: ["user.read"],
username: 'foo@bar.com',
password: 'f00'
};
return new Cypress.Promise((resolve, reject) => {
// Returns a promise
return pca.acquireTokenByUsernamePassword(usernamePasswordRequest).then(() => {
// at this point pca has token and we resolve the getKVStore
resolve(pca.getTokenCache().getKVStore());
}).catch(err => {
reject(err);
});
});
});
Cypress.Commands.add('login', (role = 'ADMIN') => {
// If I comment out cy.session, it works
cy.session(['login', role], () => {
cy.authenticate(role).then(token => {
const cacheKeys = Object.keys(token);
cy.window().then(win => {
for (let key of cacheKeys) {
win(key, JSON.stringify(token[key]));
}
})
})
});
});
In my beforeEach hook I call cy.login('ADMIN') and then cy.visit('/some') and in my test window.sessionStorage is empty and hence I am redirected to login page.user
09/08/2021, 4:03 PMuser
09/08/2021, 4:04 PMWebpack Compilation Error
./cypress/helpers/index.ts 35:25
Module parse failed: Unexpected token (35:25)
File was processed with these loaders:
* ../../../../Library/Caches/Cypress/8.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/ts-loader/index.js
You may need an additional loader to handle the result of these loaders.
| */
| function getUniqueDomainName(part) {
> const partId = part ?? Date.now().toString();
| return faker.internet.domainWord() + '-' + partId + '.' + faker.internet.domainSuffix();
| }
@ ./cypress/support/commands.ts 14:0-43 156:21-34 227:19-32
@ ./cypress/support/index.ts
user
09/08/2021, 4:04 PM??
steep-house-78657
09/08/2021, 5:44 PMfast-action-74989
09/09/2021, 9:31 AMfast-action-74989
09/09/2021, 9:33 AMimportant-river-75795
09/09/2021, 9:33 AMjavascript
Cypress.on("window:before:load", (win) => {
cy.stub(win.console, "error").callsFake((msg) => {
// Logging to command log and failing the test case if console error is thrown
throw new Error(msg);
}
});
});
important-river-75795
09/09/2021, 9:34 AMfast-action-74989
09/09/2021, 9:34 AMimportant-river-75795
09/09/2021, 9:34 AMimportant-river-75795
09/09/2021, 9:34 AMimportant-river-75795
09/09/2021, 9:35 AMimportant-river-75795
09/09/2021, 9:35 AMfast-action-74989
09/09/2021, 9:37 AMimportant-river-75795
09/09/2021, 10:15 AMimportant-river-75795
09/09/2021, 10:15 AMfast-action-74989
09/09/2021, 10:24 AMimportant-river-75795
09/09/2021, 10:31 AMuser
09/09/2021, 12:35 PM