Commit 58bb22c1 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'ph/enableVueFileListFlag' into 'master'

Enable Vue file list feature flag for tests

See merge request gitlab-org/gitlab!18954
parents 2c6fc1a0 1a370d44
<script> <script>
import { GlTooltipDirective, GlLink, GlButton, GlLoadingIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlButton, GlLoadingIcon } from '@gitlab/ui';
import defaultAvatarUrl from 'images/no_avatar.png';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import Icon from '../../vue_shared/components/icon.vue'; import Icon from '../../vue_shared/components/icon.vue';
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
...@@ -83,6 +84,7 @@ export default { ...@@ -83,6 +84,7 @@ export default {
this.showDescription = !this.showDescription; this.showDescription = !this.showDescription;
}, },
}, },
defaultAvatarUrl,
}; };
</script> </script>
...@@ -97,6 +99,9 @@ export default { ...@@ -97,6 +99,9 @@ export default {
:img-size="40" :img-size="40"
class="avatar-cell" class="avatar-cell"
/> />
<span v-else class="avatar-cell user-avatar-link">
<img :src="$options.defaultAvatarUrl" width="40" height="40" class="avatar s40" />
</span>
<div class="commit-detail flex-list"> <div class="commit-detail flex-list">
<div class="commit-content qa-commit-content"> <div class="commit-content qa-commit-content">
<gl-link :href="commit.webUrl" class="commit-row-message item-title"> <gl-link :href="commit.webUrl" class="commit-row-message item-title">
...@@ -119,6 +124,9 @@ export default { ...@@ -119,6 +124,9 @@ export default {
> >
{{ commit.author.name }} {{ commit.author.name }}
</gl-link> </gl-link>
<template v-else>
{{ commit.authorName }}
</template>
{{ s__('LastCommit|authored') }} {{ s__('LastCommit|authored') }}
<timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" /> <timeago-tooltip :time="commit.authoredDate" tooltip-placement="bottom" />
</div> </div>
...@@ -132,9 +140,8 @@ export default { ...@@ -132,9 +140,8 @@ export default {
</div> </div>
<div class="commit-actions flex-row"> <div class="commit-actions flex-row">
<div v-if="commit.signatureHtml" v-html="commit.signatureHtml"></div> <div v-if="commit.signatureHtml" v-html="commit.signatureHtml"></div>
<div class="ci-status-link"> <div v-if="commit.pipeline" class="ci-status-link">
<gl-link <gl-link
v-if="commit.pipeline"
v-gl-tooltip.left v-gl-tooltip.left
:href="commit.pipeline.detailedStatus.detailsPath" :href="commit.pipeline.detailedStatus.detailsPath"
:title="statusTitle" :title="statusTitle"
......
...@@ -75,6 +75,7 @@ export default { ...@@ -75,6 +75,7 @@ export default {
v-for="entry in val" v-for="entry in val"
:id="entry.id" :id="entry.id"
:key="`${entry.flatPath}-${entry.id}`" :key="`${entry.flatPath}-${entry.id}`"
:sha="entry.sha"
:project-path="projectPath" :project-path="projectPath"
:current-path="path" :current-path="path"
:name="entry.name" :name="entry.name"
......
...@@ -37,6 +37,10 @@ export default { ...@@ -37,6 +37,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
sha: {
type: String,
required: true,
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
...@@ -98,7 +102,7 @@ export default { ...@@ -98,7 +102,7 @@ export default {
return this.path.replace(new RegExp(`^${this.currentPath}/`), ''); return this.path.replace(new RegExp(`^${this.currentPath}/`), '');
}, },
shortSha() { shortSha() {
return this.id.slice(0, 8); return this.sha.slice(0, 8);
}, },
hasLockLabel() { hasLockLabel() {
return this.commit && this.commit.lockLabel; return this.commit && this.commit.lockLabel;
......
...@@ -26,9 +26,12 @@ export function fetchLogsTree(client, path, offset, resolver = null) { ...@@ -26,9 +26,12 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
const { ref } = client.readQuery({ query: getRef }); const { ref } = client.readQuery({ query: getRef });
fetchpromise = axios fetchpromise = axios
.get(`${gon.gitlab_url}/${projectPath}/refs/${ref}/logs_tree/${path.replace(/^\//, '')}`, { .get(
params: { format: 'json', offset }, `${gon.relative_url_root}/${projectPath}/refs/${ref}/logs_tree/${path.replace(/^\//, '')}`,
}) {
params: { format: 'json', offset },
},
)
.then(({ data, headers }) => { .then(({ data, headers }) => {
const headerLogsOffset = headers['more-logs-offset']; const headerLogsOffset = headers['more-logs-offset'];
const { commits } = client.readQuery({ query: getCommits }); const { commits } = client.readQuery({ query: getCommits });
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
fragment TreeEntry on Entry { fragment TreeEntry on Entry {
id id
sha
name name
flatPath flatPath
type type
......
...@@ -8,6 +8,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) { ...@@ -8,6 +8,7 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {
description description
webUrl webUrl
authoredDate authoredDate
authorName
author { author {
name name
avatarUrl avatarUrl
......
...@@ -24,6 +24,8 @@ module Types ...@@ -24,6 +24,8 @@ module Types
description: 'Web URL of the commit' description: 'Web URL of the commit'
field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true, field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
description: 'Rendered HTML of the commit signature' description: 'Rendered HTML of the commit signature'
field :author_name, type: GraphQL::STRING_TYPE, null: true,
description: 'Commit authors name'
# models/commit lazy loads the author by email # models/commit lazy loads the author by email
field :author, type: Types::UserType, null: true, field :author, type: Types::UserType, null: true,
......
...@@ -5,6 +5,7 @@ module Types ...@@ -5,6 +5,7 @@ module Types
include Types::BaseInterface include Types::BaseInterface
field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
field :sha, GraphQL::STRING_TYPE, null: false, description: "Last commit sha for entry", method: :id
field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
field :type, Tree::TypeEnum, null: false # rubocop:disable Graphql/Descriptions field :type, Tree::TypeEnum, null: false # rubocop:disable Graphql/Descriptions
field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
......
...@@ -76,6 +76,11 @@ type Blob implements Entry { ...@@ -76,6 +76,11 @@ type Blob implements Entry {
lfsOid: String lfsOid: String
name: String! name: String!
path: String! path: String!
"""
Last commit sha for entry
"""
sha: String!
type: EntryType! type: EntryType!
webUrl: String webUrl: String
} }
...@@ -121,6 +126,11 @@ type Commit { ...@@ -121,6 +126,11 @@ type Commit {
""" """
author: User author: User
"""
Commit authors name
"""
authorName: String
""" """
Timestamp of when the commit was authored Timestamp of when the commit was authored
""" """
...@@ -1100,6 +1110,11 @@ interface Entry { ...@@ -1100,6 +1110,11 @@ interface Entry {
id: ID! id: ID!
name: String! name: String!
path: String! path: String!
"""
Last commit sha for entry
"""
sha: String!
type: EntryType! type: EntryType!
} }
...@@ -4772,6 +4787,11 @@ type Submodule implements Entry { ...@@ -4772,6 +4787,11 @@ type Submodule implements Entry {
id: ID! id: ID!
name: String! name: String!
path: String! path: String!
"""
Last commit sha for entry
"""
sha: String!
treeUrl: String treeUrl: String
type: EntryType! type: EntryType!
webUrl: String webUrl: String
...@@ -5118,6 +5138,11 @@ type TreeEntry implements Entry { ...@@ -5118,6 +5138,11 @@ type TreeEntry implements Entry {
id: ID! id: ID!
name: String! name: String!
path: String! path: String!
"""
Last commit sha for entry
"""
sha: String!
type: EntryType! type: EntryType!
webUrl: String webUrl: String
} }
......
...@@ -10227,6 +10227,20 @@ ...@@ -10227,6 +10227,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "authorName",
"description": "Commit authors name",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "authoredDate", "name": "authoredDate",
"description": "Timestamp of when the commit was authored", "description": "Timestamp of when the commit was authored",
...@@ -11332,6 +11346,24 @@ ...@@ -11332,6 +11346,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "sha",
"description": "Last commit sha for entry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "type", "name": "type",
"description": null, "description": null,
...@@ -11453,6 +11485,24 @@ ...@@ -11453,6 +11485,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "sha",
"description": "Last commit sha for entry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "type", "name": "type",
"description": null, "description": null,
...@@ -11711,6 +11761,24 @@ ...@@ -11711,6 +11761,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "sha",
"description": "Last commit sha for entry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "treeUrl", "name": "treeUrl",
"description": null, "description": null,
...@@ -11972,6 +12040,24 @@ ...@@ -11972,6 +12040,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "sha",
"description": "Last commit sha for entry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "type", "name": "type",
"description": null, "description": null,
......
...@@ -36,6 +36,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph ...@@ -36,6 +36,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `id` | ID! | | | `id` | ID! | |
| `sha` | String! | Last commit sha for entry |
| `name` | String! | | | `name` | String! | |
| `type` | EntryType! | | | `type` | EntryType! | |
| `path` | String! | | | `path` | String! | |
...@@ -55,6 +56,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph ...@@ -55,6 +56,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| `authoredDate` | Time | Timestamp of when the commit was authored | | `authoredDate` | Time | Timestamp of when the commit was authored |
| `webUrl` | String! | Web URL of the commit | | `webUrl` | String! | Web URL of the commit |
| `signatureHtml` | String | Rendered HTML of the commit signature | | `signatureHtml` | String | Rendered HTML of the commit signature |
| `authorName` | String | Commit authors name |
| `author` | User | Author of the commit | | `author` | User | Author of the commit |
| `latestPipeline` | Pipeline | Latest pipeline of the commit | | `latestPipeline` | Pipeline | Latest pipeline of the commit |
...@@ -738,6 +740,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph ...@@ -738,6 +740,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `id` | ID! | | | `id` | ID! | |
| `sha` | String! | Last commit sha for entry |
| `name` | String! | | | `name` | String! | |
| `type` | EntryType! | | | `type` | EntryType! | |
| `path` | String! | | | `path` | String! | |
...@@ -794,6 +797,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph ...@@ -794,6 +797,7 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
| Name | Type | Description | | Name | Type | Description |
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `id` | ID! | | | `id` | ID! | |
| `sha` | String! | Last commit sha for entry |
| `name` | String! | | | `name` | String! | |
| `type` | EntryType! | | | `type` | EntryType! | |
| `path` | String! | | | `path` | String! | |
......
...@@ -7,13 +7,11 @@ describe 'Projects > Files > User views files page' do ...@@ -7,13 +7,11 @@ describe 'Projects > Files > User views files page' do
let(:user) { project.owner } let(:user) { project.owner }
before do before do
stub_feature_flags(vue_file_list: false)
sign_in user sign_in user
visit project_tree_path(project, project.repository.root_ref) visit project_tree_path(project, project.repository.root_ref)
end end
it 'user sees folders and submodules sorted together, followed by files' do it 'user sees folders and submodules sorted together, followed by files', :js do
rows = all('td.tree-item-file-name').map(&:text) rows = all('td.tree-item-file-name').map(&:text)
tree = project.repository.tree tree = project.repository.tree
......
...@@ -7,7 +7,6 @@ describe 'Projects > Files > Project owner creates a license file', :js do ...@@ -7,7 +7,6 @@ describe 'Projects > Files > Project owner creates a license file', :js do
let(:project_maintainer) { project.owner } let(:project_maintainer) { project.owner }
before do before do
stub_feature_flags(vue_file_list: false)
project.repository.delete_file(project_maintainer, 'LICENSE', project.repository.delete_file(project_maintainer, 'LICENSE',
message: 'Remove LICENSE', branch_name: 'master') message: 'Remove LICENSE', branch_name: 'master')
sign_in(project_maintainer) sign_in(project_maintainer)
......
...@@ -13,23 +13,22 @@ describe "User browses files" do ...@@ -13,23 +13,22 @@ describe "User browses files" do
let(:user) { project.owner } let(:user) { project.owner }
before do before do
stub_feature_flags(vue_file_list: false)
sign_in(user) sign_in(user)
end end
it "shows last commit for current directory" do it "shows last commit for current directory", :js do
visit(tree_path_root_ref) visit(tree_path_root_ref)
click_link("files") click_link("files")
last_commit = project.repository.last_commit_for_path(project.default_branch, "files") last_commit = project.repository.last_commit_for_path(project.default_branch, "files")
page.within(".blob-commit-info") do page.within(".commit-detail") do
expect(page).to have_content(last_commit.short_id).and have_content(last_commit.author_name) expect(page).to have_content(last_commit.short_id).and have_content(last_commit.author_name)
end end
end end
context "when browsing the master branch" do context "when browsing the master branch", :js do
before do before do
visit(tree_path_root_ref) visit(tree_path_root_ref)
end end
...@@ -124,8 +123,7 @@ describe "User browses files" do ...@@ -124,8 +123,7 @@ describe "User browses files" do
expect(current_path).to eq(project_tree_path(project, "markdown/doc/raketasks")) expect(current_path).to eq(project_tree_path(project, "markdown/doc/raketasks"))
expect(page).to have_content("backup_restore.md").and have_content("maintenance.md") expect(page).to have_content("backup_restore.md").and have_content("maintenance.md")
click_link("shop") click_link("maintenance.md")
click_link("Maintenance")
expect(current_path).to eq(project_blob_path(project, "markdown/doc/raketasks/maintenance.md")) expect(current_path).to eq(project_blob_path(project, "markdown/doc/raketasks/maintenance.md"))
expect(page).to have_content("bundle exec rake gitlab:env:info RAILS_ENV=production") expect(page).to have_content("bundle exec rake gitlab:env:info RAILS_ENV=production")
...@@ -144,7 +142,7 @@ describe "User browses files" do ...@@ -144,7 +142,7 @@ describe "User browses files" do
# rubocop:disable Lint/Void # rubocop:disable Lint/Void
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`. # Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`.
find("a", text: /^empty$/)["href"] == project_tree_url(project, "markdown/d") find("a", text: "..")["href"] == project_tree_url(project, "markdown/d")
# rubocop:enable Lint/Void # rubocop:enable Lint/Void
page.within(".tree-table") do page.within(".tree-table") do
...@@ -168,7 +166,7 @@ describe "User browses files" do ...@@ -168,7 +166,7 @@ describe "User browses files" do
end end
end end
context "when browsing a specific ref" do context "when browsing a specific ref", :js do
let(:ref) { project_tree_path(project, "6d39438") } let(:ref) { project_tree_path(project, "6d39438") }
before do before do
...@@ -180,7 +178,7 @@ describe "User browses files" do ...@@ -180,7 +178,7 @@ describe "User browses files" do
expect(page).to have_content(".gitignore").and have_content("LICENSE") expect(page).to have_content(".gitignore").and have_content("LICENSE")
end end
it "shows files from a repository with apostroph in its name", :js do it "shows files from a repository with apostroph in its name" do
first(".js-project-refs-dropdown").click first(".js-project-refs-dropdown").click
page.within(".project-refs-form") do page.within(".project-refs-form") do
...@@ -191,10 +189,10 @@ describe "User browses files" do ...@@ -191,10 +189,10 @@ describe "User browses files" do
visit(project_tree_path(project, "'test'")) visit(project_tree_path(project, "'test'"))
expect(page).to have_css(".tree-commit-link").and have_no_content("Loading commit data...") expect(page).not_to have_selector(".tree-commit .animation-container")
end end
it "shows the code with a leading dot in the directory", :js do it "shows the code with a leading dot in the directory" do
first(".js-project-refs-dropdown").click first(".js-project-refs-dropdown").click
page.within(".project-refs-form") do page.within(".project-refs-form") do
...@@ -203,7 +201,7 @@ describe "User browses files" do ...@@ -203,7 +201,7 @@ describe "User browses files" do
visit(project_tree_path(project, "fix/.testdir")) visit(project_tree_path(project, "fix/.testdir"))
expect(page).to have_css(".tree-commit-link").and have_no_content("Loading commit data...") expect(page).not_to have_selector(".tree-commit .animation-container")
end end
it "does not show the permalink link" do it "does not show the permalink link" do
...@@ -221,7 +219,7 @@ describe "User browses files" do ...@@ -221,7 +219,7 @@ describe "User browses files" do
click_link(".gitignore") click_link(".gitignore")
end end
it "shows a file content", :js do it "shows a file content" do
expect(page).to have_content("*.rbc") expect(page).to have_content("*.rbc")
end end
......
...@@ -7,8 +7,6 @@ describe 'Projects > Files > User browses LFS files' do ...@@ -7,8 +7,6 @@ describe 'Projects > Files > User browses LFS files' do
let(:user) { project.owner } let(:user) { project.owner }
before do before do
stub_feature_flags(vue_file_list: false)
sign_in(user) sign_in(user)
end end
......
...@@ -13,8 +13,6 @@ describe 'Projects > Files > User creates a directory', :js do ...@@ -13,8 +13,6 @@ describe 'Projects > Files > User creates a directory', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(vue_file_list: false)
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
visit project_tree_path(project, 'master') visit project_tree_path(project, 'master')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > User creates files' do describe 'Projects > Files > User creates files', :js do
let(:fork_message) do let(:fork_message) do
"You're not allowed to make changes to this project directly. "\ "You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request." "A fork of this project has been created that you can make changes in, so you can submit a merge request."
...@@ -14,7 +14,6 @@ describe 'Projects > Files > User creates files' do ...@@ -14,7 +14,6 @@ describe 'Projects > Files > User creates files' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(vue_file_list: false)
stub_feature_flags(web_ide_default: false) stub_feature_flags(web_ide_default: false)
project.add_maintainer(user) project.add_maintainer(user)
...@@ -68,8 +67,7 @@ describe 'Projects > Files > User creates files' do ...@@ -68,8 +67,7 @@ describe 'Projects > Files > User creates files' do
file_name = find('#file_name') file_name = find('#file_name')
file_name.set options[:file_name] || 'README.md' file_name.set options[:file_name] || 'README.md'
file_content = find('#file-content', visible: false) find('.ace_text-input', visible: false).send_keys.native.send_keys options[:file_content] || 'Some content'
file_content.set options[:file_content] || 'Some content'
click_button 'Commit changes' click_button 'Commit changes'
end end
...@@ -89,7 +87,7 @@ describe 'Projects > Files > User creates files' do ...@@ -89,7 +87,7 @@ describe 'Projects > Files > User creates files' do
expect(page).to have_content 'Path cannot include directory traversal' expect(page).to have_content 'Path cannot include directory traversal'
end end
it 'creates and commit a new file', :js do it 'creates and commit a new file' do
find('#editor') find('#editor')
execute_script("ace.edit('editor').setValue('*.rbca')") execute_script("ace.edit('editor').setValue('*.rbca')")
fill_in(:file_name, with: 'not_a_file.md') fill_in(:file_name, with: 'not_a_file.md')
...@@ -105,7 +103,7 @@ describe 'Projects > Files > User creates files' do ...@@ -105,7 +103,7 @@ describe 'Projects > Files > User creates files' do
expect(page).to have_content('*.rbca') expect(page).to have_content('*.rbca')
end end
it 'creates and commit a new file with new lines at the end of file', :js do it 'creates and commit a new file with new lines at the end of file' do
find('#editor') find('#editor')
execute_script('ace.edit("editor").setValue("Sample\n\n\n")') execute_script('ace.edit("editor").setValue("Sample\n\n\n")')
fill_in(:file_name, with: 'not_a_file.md') fill_in(:file_name, with: 'not_a_file.md')
...@@ -122,7 +120,7 @@ describe 'Projects > Files > User creates files' do ...@@ -122,7 +120,7 @@ describe 'Projects > Files > User creates files' do
expect(evaluate_script('ace.edit("editor").getValue()')).to eq("Sample\n\n\n") expect(evaluate_script('ace.edit("editor").getValue()')).to eq("Sample\n\n\n")
end end
it 'creates and commit a new file with a directory name', :js do it 'creates and commit a new file with a directory name' do
fill_in(:file_name, with: 'foo/bar/baz.txt') fill_in(:file_name, with: 'foo/bar/baz.txt')
expect(page).to have_selector('.file-editor') expect(page).to have_selector('.file-editor')
...@@ -139,7 +137,7 @@ describe 'Projects > Files > User creates files' do ...@@ -139,7 +137,7 @@ describe 'Projects > Files > User creates files' do
expect(page).to have_content('*.rbca') expect(page).to have_content('*.rbca')
end end
it 'creates and commit a new file specifying a new branch', :js do it 'creates and commit a new file specifying a new branch' do
expect(page).to have_selector('.file-editor') expect(page).to have_selector('.file-editor')
find('#editor') find('#editor')
...@@ -174,7 +172,7 @@ describe 'Projects > Files > User creates files' do ...@@ -174,7 +172,7 @@ describe 'Projects > Files > User creates files' do
expect(page).to have_content(message) expect(page).to have_content(message)
end end
it 'creates and commit new file in forked project', :js do it 'creates and commit new file in forked project' do
expect(page).to have_selector('.file-editor') expect(page).to have_selector('.file-editor')
find('#editor') find('#editor')
......
...@@ -14,8 +14,6 @@ describe 'Projects > Files > User deletes files', :js do ...@@ -14,8 +14,6 @@ describe 'Projects > Files > User deletes files', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(vue_file_list: false)
sign_in(user) sign_in(user)
end end
......
...@@ -12,7 +12,6 @@ describe 'Projects > Files > User edits files', :js do ...@@ -12,7 +12,6 @@ describe 'Projects > Files > User edits files', :js do
before do before do
stub_feature_flags(web_ide_default: false) stub_feature_flags(web_ide_default: false)
stub_feature_flags(vue_file_list: false)
sign_in(user) sign_in(user)
end end
......
...@@ -16,8 +16,6 @@ describe 'Projects > Files > User replaces files', :js do ...@@ -16,8 +16,6 @@ describe 'Projects > Files > User replaces files', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(vue_file_list: false)
sign_in(user) sign_in(user)
end end
......
...@@ -16,8 +16,6 @@ describe 'Projects > Files > User uploads files' do ...@@ -16,8 +16,6 @@ describe 'Projects > Files > User uploads files' do
let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) } let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) }
before do before do
stub_feature_flags(vue_file_list: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
end end
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
require 'spec_helper' require 'spec_helper'
describe 'Projects > Show > Collaboration links' do describe 'Projects > Show > Collaboration links', :js do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_feature_flags(vue_file_list: false)
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
end end
...@@ -17,15 +16,21 @@ describe 'Projects > Show > Collaboration links' do ...@@ -17,15 +16,21 @@ describe 'Projects > Show > Collaboration links' do
# The navigation bar # The navigation bar
page.within('.header-new') do page.within('.header-new') do
find('.qa-new-menu-toggle').click
aggregate_failures 'dropdown links in the navigation bar' do aggregate_failures 'dropdown links in the navigation bar' do
expect(page).to have_link('New issue') expect(page).to have_link('New issue')
expect(page).to have_link('New merge request') expect(page).to have_link('New merge request')
expect(page).to have_link('New snippet', href: new_project_snippet_path(project)) expect(page).to have_link('New snippet', href: new_project_snippet_path(project))
end end
find('.qa-new-menu-toggle').click
end end
# The dropdown above the tree # The dropdown above the tree
page.within('.repo-breadcrumb') do page.within('.repo-breadcrumb') do
find('.qa-add-to-tree').click
aggregate_failures 'dropdown links above the repo tree' do aggregate_failures 'dropdown links above the repo tree' do
expect(page).to have_link('New file') expect(page).to have_link('New file')
expect(page).to have_link('Upload file') expect(page).to have_link('Upload file')
...@@ -45,23 +50,19 @@ describe 'Projects > Show > Collaboration links' do ...@@ -45,23 +50,19 @@ describe 'Projects > Show > Collaboration links' do
visit project_path(project) visit project_path(project)
page.within('.header-new') do page.within('.header-new') do
find('.qa-new-menu-toggle').click
aggregate_failures 'dropdown links' do aggregate_failures 'dropdown links' do
expect(page).not_to have_link('New issue') expect(page).not_to have_link('New issue')
expect(page).not_to have_link('New merge request') expect(page).not_to have_link('New merge request')
expect(page).not_to have_link('New snippet', href: new_project_snippet_path(project)) expect(page).not_to have_link('New snippet', href: new_project_snippet_path(project))
end end
end
page.within('.repo-breadcrumb') do find('.qa-new-menu-toggle').click
aggregate_failures 'dropdown links' do
expect(page).not_to have_link('New file')
expect(page).not_to have_link('Upload file')
expect(page).not_to have_link('New directory')
expect(page).not_to have_link('New branch')
expect(page).not_to have_link('New tag')
end
end end
expect(page).not_to have_selector('.qa-add-to-tree')
expect(page).not_to have_link('Web IDE') expect(page).not_to have_link('Web IDE')
end end
end end
...@@ -5,10 +5,6 @@ require 'spec_helper' ...@@ -5,10 +5,6 @@ require 'spec_helper'
describe 'Projects > Show > User sees last commit CI status' do describe 'Projects > Show > User sees last commit CI status' do
set(:project) { create(:project, :repository, :public) } set(:project) { create(:project, :repository, :public) }
before do
stub_feature_flags(vue_file_list: false)
end
it 'shows the project README', :js do it 'shows the project README', :js do
project.enable_ci project.enable_ci
pipeline = create(:ci_pipeline, project: project, sha: project.commit.sha, ref: 'master') pipeline = create(:ci_pipeline, project: project, sha: project.commit.sha, ref: 'master')
...@@ -16,9 +12,9 @@ describe 'Projects > Show > User sees last commit CI status' do ...@@ -16,9 +12,9 @@ describe 'Projects > Show > User sees last commit CI status' do
visit project_path(project) visit project_path(project)
page.within '.blob-commit-info' do page.within '.commit-detail' do
expect(page).to have_content(project.commit.sha[0..6]) expect(page).to have_content(project.commit.sha[0..6])
expect(page).to have_link('Pipeline: skipped') expect(page).to have_selector('[aria-label="Commit: skipped"]')
end end
end end
end end
...@@ -10,7 +10,6 @@ describe 'Projects tree', :js do ...@@ -10,7 +10,6 @@ describe 'Projects tree', :js do
let(:test_sha) { '7975be0116940bf2ad4321f79d02a55c5f7779aa' } let(:test_sha) { '7975be0116940bf2ad4321f79d02a55c5f7779aa' }
before do before do
stub_feature_flags(vue_file_list: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
end end
......
...@@ -6,10 +6,6 @@ describe 'Project' do ...@@ -6,10 +6,6 @@ describe 'Project' do
include ProjectForksHelper include ProjectForksHelper
include MobileHelpers include MobileHelpers
before do
stub_feature_flags(vue_file_list: false)
end
describe 'creating from template' do describe 'creating from template' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:template) { Gitlab::ProjectTemplate.find(:rails) } let(:template) { Gitlab::ProjectTemplate.find(:rails) }
...@@ -272,7 +268,7 @@ describe 'Project' do ...@@ -272,7 +268,7 @@ describe 'Project' do
end end
end end
describe 'tree view (default view is set to Files)' do describe 'tree view (default view is set to Files)', :js do
let(:user) { create(:user, project_view: 'files') } let(:user) { create(:user, project_view: 'files') }
let(:project) { create(:forked_project_with_submodules) } let(:project) { create(:forked_project_with_submodules) }
...@@ -285,19 +281,19 @@ describe 'Project' do ...@@ -285,19 +281,19 @@ describe 'Project' do
it 'has working links to files' do it 'has working links to files' do
click_link('PROCESS.md') click_link('PROCESS.md')
expect(page.status_code).to eq(200) expect(page).to have_selector('.file-holder')
end end
it 'has working links to directories' do it 'has working links to directories' do
click_link('encoding') click_link('encoding')
expect(page.status_code).to eq(200) expect(page).to have_selector('.breadcrumb-item', text: 'encoding')
end end
it 'has working links to submodules' do it 'has working links to submodules' do
click_link('645f6c4c') click_link('645f6c4c')
expect(page.status_code).to eq(200) expect(page).to have_selector('.qa-branches-select', text: '645f6c4c82fd3f5e06f67134450a570b795e55a6')
end end
context 'for signed commit on default branch', :js do context 'for signed commit on default branch', :js do
......
...@@ -173,13 +173,5 @@ describe 'GPG signed commits' do ...@@ -173,13 +173,5 @@ describe 'GPG signed commits' do
context 'with vue tree view enabled' do context 'with vue tree view enabled' do
it_behaves_like 'a commit with a signature' it_behaves_like 'a commit with a signature'
end end
context 'with vue tree view disabled' do
before do
stub_feature_flags(vue_file_list: false)
end
it_behaves_like 'a commit with a signature'
end
end end
end end
...@@ -9,6 +9,7 @@ let $apollo; ...@@ -9,6 +9,7 @@ let $apollo;
const MOCK_BLOBS = [ const MOCK_BLOBS = [
{ {
id: '123abc', id: '123abc',
sha: '123abc',
flatPath: 'blob', flatPath: 'blob',
name: 'blob.md', name: 'blob.md',
type: 'blob', type: 'blob',
...@@ -16,6 +17,7 @@ const MOCK_BLOBS = [ ...@@ -16,6 +17,7 @@ const MOCK_BLOBS = [
}, },
{ {
id: '124abc', id: '124abc',
sha: '124abc',
flatPath: 'blob2', flatPath: 'blob2',
name: 'blob2.md', name: 'blob2.md',
type: 'blob', type: 'blob',
......
...@@ -41,6 +41,7 @@ describe('Repository table row component', () => { ...@@ -41,6 +41,7 @@ describe('Repository table row component', () => {
it('renders table row', () => { it('renders table row', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'file', type: 'file',
currentPath: '/', currentPath: '/',
...@@ -57,6 +58,7 @@ describe('Repository table row component', () => { ...@@ -57,6 +58,7 @@ describe('Repository table row component', () => {
`('renders a $componentName for type $type', ({ type, component }) => { `('renders a $componentName for type $type', ({ type, component }) => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type, type,
currentPath: '/', currentPath: '/',
...@@ -73,6 +75,7 @@ describe('Repository table row component', () => { ...@@ -73,6 +75,7 @@ describe('Repository table row component', () => {
`('pushes new router if type $type is tree', ({ type, pushes }) => { `('pushes new router if type $type is tree', ({ type, pushes }) => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type, type,
currentPath: '/', currentPath: '/',
...@@ -95,6 +98,7 @@ describe('Repository table row component', () => { ...@@ -95,6 +98,7 @@ describe('Repository table row component', () => {
`('calls visitUrl if $type is not tree', ({ type, pushes }) => { `('calls visitUrl if $type is not tree', ({ type, pushes }) => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type, type,
currentPath: '/', currentPath: '/',
...@@ -112,6 +116,7 @@ describe('Repository table row component', () => { ...@@ -112,6 +116,7 @@ describe('Repository table row component', () => {
it('renders commit ID for submodule', () => { it('renders commit ID for submodule', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'commit', type: 'commit',
currentPath: '/', currentPath: '/',
...@@ -123,6 +128,7 @@ describe('Repository table row component', () => { ...@@ -123,6 +128,7 @@ describe('Repository table row component', () => {
it('renders link with href', () => { it('renders link with href', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'blob', type: 'blob',
url: 'https://test.com', url: 'https://test.com',
...@@ -135,6 +141,7 @@ describe('Repository table row component', () => { ...@@ -135,6 +141,7 @@ describe('Repository table row component', () => {
it('renders LFS badge', () => { it('renders LFS badge', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'commit', type: 'commit',
currentPath: '/', currentPath: '/',
...@@ -147,6 +154,7 @@ describe('Repository table row component', () => { ...@@ -147,6 +154,7 @@ describe('Repository table row component', () => {
it('renders commit and web links with href for submodule', () => { it('renders commit and web links with href for submodule', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'commit', type: 'commit',
url: 'https://test.com', url: 'https://test.com',
...@@ -161,6 +169,7 @@ describe('Repository table row component', () => { ...@@ -161,6 +169,7 @@ describe('Repository table row component', () => {
it('renders lock icon', () => { it('renders lock icon', () => {
factory({ factory({
id: '1', id: '1',
sha: '123',
path: 'test', path: 'test',
type: 'tree', type: 'tree',
currentPath: '/', currentPath: '/',
......
...@@ -41,7 +41,7 @@ describe('fetchLogsTree', () => { ...@@ -41,7 +41,7 @@ describe('fetchLogsTree', () => {
jest.spyOn(axios, 'get'); jest.spyOn(axios, 'get');
global.gon = { gitlab_url: 'https://test.com' }; global.gon = { relative_url_root: '' };
client = { client = {
readQuery: () => ({ readQuery: () => ({
...@@ -64,10 +64,9 @@ describe('fetchLogsTree', () => { ...@@ -64,10 +64,9 @@ describe('fetchLogsTree', () => {
it('calls axios get', () => it('calls axios get', () =>
fetchLogsTree(client, '', '0', resolver).then(() => { fetchLogsTree(client, '', '0', resolver).then(() => {
expect(axios.get).toHaveBeenCalledWith( expect(axios.get).toHaveBeenCalledWith('/gitlab-org/gitlab-foss/refs/master/logs_tree/', {
'https://test.com/gitlab-org/gitlab-foss/refs/master/logs_tree/', params: { format: 'json', offset: '0' },
{ params: { format: 'json', offset: '0' } }, });
);
})); }));
it('calls axios get once', () => it('calls axios get once', () =>
......
...@@ -10,7 +10,7 @@ describe GitlabSchema.types['Commit'] do ...@@ -10,7 +10,7 @@ describe GitlabSchema.types['Commit'] do
it 'contains attributes related to commit' do it 'contains attributes related to commit' do
expect(described_class).to have_graphql_fields( expect(described_class).to have_graphql_fields(
:id, :sha, :title, :description, :message, :authored_date, :id, :sha, :title, :description, :message, :authored_date,
:author, :web_url, :latest_pipeline, :pipelines, :signature_html :author_name, :author, :web_url, :latest_pipeline, :pipelines, :signature_html
) )
end end
end end
...@@ -5,5 +5,5 @@ require 'spec_helper' ...@@ -5,5 +5,5 @@ require 'spec_helper'
describe Types::Tree::BlobType do describe Types::Tree::BlobType do
it { expect(described_class.graphql_name).to eq('Blob') } it { expect(described_class.graphql_name).to eq('Blob') }
it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path, :web_url, :lfs_oid) } it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) }
end end
...@@ -5,5 +5,5 @@ require 'spec_helper' ...@@ -5,5 +5,5 @@ require 'spec_helper'
describe Types::Tree::SubmoduleType do describe Types::Tree::SubmoduleType do
it { expect(described_class.graphql_name).to eq('Submodule') } it { expect(described_class.graphql_name).to eq('Submodule') }
it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path, :web_url, :tree_url) } it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :tree_url) }
end end
...@@ -5,5 +5,5 @@ require 'spec_helper' ...@@ -5,5 +5,5 @@ require 'spec_helper'
describe Types::Tree::TreeEntryType do describe Types::Tree::TreeEntryType do
it { expect(described_class.graphql_name).to eq('TreeEntry') } it { expect(described_class.graphql_name).to eq('TreeEntry') }
it { expect(described_class).to have_graphql_fields(:id, :name, :type, :path, :flat_path, :web_url) } it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url) }
end end
...@@ -18,6 +18,14 @@ describe 'projects/show' do ...@@ -18,6 +18,14 @@ describe 'projects/show' do
end end
context 'commit signatures' do context 'commit signatures' do
context 'with vue tree view enabled' do
it 'are not rendered via js-signature-container' do
render
expect(rendered).not_to have_css('.js-signature-container')
end
end
context 'with vue tree view disabled' do context 'with vue tree view disabled' do
before do before do
stub_feature_flags(vue_file_list: false) stub_feature_flags(vue_file_list: false)
...@@ -29,13 +37,5 @@ describe 'projects/show' do ...@@ -29,13 +37,5 @@ describe 'projects/show' do
expect(rendered).to have_css('.js-signature-container') expect(rendered).to have_css('.js-signature-container')
end end
end end
context 'with vue tree view enabled' do
it 'are not rendered via js-signature-container' do
render
expect(rendered).not_to have_css('.js-signature-container')
end
end
end end
end end
...@@ -13,8 +13,6 @@ describe 'projects/tree/show' do ...@@ -13,8 +13,6 @@ describe 'projects/tree/show' do
let(:tree) { repository.tree(commit.id, path) } let(:tree) { repository.tree(commit.id, path) }
before do before do
stub_feature_flags(vue_file_list: false)
assign(:project, project) assign(:project, project)
assign(:repository, repository) assign(:repository, repository)
assign(:lfs_blob_ids, []) assign(:lfs_blob_ids, [])
...@@ -39,12 +37,15 @@ describe 'projects/tree/show' do ...@@ -39,12 +37,15 @@ describe 'projects/tree/show' do
render render
expect(rendered).to have_css('.js-project-refs-dropdown .dropdown-toggle-text', text: ref) expect(rendered).to have_css('.js-project-refs-dropdown .dropdown-toggle-text', text: ref)
expect(rendered).to have_css('.readme-holder')
end end
end end
context 'commit signatures' do context 'commit signatures' do
context 'with vue tree view disabled' do context 'with vue tree view disabled' do
before do
stub_feature_flags(vue_file_list: false)
end
it 'rendered via js-signature-container' do it 'rendered via js-signature-container' do
render render
...@@ -53,10 +54,6 @@ describe 'projects/tree/show' do ...@@ -53,10 +54,6 @@ describe 'projects/tree/show' do
end end
context 'with vue tree view enabled' do context 'with vue tree view enabled' do
before do
stub_feature_flags(vue_file_list: true)
end
it 'are not rendered via js-signature-container' do it 'are not rendered via js-signature-container' do
render render
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment