openreplay/frontend/cypress/e2e/replayer.cy.ts
Delirium 2ed4bba33e
feat(tracker/ui): support for multi tab sessions (#1236)
* feat(tracker): add support for multi tab sessions

* feat(backend): added support of multitabs

* fix(backend): added support of deprecated batch meta message to pre-decoder

* fix(backend): fixed nil meta issue for TabData messages in sink

* feat(player): add tabmanager

* feat(player): basic tabchange event support

* feat(player): pick tabstate for console panel and timeline

* fix(player): only display tabs that are created

* feat(player): connect performance, xray and events to tab state

* feat(player): merge all tabs data for overview

* feat(backend/tracker): extract tabdata into separate message from batchmeta

* fix(tracker): fix new session check

* fix(backend): remove batchmetadeprecated

* fix(backend): fix switch case

* fix(player): fix for tab message size

* feat(tracker): check for active tabs with broadcast channel

* feat(tracker): prevent multiple messages

* fix(tracker): ignore beacons from same tab, only ask if token isnt present yet, add small delay before start to wait for answer

* feat(player): support new msg struct in assist player

* fix(player): fix some livepl components for multi tab states

* feat(tracker): add option to disable multitab

* feat(tracker): add multitab to assist plugin

* feat(player): back compat for tab id

* fix(ui): fix missing list in controls

* fix(ui): optional list update

* feat(ui): fix visuals for multitab; use window focus event for tabs

* fix(tracker): fix for dying tests (added tabid to writer, refactored other tests)

* feat(ui): update LivePlayerSubHeader.tsx to support tabs

* feat(backend): added tabs support to devtools mob files

* feat(ui): connect state to current tab properly

* feat(backend): added multitab support to assits

* feat(backend): removed data check in agent message

* feat(backend): debug on

* fix(backend): fixed typo in message broadcast

* feat(backend): fixed issue in connect method

* fix(assist): fixed typo

* feat(assist): added more debug logs

* feat(assist): removed one log

* feat(assist): more logs

* feat(assist): use query.peerId

* feat(assist): more logs

* feat(assist): fixed session update

* fix(assist): fixed getSessions

* fix(assist): fixed request_control broadcast

* fix(assist): fixed typo

* fix(assist): added missed line

* fix(assist): fix typo

* feat(tracker): multitab support for assist sessions

* fix(tracker): fix dead tests (tabid prop)

* fix(tracker): fix yaml

* fix(tracker): timers issue

* fix(ui): fix ui E2E tests with magic?

* feat(assist): multitabs support for ee version

* fix(assist): added missed method import

* fix(tracker): fix fix events in assist

* feat(assist): added back compatibility for sessions without tabId

* fix(assist): apply message's top layer structure before broadcast call

* fix(assist): added random tabID for prev version

* fix(assist): added random tabID for prev version (ee)

* feat(assist): added debug logs

* fix(assist): fix typo in sessions_agents_count method

* fix(assist): fixed more typos in copy-pastes

* fix(tracker): fix restart timings

* feat(backend): added tabIDs for some events

* feat(ui): add tab change event to the user steps bar

* Revert "feat(backend): added tabIDs for some events"

This reverts commit 1467ad7f9f.

* feat(ui): revert timeline and xray to grab events from all tabs

* fix(ui): fix typo

---------

Co-authored-by: Alexander Zavorotynskiy <zavorotynskiy@pm.me>
2023-06-07 10:40:32 +02:00

151 lines
5.2 KiB
TypeScript

const SECOND = 1000;
describe(
'Replayer visual match test',
{
viewportHeight: 900,
viewportWidth: 1400,
},
() => {
it('Testing generated tracker session', () => {
cy.intercept('**/api/account').as('getAccount');
cy.intercept('**/dom.mobs?*').as('getFirstMob')
cy.visit('http://0.0.0.0:3333', {
onBeforeLoad: function (window) {
window.localStorage.setItem('notesFeatureViewed', 'true');
},
});
cy.origin('http://localhost:3000/', { args: { SECOND } }, ({ SECOND }) => {
cy.visit('/');
cy.wait(SECOND * 3);
cy.get('#get-table').click()
cy.wait(SECOND * 3);
cy.get('#testrender').click();
cy.wait(SECOND * 3);
cy.get('#testrender').click();
cy.get('#get-main').click()
cy.get('#obscured-text').type('testing typing in obscured input');
cy.get('#visible-input').type('testing typing in visible input');
cy.wait(SECOND * 3);
cy.get('#redcounter').click().click().click();
cy.get('#test-api').click().click();
cy.get('#test-event').click().click();
cy.wait(SECOND * 15);
cy.log('finished generating a session')
cy.window().then((window) => {
cy.task('setValue', { key: 'url', value: window.__OPENREPLAY__.app.getSessionURL() });
cy.log(window.__OPENREPLAY__.app.getSessionURL());
cy.wait(SECOND * 3)
});
});
cy.task('getValue', 'url').as('firstAlias');
cy.visit('/');
cy.get('[data-test-id=login]').type(Cypress.env('account').replaceAll('"', ''));
cy.get('[data-test-id=password]').type(Cypress.env('password').replaceAll('"', ''));
cy.get('[data-test-id=log-button]').click();
cy.wait('@getAccount');
// checking real session
cy.get('@firstAlias').then((firstAlias) => {
cy.log(firstAlias);
cy.log('waiting for session to save')
cy.wait(SECOND * 180);
cy.visit(firstAlias.slice(27) + '?freeze=true');
cy.log('loading session')
cy.wait(SECOND * 10);
cy.window().then(win => {
const jumpMethod = win.playerJump ? win.playerJump : win.playerJumpToTime
jumpMethod(SECOND * 3)
})
cy.wait(SECOND * 3);
cy.matchImageSnapshot('Tracker-3');
cy.window().then(win => {
win.playerJump(SECOND * 6)
})
cy.wait(SECOND * 3);
cy.matchImageSnapshot('Tracker-5');
cy.window().then(win => {
const jumpMethod = win.playerJump ? win.playerJump : win.playerJumpToTime
jumpMethod(SECOND * 9)
})
cy.wait(SECOND * 3);
cy.matchImageSnapshot('Tracker-9');
cy.window().then(win => {
const jumpMethod = win.playerJump ? win.playerJump : win.playerJumpToTime
jumpMethod(SECOND * 20)
})
cy.wait(SECOND * 3);
cy.get('#control-button-redux > .controlButton-module__label--YznMl').click()
cy.wait(SECOND * 0.5)
cy.matchImageSnapshot('Tracker-19-redux');
cy.get('#control-button-network').click()
cy.wait(SECOND * 0.5)
cy.matchImageSnapshot('Tracker-19-network');
cy.get('#control-button-events').click()
cy.wait(SECOND * 0.5)
cy.matchImageSnapshot('Tracker-19-events');
cy.log('custom session test success')
});
});
// this session is long gone
// it('Checking Replayer at breakpoints, user events and console', () => {
// cy.intercept('**/api/account').as('getAccount')
// cy.intercept('**/mobs/7585361734083637/dom.mobs?*').as('getFirstMob')
// cy.intercept('**/mobs/7585361734083637/dom.mobe?*').as('getSecondMob')
// cy.log('testing premade session')
//
// cy.visit('http://0.0.0.0:3333', {
// onBeforeLoad: function (window) {
// window.localStorage.setItem('notesFeatureViewed', 'true');
// }
// })
// cy.get('[data-test-id=login]').type(Cypress.env('account').replaceAll('"', ''));
// cy.get('[data-test-id=password]').type(Cypress.env('password').replaceAll('"', ''));
// cy.get('[data-test-id=log-button]').click();
// cy.wait('@getAccount')
// cy.wait(SECOND * 2)
// cy.visit('3/session/7585361734083637?jumpto=7500&freeze=true')
// cy.wait('@getFirstMob')
// cy.wait('@getSecondMob')
// cy.wait(SECOND * 2)
//
// cy.window().then(win => {
// const jumpMethod = win.playerJump ? win.playerJump : win.playerJumpToTime
// jumpMethod(SECOND * 7.5)
// })
// cy.wait(SECOND * 4)
// cy.matchImageSnapshot('1st-breakpoint');
//
// cy.window().then(win => {
// const jumpMethod = win.playerJump ? win.playerJump : win.playerJumpToTime
// jumpMethod(SECOND * 21)
// })
// cy.wait(SECOND * 4)
// cy.matchImageSnapshot('2nd-breakpoint');
//
// cy.get('[data-openreplay-label="User Steps"]').click()
// cy.wait(SECOND * 0.5)
// cy.matchImageSnapshot('User-Events');
//
// cy.get('#control-button-network > .controlButton-module__label--YznMl').click()
// cy.wait(SECOND * 0.5)
// cy.matchImageSnapshot('Network-Events');
// })
}
);