Commit 49363d90 authored by Mark Lapierre's avatar Mark Lapierre Committed by Dan Davison

Log out after test

All QA tests expect to be able to log in at the start of the test.
That's not possible if a test leaves the browser logged in when it
finishes. Normally this isn't a problem because Capybara resets the
session after each test. But it does that in an `after` block, so when
a test, like this one, logs in in an `after(:all) block, the browser
returns to a logged in state *after* Capybara has logged it out. And
then the next test will fail.

E.g.: https://gitlab.com/gitlab-org/gitlab/issues/34736

The fix is to log out once we're done in the `after(:all)` block.
parent e925ee07
......@@ -9,25 +9,25 @@ module QA
{
type: 'Dockerfile',
template: 'custom_dockerfile',
name: 'Dockerfile/custom_dockerfile.dockerfile',
file_path: 'Dockerfile/custom_dockerfile.dockerfile',
content: 'dockerfile template test'
},
{
type: '.gitignore',
template: 'custom_gitignore',
name: 'gitignore/custom_gitignore.gitignore',
file_path: 'gitignore/custom_gitignore.gitignore',
content: 'gitignore template test'
},
{
type: '.gitlab-ci.yml',
template: 'custom_gitlab-ci',
name: 'gitlab-ci/custom_gitlab-ci.yml',
file_path: 'gitlab-ci/custom_gitlab-ci.yml',
content: 'gitlab-ci template test'
},
{
type: 'LICENSE',
template: 'custom_license',
name: 'LICENSE/custom_license.txt',
file_path: 'LICENSE/custom_license.txt',
content: 'license template test'
}
]
......@@ -46,13 +46,10 @@ module QA
project.initialize_with_readme = true
end
templates.each do |template|
Resource::File.fabricate_via_api! do |file|
file.project = @file_template_project
file.name = template[:name]
file.content = template[:content]
file.commit_message = 'Add test file templates'
end
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = @file_template_project
commit.commit_message = 'Add CODEOWNERS and test files'
commit.add_files(templates)
end
@project = Resource::Project.fabricate_via_api! do |project|
......@@ -66,9 +63,11 @@ module QA
end
after(:all) do
login unless Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) }
login unless Page::Main::Menu.perform(&:signed_in?)
remove_group_file_template_if_set
Page::Main::Menu.perform(&:sign_out)
end
templates.each do |template|
......
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