fix tests

This commit is contained in:
counterweight 2025-02-27 18:26:36 +01:00
parent 0b3fe23cd3
commit aec803d321
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
4 changed files with 23 additions and 10 deletions

View file

@ -44,6 +44,12 @@
} }
} }
.max-size-zero {
max-width: 0;
max-height: 0;
}
.top-notification-good { .top-notification-good {
border-radius: 10px; border-radius: 10px;
background-color: rgb(9, 165, 9); background-color: rgb(9, 165, 9);
@ -56,9 +62,9 @@
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
left: 50%; left: 50%;
transform: translate(-50%, -200%); transform: translate(-50%, -200px);
transition: transform 1s ease-in-out; transition:
transform 2s ease-in-out;
} }
.top-notification-good.revealed { .top-notification-good.revealed {

View file

@ -157,13 +157,16 @@ async function publishOffer() {
body: JSON.stringify({ offerDetails }), body: JSON.stringify({ offerDetails }),
}); });
offerCreatedPopup.classList.remove('max-size-zero');
offerCreatedPopup.classList.add('revealed'); offerCreatedPopup.classList.add('revealed');
setTimeout(() => { setTimeout(() => {
offerCreatedPopup.classList.remove('revealed'); offerCreatedPopup.classList.remove('revealed');
}, 3000); }, 3000);
setTimeout(() => { setTimeout(() => {
offerCreatedPopup.classList.remove('revealed'); offerCreatedPopup.classList.add('max-size-zero');
}, 3000); }, 4000);
toggleCreateOfferControls();
} }
buttonStartCreateOffer.addEventListener('click', () => { buttonStartCreateOffer.addEventListener('click', () => {

View file

@ -178,7 +178,7 @@
</button> </button>
</div> </div>
</div> </div>
<div id="offer-created-confirmation" class="top-notification-good"> <div id="offer-created-confirmation" class="top-notification-good max-size-zero">
<img <img
src="/img/circle-check-white.svg" src="/img/circle-check-white.svg"
/> />

View file

@ -1,4 +1,5 @@
const { test, expect, hardcodedSessionUuid } = require('./test-setup'); const { test, expect, hardcodedSessionUuid } = require('./test-setup');
const { chromium } = require('playwright');
const SessionCreated = require('../src/models/SessionCreated'); const SessionCreated = require('../src/models/SessionCreated');
const SessionRelatedToPublickey = require('../src/models/SessionRelatedToPublickey'); const SessionRelatedToPublickey = require('../src/models/SessionRelatedToPublickey');
@ -41,6 +42,7 @@ test('Create an offer with a few options creates in DB', async ({
await page.goto('http://localhost/offers'); await page.goto('http://localhost/offers');
await page.getByRole('button', { name: 'Crear nueva oferta' }).click(); await page.getByRole('button', { name: 'Crear nueva oferta' }).click();
await expect(page.locator('#close-offer-controls-area')).toBeVisible();
await page.getByRole('button', { name: 'Quiero vender Bitcoin' }).click(); await page.getByRole('button', { name: 'Quiero vender Bitcoin' }).click();
await page.getByRole('button', { name: 'Quiero comprar Bitcoin' }).click(); await page.getByRole('button', { name: 'Quiero comprar Bitcoin' }).click();
await page.getByRole('button', { name: '+' }).click(); await page.getByRole('button', { name: '+' }).click();
@ -80,11 +82,13 @@ test('Create an offer with a few options creates in DB', async ({
await expect(page.locator('#all-members-checkbox')).not.toBeChecked(); await expect(page.locator('#all-members-checkbox')).not.toBeChecked();
await page.locator('#large-bills-checkbox').check(); await page.locator('#large-bills-checkbox').check();
await expect(page.locator('#large-bills-checkbox')).toBeChecked(); await expect(page.locator('#large-bills-checkbox')).toBeChecked();
await page.getByRole('button', { name: 'Publicar oferta' }).click(); await page.getByRole('button', { name: 'Publicar oferta' }).click();
await page.locator('#close-offer-controls-x').click(); await expect(page.locator('#offer-created-confirmation')).toBeInViewport();
await expect(page.locator('#offers-root')).toMatchAriaSnapshot( await expect(
`- button "Crear nueva oferta"` page.locator('#offer-created-confirmation')
); ).not.toBeInViewport();
await expect(page.locator('#close-offer-controls-area')).not.toBeVisible();
const createdOfferDetailsSetRecord = await OfferDetailsSet.findOne(); const createdOfferDetailsSetRecord = await OfferDetailsSet.findOne();
expect(createdOfferDetailsSetRecord.wants).toBe('BTC'); expect(createdOfferDetailsSetRecord.wants).toBe('BTC');