Media test helpers
Collection of test helpers used in media component stories and specs
yarn add @atlaskit/media-test-helpers
35.0.6
Patch Changes
- Updated dependencies
Collection of test helpers used in media component stories and specs
yarn add @atlaskit/media-test-helpers
#120533
f1bec731e278f
-
Adds a sideEffects
field to ensure this package does not have Compiled styles tree-shaken in the
future to avoid an accidental regression.
This is related to https://community.developer.atlassian.com/t/rfc-73-migrating-our-components-to-compiled-css-in-js/85953
#117363
10a0f7f6c2027
-
This package's peerDependencies
have been adjusted for react
and/or react-dom
to reflect the
status of only supporting React 18 going forward. No explicit breaking change to React support has
been made in this release, but this is to signify going forward, breaking changes for React 16 or
React 17 may come via non-major semver releases.
Please refer this community post for more details: https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
4660ec858a305
-
Update React
from v16 to v184b7971107c2ff
-
Direct Media examples to Media Staging6099ac032dd30
-
Added viewerOptions to override file preview renderer in media componentsca1195b6c4b46
-
Removes the sideEffects: false attribute from the media test helpers package as it causes
storybook failures for downstream consumersf1c0ae301860f
-
Remove test helpers related to flat-files36b5acc412af5
-
Design system typography uplifta4b5df20bef88
-
Replace hardcoded spacing values with design system tokens6fc64e2707215
-
Removed exports createRateLimitedError, createPollingMaxAttemptsError & createMediaStoreError. Now
they are exposed from @atlaskit/media-client/test-helpers0a733b205b48
-
suppressed a console.warn in development, updated an import to not use media-test-helpersff9488b450dd
-
WHAT: Media has removed the ability to probe for existing file chunks.49213c393ca
- Upgrade
mock-socket
and adapt to API changes756dd90f1a3
- 1.
Deprecate withMediaClient HOC in media-client and migrated it to media-client-react 2. clean up
deprecated imports from media-client6900f89eb0e
- Internal
changes to use space tokens. There is no expected visual or behaviour change.7b6a2c6671b
-
Introducing 'media-state' for handling media internal file state. Introducing 'media-client-react'
to provide hooks for seamless media-client integration with React. Introducing 'MediaCardV2' with
a feature flag to replace rxjs based fileState subscription with 'useFileState' hook. Removed
unused feature flags APIs from 'media-client' and its helper functions from 'media-common'.3fb20c4aeba
- Add
postinstall check to enforce internal peer dependencies48e4a655534
- Internal
change to enforce token usage for spacing properties. There is no expected visual or behaviour
change.9d00501a414
- Ensure
legacy types are published for TS 4.5-4.841fae2c6f68
- Upgrade
Typescript from 4.5.5
to 4.9.5
56507598609
- Skip
minor dependency bump7b0b33845fe
- Added
file state simulation helpersb85816dc2e3
- MEX-2307
Change media-core dependencies in media-test-helpers0f99ed9df35
- Updated
Media Client mock util and Media Database Mockb37723f2cfa
-
FeatureFlagsWrapper no longer filters feature flags. All Media flags will be listed.79660ee4fa7
-
Restructured the Media-Image and added CSS to make doc responsive.db73d317050
- Added
ContentTabs component to be used in docs of media components.c59fd9d42f8
- Fix
warnings due to jest being defined in non-test environments.baece961cdd
- Add
media-card example for use by media-pollinator-test593d2d788e5
-
[MEX-1413] Remove Media-picker-auth-providerad13b4d0bc6
-
[MEX-1525] Remove userAuth from Media-Core & Media-clientbf0e7c8e46b
-
[MEX-1413] Hot fix for remove useMediaPickerAuthProvider flaga424e62b264
- Changes
to support Node 16 Typescript definitions from @types/node
.eaf810b0560
-
[MEX-1398] Remove PopUp implementation from Media-picker8f86bfe1961
-
[MEX-1389] Remove types & interfaces related to media-picker popupa44c7c42fa7
- Added
payload publisher wrapper for logging ufo events in examples#19618
f862d5ae7aa
- remove
RxJs peer dependency
118f3af101f
- Media
Client APIs has been updated to use MediaSubscribable which provides subscription functionality
(similar to RxJs observables). It exposes subscribe method that is called with MediaObserver as an
argument and returns MediaSubscription. MediaSubscription exposes unsubscribe method.
getFileState: The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider });
const fileStateSubscribable: MediaSubscribable<FileState> = mediaClient.file.getFileState(id);
const mediaObserver: MediaObserver<FileState> = {
next: (fileState) => {
nextCallback(fileState)
},
error: (error) => {
errorCallback(error)
},
};
const subscription: MediaSubscription = fileStateSubscribable.subscribe(mediaObserver);
subscription.unsubscribe();
upload: The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider });
const uploadFileSubscribable: MediaSubscribable<FileState> = mediaClient.file.upload(uploadableFile);
const mediaObserver: MediaObserver<FileState> = {
next: (fileState) => {
nextCallback(fileState)
},
error: (error) => {
errorCallback(error)
},
};
const subscription: MediaSubscription = uploadFileSubscribable.subscribe(mediaObserver);
subscription.unsubscribe();
getItems: The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider });
const collectionItemsSubscribable: MediaSubscribable<MediaCollectionItem[]> = mediaClient.collection.getItems(collectionName);
const mediaObserver: MediaObserver<MediaCollectionItem[]> = {
next: (items) => {
nextCallback(items)
},
error: (error) => {
errorCallback(error)
},
};
const subscription: MediaSubscription = collectionItemsSubscribable.subscribe(mediaObserver);
subscription.unsubscribe();
7b8ba79b71b
- use
mimeType in MediaMock when provided8bf4fdb8ed4
- add
renderWithIntl helper8742dbe70bd
- MEX-1102
Removed lodash dependencies from media component and converted all to local functions (lightweight
helpers)94539e589cc
- MEX-1105
Migrated @atlaskit/button to @atlaskit/button/standard-button3ad0bbf0f93
- Log
media ssr getImageURLSync error in global variable ssr data.2f682970bfe
-
Filestates Factory accepts options for MediaClientMock constructorda72247beeb
- remove
styled-components from media-ui22a39ca6f66
- expose
@atlaskit/media-test-helpers/smart-card-state4735277e315
- Extended
FileState factory to update File Id internally5571b079998
- Added A
File State simulator helper#14810
47f58da5946
-
ED-13322, ED-13324, ED-13326, ED-13323, ED-13204: Upgrade and support react-intl@^5.18.1 including
breaking API changes, types and tests in atlassian-frontend packages
What changed: Upgraded our react-intl support from ^2.6.0 to ^5.18.1. This means editor packages now rely on consumers installing ^5.18.1, otherwise editor usage of react-intl will mismatch with actual installed react-intl APIs. Why change was made: As part of a coordinated upgrade effort across AF packages, as react-intl v2 is quite dated. How consumer should update their code: Ensure react-intl ^5.18.1 is installed in consuming applications.
Upgrade guide: To consume atlassian-frontend packages that use react-intl5 setup a second provider for the new version, using an npm alias
"react-intl": "^2.6.0",
"react-intl-next": "npm:react-intl@^5.18.1",
import { IntlProvider } from 'react-intl';
import { IntlProvider as IntlNextProvider } from 'react-intl-next';
return (
<IntlProvider
key={locale}
data-test-language={locale}
locale={locale}
defaultLocale={DEFAULT_LOCALE}
messages={messages}
>
<IntlNextProvider
key={locale}
data-test-language={locale}
locale={locale}
defaultLocale={DEFAULT_LOCALE}
messages={messages}
>
{children}
</IntlNextProvider>
</IntlProvider>
);
1724e1b8277
- Extended
fakeMediaClient with getImageUrlSync mock11df2d9b882
-
Re-enabling non stargate url for media examplesd15fbde3a83
-
Reverting media playground url change because of broken regression testse362e52fc66
- Updating
the media playground urls for media examples, to avoid stargate authcf853e39278
- Make
fakeIntl
's defaultMessage
member to be a jest.fn
with default behvaiour returning provided
{defaultMessage}
argument with fakeIntl[]
wrapping4777a174e6d
- Added
analytics support for customMediaPlayer + screen event + entrypoint for locales254c7ae04bc
- Refactor
CardView in Media Card to group UI elements by status6810728cd53
- Ehance
test for new auth provider in media-image to prevent re-subscription6be6879ef6d
- Added
Media Feature Flags control in examplesbfd2f542849
- Add
JestSpy and JestFunction membersa8c69bc44f9
- Added
missing mock function in fake Media Client implementationabc38bc9990
- Added
request metadata to failed frontend SLIs37d4add135f
- Provide
Media Client Error creatorsfa5ef18162
- Fixed
media client's DataLoader error handlingdfd440f4b5
- [ux] New
functionality to add and remove captions to images and videos. Select an image or video in the
editor to start using it! editor-core now exports dedupe which aids in not having duplicate
plugins added when initialising an editor4c6c92aee6
- Fix
rendering of captionsd6f279ecaa
- Add
support for video files in MediaMock52b1353be9
- BMT-611
Added integration test for Giphy cloud files73613210d4
- Adding
support for Code and Email files so that they are now able to be previewed in the viewer.5f58283e1f
- Export
types using Typescript's new "export type" syntax to satisfy Typescript's --isolatedModules
compiler option. This requires version 3.8 of Typescript, read more about how we handle Typescript
versions here: https://atlaskit.atlassian.com/get-started Also add typescript
to
devDependencies
to denote version that the package was built with.b4cf0f9326
- ED-10439 -
Modify loadImageMockSetup to ensure media-ui mock is not hoisted821e8edaf8
- Make
MediaMock ApiRouter more realistic + replace tall image testing9c50fe8fd0
- Adding
Browser integration tests that simulate a using dragging and dropping a folder7d831363d9
- Migrated
to declarative entry points#3885
6c525a8229
- Upgraded
to TypeScript 3.9.6 and tslib to 2.0.0
Since tslib is a dependency for all our packages we recommend that products also follow this tslib upgrade to prevent duplicates of tslib being bundled.
62eb1114c4
- Enable
passing of MediaFeatureFlags through Editor Renderer via MediaOptions to Media components155125a472
- Add
flushPromise5d20188710
- Added all
supported languages to I18NWrapper8cfc88423a
- Added more
zip examples and added error handling for zip previews2202870181
- Added
support for zip previews in media viewerb8695823e3
- Fixed
Giphy images display as plain text when inserted into Editor3a188fc905
- Fixed
error when using empty mimeType in media examples6262f382de
- Use the
'lodash' package instead of single-function 'lodash.*' packages0c1bb3fa88
- Fixed
mocked response for "/file/copy/withToken" in MediaMock. Added isMediaCollectionItemFullDetails()
to media-client.fa6fb5dfbb
- Removing
unused code to be published7af030b047
- Added
example for broken external file Id87f4720f27
- Officially
dropping IE11 support, from this version onwards there are no warranties of the package working in
IE11. For more information see:
https://community.developer.atlassian.com/t/atlaskit-to-drop-support-for-internet-explorer-11-from-1st-july-2020/39534a2ffde361d
- MPT-131:
fetch remote preview for files not supported by the browser054e719497
- Replace
deprecated Media URLs with latest54d82b49f0
- Remove
unused dependencies[minor]7e363d5aba:
Adding uploadFromDrag function in MediaMockControlsBackdoor
[patch]6a6a991904:
Refactoring uploadImageFromDrag- [patch]84f82f7015:
Change media-mock /file/copy/withToken to be more similar to real implementation- [patch]b2402fc3a2:
Change api-router logging- Updated dependencies f459d99f15:
Updated dependencies 17cc5dde5d:
Updated dependencies 3aedaac8c7:
Updated dependencies f061ed6c98:
Updated dependencies 49dbcfa64c:
Updated dependencies e9d555132d:
Updated dependencies 5f8e3caf72:
Updated dependencies d7b07a9ca4:
Updated dependencies 318a1a0f2f:
Updated dependencies fd4b237ffe:
Updated dependencies 9691bb8eb9:
Updated dependencies 11ff95c0f0:
Updated dependencies fb2b3c8a3b:
Updated dependencies 692692ba24:
Updated dependencies 5550919b98:
Updated dependencies b5f17f0751:
Updated dependencies 109004a98e:
Updated dependencies e5c869ee31:
Updated dependencies 69b678b38c:
Updated dependencies e9044fbfa6:
Updated dependencies fd782b0705:
Updated dependencies 050781f257:
Updated dependencies 4635f8107b:
Updated dependencies d80b8e8fdb:
Updated dependencies d38212e1be:
Updated dependencies ba8c2c4129:
Updated dependencies d3547279dd:
Updated dependencies 67bc25bc3f:
Updated dependencies 4aca202534:
Updated dependencies 48fb5a1b6b:
Updated dependencies f3587bae11:
Updated dependencies 8c8f0099d8:
Updated dependencies c28ff17fbd:
[minor]6dcad31e41:
useMediaPickerPopup
option to Editor which enables using MediaPicker popup even when
userAuthProvider is not provided.Stargate integration is enabled by default as long as an userAuthProvider
is not provided to
MediaClient
.
By default it uses the current domain as base URL. If you need to use a different base URL you can
provide a stargateBaseUrl
configuration:
import { MediaClient } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider, stargateBaseUrl: 'http://stargate-url' });
Note: Editor default behaviour is falling back to native file upload when userAuthProvider
is
not provided. In order to avoid that, and being able to use Stargate, you need to set Media option
useMediaPickerPopup
to true.-
[minor]3cbc8a49a2:
Adding awaitUpload helper function
[patch]d49ebd7c7a:
remove export * from media-test-helpers- Updated dependencies 81684c1847:
Updated dependencies eb962d2c36:
Updated dependencies 9d2da865dd:
Updated dependencies f83b67a761:
Updated dependencies 70b68943d1:
Updated dependencies 9a93eff8e6:
Updated dependencies 13a0e50f38:
Updated dependencies 6dcad31e41:
[major]8b34c7371d:
MediaPickerPageObject methods API has changed.
[minor]41a2496393:
New API is introduced: _ isMediaMockOptedIn
- you can use this in examples
to check if user
wants to use mocked media backend _ mediaMockQueryOptInFlag
- add this flag to query string to
opt-in to mocked media backend-
[minor]bbf5eb8824:
Add asMockFunction utility- [minor]6b06a7baa9:
Introduce a way to fail specific urls in media mock server via backdoor
[patch]196500df34:
move MockGlobalImage to media-test-helpers for reuse- [patch]d7ed7b1513:
Remove export * from media components- Updated dependencies b408e050ab:
Updated dependencies dda84ee26d:
Updated dependencies fd5292fd5a:
Updated dependencies fe9d471b88:
Updated dependencies 08935ea653:
Updated dependencies 196500df34:
Updated dependencies 77474b6821:
Updated dependencies be57ca3829:
Updated dependencies d7ed7b1513:
Updated dependencies 39ee28797d:
Updated dependencies bb06388705:
Updated dependencies fd5292fd5a:
Updated dependencies 832fd6f4f7:
Updated dependencies 695e1c1c31:
Updated dependencies fd5292fd5a:
[patch]6548261c9a:
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies 6548261c9a:
[minor]fe4eaf06fc:
export testMediaGroupFileId and fakeImage
[major]6ee177aeb4:
Stream caches in media-client now use ReplaySubjects instead of Observables. For the most part, this is just the interface that's being updated, as under the hood ReplaySubject was already getting used. ReplaySubjects better suit our use case because they track 1 version of history of the file state. As a consumer, there shouldn't be any necessary code changes. ReplaySubjects extend Observable, so the current usage should continue to work.
[patch]966622bd45:
Stop (large) document load on modal close- Updated dependencies 5504a7da8c:
Updated dependencies 4794f8d527:
Updated dependencies 6ee177aeb4:
[patch]3a20e9a596:
Make PopupSelect correctly pass props. Forcing update of @atlaskit/select for all other packages- Updated dependencies 3a20e9a596:
[patch]b967e41a6b:
Add empty file example to media-viewer
Updated dependencies ae6408e1e4:
[patch]6ef4ae5768:
Bump kakapo, to fix Router instantiation: we now use only 'fetch' as strategy.
FABDODGEM-13 Editor Damask Release - Internal post
BREAKING CHANGES
Affected Editor Components:
tables, media, mobile, emoji, tasks & decisions, analytics
Editor
Mobile
Media
media-viewed
event dispatched when media is interacted with via the media card or viewer.
alt
text attribute on media image elements.
i18n-tools
Bumped dependencies.
[minor]00c11ee352:
Add addGlobalEventEmitterListeners
util to be used in examples to see globalMediaEventEmitter
events in console.
Updated dependencies c3e65f1b9e:
Updated dependencies e7b5c917de:
[patch]35d2229b2a:
Adding missing license to packages and update to Copyright 2019 Atlassian Pty Ltd.
[patch]a2d0043716:
Updated version of analytics-next to fix potential incompatibilities with TS 3.6
[minor]e5c3f6ae3e:
ED-6216: External images will now be uploaded to media services if possible
[patch]097b696613:
Components now depend on TS 3.6 internally, in order to fix an issue with TS resolving non-relative imports as relative imports
[major]69586b5353:
Remove following API members: fakeContext()
, getDefaultContextConfig()
,
createStorybookContext()
, createUploadContext()
. You can use new methods introduced earlier:
fakeMediaClientConfig()
, getDefaultMediaClientConfig()
, etc
[patch]4e8f6f609f:
Remove three fields from MediaFile interface: upfrontId, userUpfrontId and userOccurrenceKey.
[minor]13ca42c394:
Now products can provide auth using getAuthFromContext on MediaClientConfig:
import {MediaClientConfig} from '@atlaskit/media-core'
import Editor from '@atlaskit/editor-core'
const viewMediaClientConfig: MediaClientConfig = {
authProvider // already exists
getAuthFromContext(contextId: string) {
// here products can return auth for external pages.
// in case of copy & paste on Confluence, they can provide read token for
// files on the source collection
}
}
const mediaProvider: = {
viewMediaClientConfig
}
<Editor {...otherNonRelatedProps} media={{provider: mediaProvider}} />
[minor]10c2856bc0:
include defaultMediaPickerCollectionName into collectionNames array to get auth from playgrond
[patch]b0ef06c685:
[major]9ecfef12ac:
createUserContext
was removed, with no alternatives to replace it. asMockReturnValue
jest
helper function was added to make it possible to be type safe.[minor]12aa76d5b5:
[major]ed3f034232:
MediaMock
signature: MediaMock
constructor now takes an object where destination
collection name is the key and the value is a list of <MediaFile & {blob: Blob}>
objects that
will be loaded directly into a database for the corresponding collections. MediaMock now also
exports generateFilesFromTestData
helper function which simplifies test data generation.[major]7c17b35107:
[minor]6f463c4d88:
Updated dependencies a1192ef860:
[minor]5489810e15:
Updated dependencies e38d662f7d:
Updated dependencies e7292ab444:
[patch]0a4ccaafae:
[patch]d13fad66df:
[minor]e1c1fa454a:
[minor]dd14a0a1f0:
Updated dependencies c2c36de22b:
[patch]1d09298688:
[patch]1bcaa1b991:
[major]9d5cc39394:
[minor]4e82fedc90:
Updated dependencies 9d881f1eb8:
Updated dependencies 69c8d0c19c:
[patch]28353efea8:
[major]07a187bb30:
[minor]b1627a5837:
Updated dependencies 85d5d168fd:
[major]3ad16f3:
Updated dependencies dadef80:
[minor]e6516fb:
[minor]72d37fb:
[minor]6bc785d:
[patch]b677631:
[patch]ca16fa9:
[patch]f621523:
[minor]0f42ec1:
Use /items endpoint in media-core
[patch]0a297ba:
[minor]c1ea81c:
[minor]b02ffa7:
[patch]5a6de24:
upload-end
event payload body shape changed from MediaFileData to
FileDetails; All the media pickers config now have new property useNewUploadService: boolean
(false by default); popup media-picker .cancel can't be called with no argument, though types does
allow for it; File
is removed; --- media-store: MediaStore.createFile now has a required
argument of type MediaStoreCreateFileParams; MediaStore.copyFileWithToken new method; uploadFile
method result type has changed from just a promise to a UploadFileResult type; ---
media-test-helpers: mediaPickerAuthProvider argument has changed from a component instance to just
a boolean authEnvironment;
84f6f91createStorybookContext
now takes 1 parameter object of type AuthParameter
. It takes
serviceHost
authType
, that can be either "client"
or "asap"
, depending on what auth option you want
to be used.clientId
is not required anymore.StoryBookTokenProvider
is gone. Instead StoryBookAuthProvider
has new method create
, it
takesisAsapEnvironment
as first parameter and scope
object as second.