Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f51cc7d8
Commit
f51cc7d8
authored
Jun 29, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move frontend EE-related tests to the EE folder
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/334826
parent
b131b903
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
39 deletions
+70
-39
ee/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js
...rojects/settings/components/shared_runners_toggle_spec.js
+70
-0
spec/frontend/projects/settings/components/shared_runners_toggle_spec.js
...rojects/settings/components/shared_runners_toggle_spec.js
+0
-39
No files found.
ee/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js
0 → 100644
View file @
f51cc7d8
import
{
GlToggle
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
CcValidationRequiredAlert
from
'
ee_component/billings/components/cc_validation_required_alert.vue
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
SharedRunnersToggleComponent
from
'
~/projects/settings/components/shared_runners_toggle.vue
'
;
const
TEST_UPDATE_PATH
=
'
/test/update_shared_runners
'
;
describe
(
'
projects/settings/components/shared_runners
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
SharedRunnersToggleComponent
,
{
propsData
:
{
isEnabled
:
false
,
isDisabledAndUnoverridable
:
false
,
isLoading
:
false
,
updatePath
:
TEST_UPDATE_PATH
,
isCreditCardValidationRequired
:
false
,
...
props
,
},
});
};
const
findSharedRunnersToggle
=
()
=>
wrapper
.
find
(
GlToggle
);
const
findCcValidationRequiredAlert
=
()
=>
wrapper
.
findComponent
(
CcValidationRequiredAlert
);
const
getToggleValue
=
()
=>
findSharedRunnersToggle
().
props
(
'
value
'
);
const
isToggleDisabled
=
()
=>
findSharedRunnersToggle
().
props
(
'
disabled
'
);
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
with credit card validation required and shared runners DISABLED
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
subscriptions_url
:
TEST_HOST
,
payment_form_url
:
TEST_HOST
,
};
createComponent
({
isCreditCardValidationRequired
:
true
,
isEnabled
:
false
,
});
});
it
(
'
toggle should not be visible
'
,
()
=>
{
expect
(
findSharedRunnersToggle
().
exists
()).
toBe
(
false
);
});
it
(
'
credit card validation component should exist
'
,
()
=>
{
expect
(
findCcValidationRequiredAlert
().
exists
()).
toBe
(
true
);
expect
(
findCcValidationRequiredAlert
().
text
()).
toBe
(
SharedRunnersToggleComponent
.
i18n
.
REQUIRES_VALIDATION_TEXT
,
);
});
describe
(
'
when credit card is validated
'
,
()
=>
{
it
(
'
should show the toggle button
'
,
async
()
=>
{
findCcValidationRequiredAlert
().
vm
.
$emit
(
'
verifiedCreditCard
'
);
await
waitForPromises
();
expect
(
findSharedRunnersToggle
().
exists
()).
toBe
(
true
);
expect
(
getToggleValue
()).
toBe
(
false
);
expect
(
isToggleDisabled
()).
toBe
(
false
);
});
});
});
});
spec/frontend/projects/settings/components/shared_runners_toggle_spec.js
View file @
f51cc7d8
import
{
GlAlert
,
GlToggle
,
GlTooltip
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
MockAxiosAdapter
from
'
axios-mock-adapter
'
;
import
CcValidationRequiredAlert
from
'
ee_component/billings/components/cc_validation_required_alert.vue
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
SharedRunnersToggleComponent
from
'
~/projects/settings/components/shared_runners_toggle.vue
'
;
...
...
@@ -31,7 +29,6 @@ describe('projects/settings/components/shared_runners', () => {
const
findErrorAlert
=
()
=>
wrapper
.
find
(
GlAlert
);
const
findSharedRunnersToggle
=
()
=>
wrapper
.
find
(
GlToggle
);
const
findToggleTooltip
=
()
=>
wrapper
.
find
(
GlTooltip
);
const
findCcValidationRequiredAlert
=
()
=>
wrapper
.
findComponent
(
CcValidationRequiredAlert
);
const
getToggleValue
=
()
=>
findSharedRunnersToggle
().
props
(
'
value
'
);
const
isToggleLoading
=
()
=>
findSharedRunnersToggle
().
props
(
'
isLoading
'
);
const
isToggleDisabled
=
()
=>
findSharedRunnersToggle
().
props
(
'
disabled
'
);
...
...
@@ -158,40 +155,4 @@ describe('projects/settings/components/shared_runners', () => {
});
});
});
describe
(
'
with credit card validation required and shared runners DISABLED
'
,
()
=>
{
beforeEach
(()
=>
{
window
.
gon
=
{
subscriptions_url
:
TEST_HOST
,
payment_form_url
:
TEST_HOST
,
};
createComponent
({
isCreditCardValidationRequired
:
true
,
isEnabled
:
false
,
});
});
it
(
'
toggle should not be visible
'
,
()
=>
{
expect
(
findSharedRunnersToggle
().
exists
()).
toBe
(
false
);
});
it
(
'
credit card validation component should exist
'
,
()
=>
{
expect
(
findCcValidationRequiredAlert
().
exists
()).
toBe
(
true
);
expect
(
findCcValidationRequiredAlert
().
text
()).
toBe
(
SharedRunnersToggleComponent
.
i18n
.
REQUIRES_VALIDATION_TEXT
,
);
});
describe
(
'
when credit card is validated
'
,
()
=>
{
it
(
'
should show the toggle button
'
,
async
()
=>
{
findCcValidationRequiredAlert
().
vm
.
$emit
(
'
verifiedCreditCard
'
);
await
waitForPromises
();
expect
(
findSharedRunnersToggle
().
exists
()).
toBe
(
true
);
expect
(
getToggleValue
()).
toBe
(
false
);
expect
(
isToggleDisabled
()).
toBe
(
false
);
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment