refactor: refs #8484 streamline login command and remove commented code
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
f48b2bbab4
commit
05fe2b5b21
|
@ -35,7 +35,7 @@ Cypress.Commands.add('resetDB', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('login', (user = 'developer') => {
|
Cypress.Commands.add('login', (user = 'developer') => {
|
||||||
cy.session(['user-session', user], () => {
|
//cy.visit('/#/login');
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/accounts/login',
|
url: '/api/accounts/login',
|
||||||
|
@ -55,13 +55,33 @@ Cypress.Commands.add('login', (user = 'developer') => {
|
||||||
window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
|
window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
// cy.session(['user-session', user], () => {
|
||||||
|
// cy.request({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: '/api/accounts/login',
|
||||||
|
// body: {
|
||||||
|
// user: user,
|
||||||
|
// password: 'nightmare',
|
||||||
|
// },
|
||||||
|
// }).then((response) => {
|
||||||
|
// window.localStorage.setItem('token', response.body.token);
|
||||||
|
// cy.request({
|
||||||
|
// method: 'GET',
|
||||||
|
// url: '/api/VnUsers/ShareToken',
|
||||||
|
// headers: {
|
||||||
|
// Authorization: window.localStorage.getItem('token'),
|
||||||
|
// },
|
||||||
|
// }).then(({ body }) => {
|
||||||
|
// window.localStorage.setItem('tokenMultimedia', body.multimediaToken.id);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
|
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
|
||||||
originalFn(url, options);
|
originalFn(url, options);
|
||||||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
||||||
cy.waitUntil(() => cy.get('main', { timeout: 10000 }).should('exist'));
|
cy.waitUntil(() => cy.get('main').should('exist'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
|
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
|
||||||
|
|
Loading…
Reference in New Issue