mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 20:08:34 +00:00
* badges: webapp (#7433) * badges: service migrations, store and catalog * badges: BTCPay provider and settlement poller * badges: web listener and /api endpoints * web: checkout single-page app * badges: tests and BTCPay fixtures * badges: README and ini reference * badges: fix hex16 build on GHC 8.10.7 * badges: Stripe card lane * badges: fix Stripe card checkout, add theming * badges: add a discount row to the order summary * badges: site navbar, embedding, theme, Forget move * badges: use SB code prefix in web checkout * badges: rename sxb app namespace to sb * badges: embed checkout nav via site; keep original app navbar * badges: post iframe height, apply site background when embedded * badges: embed dark surfaces, steadier iframe height * badges: hide app footer when embedded * badges: size embedded body to content, not viewport * badges: declare color-scheme to stop reload flash * badges: fade shell in on load, no reload blank * badges: prerender app shell into index.html * badges: pre-paint theme, hide shell on deep reload * badges: logo returns to landing client-side * badges: embedded wizard back, buy-a-code, resume * badges: signal app-managed screens, resume across reload * badges: rebuild wizard history on deep load so Back walks it * badges: carry welcome-page height as the iframe floor * badges: keep selection on Buy a code; rename to Your codes * badges: read web shell as UTF-8, not locale * badges: resume the exact paid order after Stripe card redirect * badges: move docker deploy under scripts * badges: add serve_webapp toggle and webapp export * badges: wire split webapp deploy in docker config * badges: quiet agent logs by default * badges: resume card redirect in the embedded frame * badges: migrate Stripe adapter to PaymentIntents * badges: correct Stripe restricted key scopes in ini example * badges: card via Payment Element and PaymentIntents * badges: fix stale Checkout Session wording in Stripe adapter * badges: fix stale CheckoutActions reference in card comment * badges: order shell stylesheet before bootstrap script * badges: remove development card stand-in * badges: theme the Stripe card form with the site palette * badges: exclude web from the Haskell build stage * badges: unify invoice cancel and mark canceled * badges: default log level to info * badges: unify closed-invoice buy-again button * badges: mute agent connection logs at info level * badges: show purchase time in local timezone in Your codes * badges: log service events on own channel, quiet agent * badges: fold service migrations into one baseline * badges: run compose on postgres over host network * badges: use high-res hero art * badges: add web CI to catch stale builds * badges: rebuild web shell from committed source * badges: normalize invoice-code link and columns * badges: drop unused columns, rename index * badges: note deferred receipt_hash in migrations * badges: apply code-review fixes * badges: reduce comments across service and web --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com> Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> * badges: improve web page (#7546) * badges: improve web page * improve layout * improve layout * fix * small changes --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> * badges: read one issuer key from the ini * badges: move and group the service tests * badges: service fixes (#7567) * badges: match the redeem error wording in tests * badges: drop unused imports in the bot tests * badges: cancel Stripe orders when they expire * badges: correct the Stripe config and docs * badges: refuse to revoke a redeemed code * badges: make the fake Stripe cancel like Stripe * badges: limit replayed webhook deliveries --------- Co-authored-by: sh <37271604+shumvgolove@users.noreply.github.com> Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> Co-authored-by: shum <github.shum@liber.li> Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
129 lines
4.5 KiB
Haskell
129 lines
4.5 KiB
Haskell
{-# LANGUAGE CPP #-}
|
|
{-# LANGUAGE DuplicateRecordFields #-}
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
{-# LANGUAGE TupleSections #-}
|
|
|
|
import Bots.BadgeService.BTCPayTests
|
|
import Bots.BadgeService.BotTests
|
|
import Bots.BadgeService.CatalogTests
|
|
import Bots.BadgeService.ConfigTests
|
|
import Bots.BadgeService.StripeTests
|
|
import Bots.BadgeService.WaitersTests
|
|
import Bots.BadgeService.WebTests
|
|
import Bots.BroadcastTests
|
|
import Bots.DirectoryTests
|
|
import ChatClient
|
|
import ChatTests
|
|
import ChatTests.DBUtils
|
|
import ChatTests.Names (chatNamesTests)
|
|
import ChatTests.Utils (xdescribe'')
|
|
import Control.Logger.Simple
|
|
import Data.Time.Clock.System
|
|
import BadgeTests
|
|
import JSONTests
|
|
import MarkdownTests
|
|
import MemberRelationsTests
|
|
import MessageBatching
|
|
import ProtocolTests
|
|
import OperatorTests
|
|
import RandomServers
|
|
import RemoteTests
|
|
import Test.Hspec hiding (it)
|
|
import UnliftIO.Temporary (withTempDirectory)
|
|
import ValidNames
|
|
import ViewTests
|
|
#if defined(dbPostgres)
|
|
import Control.Exception (bracket_)
|
|
import PostgresSchemaDump
|
|
import Simplex.Chat.Store.Postgres.Migrations (migrations)
|
|
import Simplex.Messaging.Agent.Store.Postgres.Util (createDBAndUserIfNotExists, dropDatabaseAndUser)
|
|
import System.Directory (createDirectoryIfMissing, removePathForcibly)
|
|
#else
|
|
import APIDocs
|
|
import qualified Simplex.Messaging.TMap as TM
|
|
import MobileTests
|
|
import SchemaDump
|
|
import WebRTCTests
|
|
#endif
|
|
|
|
main :: IO ()
|
|
main = do
|
|
setLogLevel LogError
|
|
#if !defined(dbPostgres)
|
|
chatQueryStats <- TM.emptyIO
|
|
agentQueryStats <- TM.emptyIO
|
|
#endif
|
|
withGlobalLogging logCfg . hspec
|
|
$ do
|
|
#if defined(dbPostgres)
|
|
createdDropDb . around_ (bracket_ (createDirectoryIfMissing False "tests/tmp") (removePathForcibly "tests/tmp")) $
|
|
describe "Postgres schema dump" $
|
|
postgresSchemaDumpTest
|
|
migrations
|
|
schemaDumpDBOpts
|
|
"src/Simplex/Chat/Store/Postgres/Migrations/chat_schema.sql"
|
|
#else
|
|
describe "Schema dump" schemaDumpTest
|
|
#if MIN_VERSION_base(4,18,0)
|
|
describe "Bot API docs" apiDocsTest
|
|
#endif
|
|
around tmpBracket $ describe "WebRTC encryption" webRTCTests
|
|
#endif
|
|
describe "Supporter badges" badgeTests
|
|
describe "SimpleX badge service" $ do
|
|
badgeConfigTests
|
|
badgeWebTests
|
|
badgeCatalogTests
|
|
badgeWaitersTests
|
|
badgeBTCPayTests
|
|
badgeStripeTests
|
|
describe "SimpleX chat markdown" markdownTests
|
|
describe "JSON Tests" jsonTests
|
|
describe "Member relations" memberRelationsTests
|
|
describe "SimpleX chat view" viewTests
|
|
describe "SimpleX chat protocol" protocolTests
|
|
describe "Valid names" validNameTests
|
|
describe "Message batching" batchingTests
|
|
describe "Operators" operatorTests
|
|
describe "Random servers" randomServersTests
|
|
#if !defined(dbPostgres)
|
|
around (tmpTestBracket chatQueryStats agentQueryStats) $ describe "names tests" chatNamesTests
|
|
around (tmpTestBracket chatQueryStats agentQueryStats) $ xdescribe'' "SimpleX Directory names" directoryNameTests
|
|
#endif
|
|
#if defined(dbPostgres)
|
|
createdDropDb . around testBracket
|
|
#else
|
|
around (testBracket chatQueryStats agentQueryStats)
|
|
#endif
|
|
$ do
|
|
#if !defined(dbPostgres)
|
|
describe "Mobile API Tests" mobileTests
|
|
#endif
|
|
describe "SimpleX chat client" chatTests
|
|
xdescribe'' "SimpleX Broadcast bot" broadcastBotTests
|
|
xdescribe'' "SimpleX Directory service bot" directoryServiceTests
|
|
xdescribe'' "SimpleX badge service e2e" badgeServiceTests
|
|
describe "Remote session" remoteTests
|
|
#if !defined(dbPostgres)
|
|
xdescribe'' "Save query plans" saveQueryPlans
|
|
#endif
|
|
where
|
|
#if defined(dbPostgres)
|
|
createdDropDb =
|
|
before_ (dropDatabaseAndUser testDBConnectInfo >> createDBAndUserIfNotExists testDBConnectInfo)
|
|
. after_ (dropDatabaseAndUser testDBConnectInfo)
|
|
testBracket test = withSmpServer $ tmpBracket $ \tmpPath -> test TestParams {tmpPath, printOutput = False}
|
|
#else
|
|
testBracket chatQueryStats agentQueryStats test =
|
|
withSmpServer $ tmpBracket $ \tmpPath -> test TestParams {tmpPath, chatQueryStats, agentQueryStats, printOutput = False}
|
|
tmpTestBracket chatQueryStats agentQueryStats test =
|
|
tmpBracket $ \tmpPath -> test TestParams {tmpPath, chatQueryStats, agentQueryStats, printOutput = False}
|
|
#endif
|
|
tmpBracket test = do
|
|
t <- getSystemTime
|
|
let ts = show (systemSeconds t) <> show (systemNanoseconds t)
|
|
withTmpFiles $ withTempDirectory "tests/tmp" ts test
|
|
|
|
logCfg :: LogConfig
|
|
logCfg = LogConfig {lc_file = Nothing, lc_stderr = True}
|