Skip to content

Commit a189332

Browse files
author
Guillaume Chau
committed
test: plugins
1 parent eab3c11 commit a189332

File tree

7 files changed

+59
-3
lines changed

7 files changed

+59
-3
lines changed

packages/@vue/cli-ui/src/components/FolderExplorerItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="foder-explorer-item">
2+
<div class="folder-explorer-item">
33
<VueIcon :icon="folder.isPackage ? 'folder' : 'folder_open'" class="folder-icon big"/>
44
<div class="folder-name">
55
{{ folder.name }}
@@ -43,7 +43,7 @@ export default {
4343
position relative
4444
top 5px
4545
46-
.foder-explorer-item
46+
.folder-explorer-item
4747
padding $padding-item
4848
h-box()
4949
align-items center

packages/@vue/cli-ui/src/components/PackageSearchItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
show-description
1717
>
1818
<template slot="name">
19-
<span class="name">
19+
<span class="name" data-testid="name">
2020
<ais-highlight
2121
:result="pkg"
2222
attribute-name="name"

packages/@vue/cli-ui/src/components/ProjectSelectList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<div
1818
v-if="data.projects.find(item => item.favorite)"
1919
class="cta-text"
20+
:class="favorite ? 'favorite' : 'other'"
2021
>
2122
{{ $t(`components.project-select-list.titles.${favorite ? 'favorite' : 'other'}`) }}
2223
</div>

packages/@vue/cli-ui/src/components/ProjectSelectListItem.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class="icon-button"
77
:icon-left="project.favorite ? 'star' : 'star_border'"
88
v-tooltip="$t('components.project-select-list-item.tooltips.favorite')"
9+
data-testid="favorite-button"
910
@click.stop="$emit('favorite')"
1011
/>
1112
</div>
@@ -20,6 +21,7 @@
2021
class="icon-button"
2122
icon-left="delete"
2223
v-tooltip="$t('components.project-select-list-item.tooltips.delete')"
24+
data-testid="delete-button"
2325
@click.stop="$emit('remove')"
2426
/>
2527
</div>

packages/@vue/cli-ui/src/views/ProjectPlugins.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:label="$t('views.project-plugins.button')"
1111
class="primary"
1212
:to="{ name: 'project-plugins-add' }"
13+
data-testid="add-plugin"
1314
/>
1415
</template>
1516

packages/@vue/cli-ui/src/views/ProjectPluginsAdd.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
:label="$t('views.project-plugins-add.tabs.search.buttons.install', { target: selectedId || $t('views.project-plugins-add.plugin') })"
7676
class="big primary"
7777
:disabled="!selectedId"
78+
data-testid="download-plugin"
7879
@click="installPlugin()"
7980
/>
8081
</div>
@@ -108,6 +109,7 @@
108109
:label="$t('views.project-plugins-add.tabs.configuration.buttons.finish')"
109110
class="big primary"
110111
:disabled="!configurationValid"
112+
data-testid="finish-install"
111113
@click="invokePlugin()"
112114
/>
113115
</div>

packages/@vue/cli-ui/tests/e2e/specs/test.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,54 @@ describe('Vue project manager', () => {
6060
cy.get('.project-home', { timeout: 250000 }).should('be.visible')
6161
cy.get('.current-project').should('have.text', 'cli-ui-test')
6262
})
63+
64+
it('Favorites the project', () => {
65+
cy.visit('/project/select')
66+
cy.get('.project-select-list-item').eq(0).get('[data-testid="favorite-button"]').click()
67+
cy.get('.cta-text.favorite').should('be.visible')
68+
cy.get('.project-select-list-item').eq(0).get('[data-testid="favorite-button"]').click()
69+
cy.get('.cta-text.favorite').should('not.exist')
70+
})
71+
72+
it('Imports a project', () => {
73+
cy.visit('/project/select')
74+
cy.get('.project-select-list-item').eq(0).get('[data-testid="delete-button"]').click()
75+
cy.get('.project-select-list-item').should('not.exist')
76+
cy.get('.tab-button').eq(2).click()
77+
cy.get('.import').within(() => {
78+
cy.get('.folder-explorer').should('be.visible')
79+
cy.get('.current-path').click()
80+
cy.get('.path-input input').clear().type(Cypress.env('cwd') + '{enter}')
81+
cy.get(`.folder-explorer-item:contains('cli-ui-test')`).click()
82+
cy.get('.import-project').should('not.have.class', 'disabled').click()
83+
})
84+
cy.get('.project-home').should('be.visible')
85+
cy.get('.current-project').should('have.text', 'cli-ui-test')
86+
})
87+
})
88+
89+
describe('Plugins', () => {
90+
it('Should display the plugins', () => {
91+
cy.visit('/')
92+
cy.get('.project-plugin-item').should('have.length', 2)
93+
})
94+
95+
it('Should add a plugin', () => {
96+
cy.visit('/')
97+
cy.get('[data-testid="add-plugin"]').click()
98+
cy.get('.project-plugins-add').should('be.visible')
99+
// Search
100+
cy.get('.package-search-item:contains("@vue/cli-plugin-pwa")').should('be.visible')
101+
cy.get('.instant-search-input input').clear().type('unit-jest')
102+
cy.get('.package-search-item:contains("@vue/cli-plugin-pwa")').should('be.not.visible')
103+
cy.get('.package-search-item:contains("@vue/cli-plugin-unit-jest")').should('be.visible')
104+
cy.get('.instant-search-input input').clear()
105+
// Install
106+
cy.get('.package-search-item:contains("@vue/cli-plugin-pwa") [data-testid="name"]').should('be.visible').click()
107+
cy.get('[data-testid="download-plugin"]:contains("@vue/cli-plugin-pwa")').should('not.have.class', 'disabled').click()
108+
cy.get('.loading-screen .vue-ui-loading-indicator').should('be.visible')
109+
cy.get('.prompts-list', { timeout: 250000 }).should('be.visible')
110+
cy.get('[data-testid="finish-install"]').should('not.have.class', 'disabled').click()
111+
cy.get('.project-plugin-item').should('have.length', 3)
112+
})
63113
})

0 commit comments

Comments
 (0)