@@ -22,9 +22,9 @@ describe(`Test API key required`, () => {
22
22
23
23
it ( 'Should fail on wrong API key triggered with mouse click' , ( ) => {
24
24
cy . get ( 'div[aria-label=ask-for-api-key]' ) . within ( ( ) => {
25
- cy . get ( 'input[name="apiKey"]' )
26
- . type ( WRONG_APIKEY )
27
- . should ( 'have.value' , WRONG_APIKEY )
25
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
26
+ cy . get ( '@apiKeyInput' ) . type ( WRONG_APIKEY )
27
+ cy . get ( '@apiKeyInput' ) . should ( 'have.value' , WRONG_APIKEY )
28
28
cy . get ( 'button' ) . contains ( 'Go' ) . click ( )
29
29
cy . wait ( WAITING_TIME )
30
30
cy . contains ( 'The provided API key is invalid.' )
@@ -33,21 +33,21 @@ describe(`Test API key required`, () => {
33
33
34
34
it ( 'Should fail on wrong API key triggered with enter key' , ( ) => {
35
35
cy . get ( 'div[aria-label=ask-for-api-key]' ) . within ( ( ) => {
36
- cy . get ( 'input[name="apiKey"]' )
37
- . type ( WRONG_APIKEY )
38
- . should ( 'have.value' , WRONG_APIKEY )
39
- cy . get ( 'input[name="apiKey"] ' ) . type ( '{enter}' )
36
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
37
+ cy . get ( '@apiKeyInput' ) . type ( WRONG_APIKEY )
38
+ cy . get ( '@apiKeyInput' ) . should ( 'have.value' , WRONG_APIKEY )
39
+ cy . get ( '@apiKeyInput ' ) . type ( '{enter}' )
40
40
cy . wait ( WAITING_TIME )
41
41
cy . contains ( 'The provided API key is invalid.' )
42
42
} )
43
43
} )
44
44
45
45
it ( 'Should accept valid API key' , ( ) => {
46
46
cy . get ( 'div[aria-label=ask-for-api-key]' ) . within ( ( ) => {
47
- cy . get ( 'input[name="apiKey"]' )
48
- . clear ( )
49
- . type ( API_KEY )
50
- . should ( 'have.value' , API_KEY )
47
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
48
+ cy . get ( '@apiKeyInput' ) . clear ( )
49
+ cy . get ( '@apiKeyInput' ) . type ( API_KEY )
50
+ cy . get ( '@apiKeyInput' ) . should ( 'have.value' , API_KEY )
51
51
cy . get ( 'button' ) . contains ( 'Go' ) . click ( )
52
52
cy . wait ( WAITING_TIME )
53
53
} )
@@ -57,7 +57,9 @@ describe(`Test API key required`, () => {
57
57
it ( 'Should display a modal with API key inside the API key modal button' , ( ) => {
58
58
// Fill the first API key request
59
59
cy . get ( 'div[aria-label=ask-for-api-key]' ) . within ( ( ) => {
60
- cy . get ( 'input[name="apiKey"]' ) . clear ( ) . type ( API_KEY )
60
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
61
+ cy . get ( '@apiKeyInput' ) . clear ( )
62
+ cy . get ( '@apiKeyInput' ) . type ( API_KEY )
61
63
cy . get ( 'button' ) . contains ( 'Go' ) . click ( )
62
64
} )
63
65
cy . visit ( '/' )
@@ -73,7 +75,9 @@ describe(`Test API key required`, () => {
73
75
it ( 'Should fail on API Key change inside the API key modal button' , ( ) => {
74
76
// Fill the first API key request
75
77
cy . get ( 'div[aria-label=ask-for-api-key]' ) . within ( ( ) => {
76
- cy . get ( 'input[name="apiKey"]' ) . clear ( ) . type ( API_KEY )
78
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
79
+ cy . get ( '@apiKeyInput' ) . clear ( )
80
+ cy . get ( '@apiKeyInput' ) . type ( API_KEY )
77
81
cy . get ( 'button' ) . contains ( 'Go' ) . click ( )
78
82
} )
79
83
cy . visit ( '/' )
@@ -82,10 +86,10 @@ describe(`Test API key required`, () => {
82
86
// Test the change of API key inside the API Key Modal
83
87
cy . get ( 'span' ) . contains ( 'Api Key' ) . parent ( ) . click ( )
84
88
cy . get ( 'div[aria-label=settings-api-key]' ) . within ( ( ) => {
85
- cy . get ( 'input[name="apiKey"]' )
86
- . clear ( )
87
- . type ( WRONG_APIKEY )
88
- . should ( 'have.value' , WRONG_APIKEY )
89
+ cy . get ( 'input[name="apiKey"]' ) . as ( 'apiKeyInput' )
90
+ cy . get ( '@apiKeyInput' ) . clear ( )
91
+ cy . get ( '@apiKeyInput' ) . type ( WRONG_APIKEY )
92
+ cy . get ( '@apiKeyInput' ) . should ( 'have.value' , WRONG_APIKEY )
89
93
cy . get ( 'button' ) . contains ( 'Go' ) . click ( )
90
94
cy . wait ( WAITING_TIME )
91
95
cy . contains ( 'The provided API key is invalid.' )
0 commit comments