test: fix remaining integration tests

"Check profile picture syncs" is not fixed yet as it need to be fully
updated and not just fixed (not done as part of this eslint-related PR)
pull/2840/head
Audric Ackermann 2 years ago
parent f01d563725
commit fe2d5ffe6d

@ -83,10 +83,10 @@ test('Check profile picture syncs', async () => {
await waitForTestIdWithText(windowA, 'copy-button-profile-update', 'Copy');
await clickOnTestIdWithText(windowA, 'modal-close-button');
await sleepFor(500);
// TODO this test should retry a few times for the avatar to match
await sleepFor(500, true);
const leftpaneAvatarContainer = await waitForTestIdWithText(windowB, 'leftpane-primary-avatar');
await sleepFor(500);
await sleepFor(500, true);
const screenshot = await leftpaneAvatarContainer.screenshot({
type: 'jpeg',
// path: 'avatar-updated-blue',

@ -1,15 +1,10 @@
import { Page } from '@playwright/test';
import { User } from '../types/testing';
import { clickOnMatchingText, typeIntoInput } from '../utilities/utils';
import { sleepFor } from '../../../session/utils/Promise';
import { clickOnMatchingText, clickOnTestIdWithText, typeIntoInput } from '../utilities/utils';
export const newUser = async (window: Page, userName: string): Promise<User> => {
// Create User
await clickOnMatchingText(window, 'Create Session ID');
// Wait for animation for finish creating ID
await sleepFor(2500);
// Save session ID to a variable
const sessionid = await window.inputValue('[data-testid=session-id-signup]');
await clickOnMatchingText(window, 'Continue');
// Input username = testuser
await typeIntoInput(window, 'display-name-input', userName);
@ -17,6 +12,12 @@ export const newUser = async (window: Page, userName: string): Promise<User> =>
// save recovery phrase
await clickOnMatchingText(window, 'Reveal Recovery Phrase');
const recoveryPhrase = await window.innerText('[data-testid=recovery-phrase-seed-modal]');
await window.click('.session-icon-button.small');
await clickOnTestIdWithText(window, 'leftpane-primary-avatar');
// Save session ID to a variable
const sessionid = await window.innerText('[data-testid=your-session-id]');
console.info(`${userName}: Session ID: ${sessionid} and Recovery phrase: ${recoveryPhrase}`);
await window.click('.session-icon-button.small');

@ -1,4 +1,4 @@
import { Page } from '@playwright/test';
import { Page } from '@playwright/test';
import { clickOnMatchingText, clickOnTestIdWithText, waitForTestIdWithText } from './utils';
export const leaveGroup = async (window: Page) => {

@ -202,7 +202,7 @@ describe('SwarmPolling', () => {
await swarmPolling.start(true);
expect(pollOnceForKeySpy.callCount).to.eq(1);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
});
it('does run for our pubkey even if activeAt is recent ', async () => {
@ -214,7 +214,7 @@ describe('SwarmPolling', () => {
await swarmPolling.start(true);
expect(pollOnceForKeySpy.callCount).to.eq(1);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
});
describe('legacy group', () => {
@ -231,7 +231,7 @@ describe('SwarmPolling', () => {
// our pubkey will be polled for, hence the 2
expect(pollOnceForKeySpy.callCount).to.eq(2);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
});
@ -257,7 +257,7 @@ describe('SwarmPolling', () => {
// our pubkey will be polled for, hence the 2
expect(pollOnceForKeySpy.callCount).to.eq(2);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
getItemByIdStub.restore();
getItemByIdStub = TestUtils.stubData('getItemById');
@ -283,9 +283,9 @@ describe('SwarmPolling', () => {
await swarmPolling.pollForAllKeys();
expect(pollOnceForKeySpy.callCount).to.eq(3);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
});
it('does run twice if activeAt less than one hour ', async () => {
@ -302,7 +302,7 @@ describe('SwarmPolling', () => {
swarmPolling.addGroupId(groupConvoPubkey);
await swarmPolling.start(true);
expect(pollOnceForKeySpy.callCount).to.eq(2);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
pollOnceForKeySpy.resetHistory();
clock.tick(9000);
@ -317,7 +317,7 @@ describe('SwarmPolling', () => {
await sleepFor(10);
expect(pollOnceForKeySpy.callCount).to.eq(2);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
});
@ -347,9 +347,9 @@ describe('SwarmPolling', () => {
await sleepFor(10);
// we should have two more calls here, so 4 total.
expect(pollOnceForKeySpy.callCount).to.eq(4);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.getCalls()[3].args).to.deep.eq([groupConvoPubkey, true, [-10]]);
});
@ -374,7 +374,7 @@ describe('SwarmPolling', () => {
// we should have only one more call here, the one for our direct pubkey fetch
expect(pollOnceForKeySpy.callCount).to.eq(3);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]); // this one comes from the swarmPolling.start
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
});
describe('multiple runs', () => {
@ -416,10 +416,10 @@ describe('SwarmPolling', () => {
// we have 4 calls total. 2 for our direct promises run each 5 seconds, and 2 for the group pubkey active (so run every 5 sec too)
expect(pollOnceForKeySpy.callCount).to.eq(4);
// first two calls are our pubkey
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.getCalls()[3].args).to.deep.eq([groupConvoPubkey, true, [-10]]);
});
@ -440,9 +440,9 @@ describe('SwarmPolling', () => {
expect(pollOnceForKeySpy.callCount).to.eq(4);
// first two calls are our pubkey
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.firstCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.secondCall.args).to.deep.eq([groupConvoPubkey, true, [-10]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0]]);
expect(pollOnceForKeySpy.thirdCall.args).to.deep.eq([ourPubkey, false, [0, 2, 3, 5, 4]]);
expect(pollOnceForKeySpy.getCalls()[3].args).to.deep.eq([groupConvoPubkey, true, [-10]]);
});
});

Loading…
Cancel
Save