@@ -827,29 +827,13 @@ declare namespace Cypress {
827
827
* @see https://on.cypress.io/variables-and-aliases
828
828
* @see https://on.cypress.io/get
829
829
* @example
830
- ```
831
- // Get the aliased 'todos' elements
832
- cy.get('ul#todos').as('todos')
833
- //...hack hack hack...
834
- // later retrieve the todos
835
- cy.get('@todos')
836
- ```
837
- */
838
- as ( alias : string ) : Chainable < Subject >
839
-
840
- /**
841
- * Select a file with the given <input> element, or drag and drop a file over any DOM subject.
830
+ * // Get the aliased 'todos' elements
831
+ * cy.get('ul#todos').as('todos')
842
832
*
843
- * @param {FileReference } files - The file(s) to select or drag onto this element.
844
- * @see https://on.cypress.io/selectfile
845
- * @example
846
- * cy.get('input[type=file]').selectFile(Cypress.Buffer.from('text'))
847
- * cy.get('input[type=file]').selectFile({
848
- * fileName: 'users.json',
849
- * contents: [{name: 'John Doe'}]
850
- * })
833
+ * // later retrieve the todos
834
+ * cy.get('@todos')
851
835
*/
852
- selectFile ( files : FileReference | FileReference [ ] , options ?: Partial < SelectFileOptions > ) : Chainable < Subject >
836
+ as ( alias : string , options ?: Partial < AsOptions > ) : Chainable < Subject >
853
837
854
838
/**
855
839
* Blur a focused element. This element must currently be in focus.
@@ -1915,6 +1899,20 @@ declare namespace Cypress {
1915
1899
*/
1916
1900
select ( valueOrTextOrIndex : string | number | Array < string | number > , options ?: Partial < SelectOptions > ) : Chainable < Subject >
1917
1901
1902
+ /**
1903
+ * Select a file with the given <input> element, or drag and drop a file over any DOM subject.
1904
+ *
1905
+ * @param {FileReference } files - The file(s) to select or drag onto this element.
1906
+ * @see https://on.cypress.io/selectfile
1907
+ * @example
1908
+ * cy.get('input[type=file]').selectFile(Cypress.Buffer.from('text'))
1909
+ * cy.get('input[type=file]').selectFile({
1910
+ * fileName: 'users.json',
1911
+ * contents: [{name: 'John Doe'}]
1912
+ * })
1913
+ */
1914
+ selectFile ( files : FileReference | FileReference [ ] , options ?: Partial < SelectFileOptions > ) : Chainable < Subject >
1915
+
1918
1916
/**
1919
1917
* Set a browser cookie.
1920
1918
*
@@ -2650,6 +2648,7 @@ declare namespace Cypress {
2650
2648
waitForAnimations : boolean
2651
2649
/**
2652
2650
* The distance in pixels an element must exceed over time to be considered animating
2651
+ *
2653
2652
* @default 5
2654
2653
*/
2655
2654
animationDistanceThreshold : number
@@ -2661,15 +2660,20 @@ declare namespace Cypress {
2661
2660
scrollBehavior : scrollBehaviorOptions
2662
2661
}
2663
2662
2664
- interface SelectFileOptions extends Loggable , Timeoutable , ActionableOptions {
2663
+ /**
2664
+ * Options to affect how an alias is stored
2665
+ *
2666
+ * @see https://on.cypress.io/as
2667
+ */
2668
+ interface AsOptions {
2665
2669
/**
2666
- * Which user action to perform. `select` matches selecting a file while
2667
- * `drag-drop` matches dragging files from the operating system into the
2668
- * document .
2670
+ * The type of alias to store, which impacts how the value is retrieved later in the test.
2671
+ * If an alias should be a 'query' (re-runs all queries leading up to the resulting value so it's alway up-to-date) or a
2672
+ * 'static' (read once when the alias is saved and is never updated). `type` has no effect when aliasing intercepts, spies, and stubs .
2669
2673
*
2670
- * @default 'select '
2674
+ * @default 'query '
2671
2675
*/
2672
- action : 'select ' | 'drag-drop '
2676
+ type : 'query ' | 'static '
2673
2677
}
2674
2678
2675
2679
interface BlurOptions extends Loggable , Timeoutable , Forceable { }
@@ -3515,6 +3519,17 @@ declare namespace Cypress {
3515
3519
3516
3520
type SameSiteStatus = 'no_restriction' | 'strict' | 'lax'
3517
3521
3522
+ interface SelectFileOptions extends Loggable , Timeoutable , ActionableOptions {
3523
+ /**
3524
+ * Which user action to perform. `select` matches selecting a file while
3525
+ * `drag-drop` matches dragging files from the operating system into the
3526
+ * document.
3527
+ *
3528
+ * @default 'select'
3529
+ */
3530
+ action : 'select' | 'drag-drop'
3531
+ }
3532
+
3518
3533
interface SetCookieOptions extends Loggable , Timeoutable {
3519
3534
path : string
3520
3535
domain : string
0 commit comments