Skip to content

[E2E] Fix for code suggestion failures

Nivetha Prabakaran requested to merge np-fix-code-suggestions into master

What does this MR do and why?

This change fixes the failure in #427737 (closed), which was caused by within_vscode_editor moved back to vscode.rb

Screenshots or screen recordings

[15:20:41] gitlab/qa [master]$ bundle exec rspec ./qa/specs/features/ee/browser_ui/3_create/web_ide/code_suggestions_in_web_ide_spec.rb
warning: parser/current is loading parser/ruby30, which recognizes 3.0.6-compliant syntax, but you are running 3.0.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
2023-10-11 15:21:18 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
  https://selenium.dev/documentation/webdriver/troubleshooting/logging

2023-10-11 15:21:18 WARN Selenium [:selenium_manager] The chromedriver version (116.0.5845.96) detected in PATH at /opt/homebrew/bin/chromedriver might not be compatible with the detected chrome version (117.0.5938.149); currently, chromedriver 117.0.5938.149 is recommended for chrome 117.*, so it is advised to delete the driver in PATH and retry 
2023-10-11 15:21:19 / CONF      :: 
      ==> Base URL: https://staging.gitlab.com
      ==> Browser: #<Selenium::WebDriver::Chrome::Driver:0x0000000104eee300>
      ==> Libraries: Chemlab::Vendor

Randomized with seed 64505

Create
  Code Suggestions in Web IDE
[Oct 11 2023 15:21:19 IST (QA Tests)] INFO  -- Starting test: Create Code Suggestions in Web IDE adds text into a file and verifies code suggestions appear
[Oct 11 2023 15:21:21 IST (QA Tests)] INFO  -- filling :login_field with "gitlab-qa"
[Oct 11 2023 15:21:21 IST (QA Tests)] INFO  -- clicking the coordinates of :login_field
[Oct 11 2023 15:21:21 IST (QA Tests)] INFO  -- filling :password_field with "*****"
[Oct 11 2023 15:21:21 IST (QA Tests)] INFO  -- clicking the coordinates of :password_field
[Oct 11 2023 15:21:21 IST (QA Tests)] INFO  -- clicking :sign_in_button
[Oct 11 2023 15:21:25 IST (QA Tests)] WARN  -- Potentially Slow Code 'click_element sign_in_button' took 3.108s
[Oct 11 2023 15:21:28 IST (QA Tests)] INFO  -- ==> Retrieved a QA::Resource::Sandbox with full_path 'gitlab-qa-sandbox-group-4' via api in 0.52 seconds
[Oct 11 2023 15:21:32 IST (QA Tests)] INFO  -- ==> Built a QA::Resource::Group with full_path 'gitlab-qa-sandbox-group-4/qa-test-2023-10-11-15-21-27-48c8bdf4e097c0f7' via api in 4.09 seconds
[Oct 11 2023 15:21:38 IST (QA Tests)] INFO  -- ==> Built a QA::Resource::Repository::Commit via api in 2.62 seconds
[Oct 11 2023 15:21:38 IST (QA Tests)] INFO  -- Visiting QA::Resource::Project at https://staging.gitlab.com/gitlab-qa-sandbox-group-4/qa-test-2023-10-11-15-21-27-48c8bdf4e097c0f7/webide-code-suggestions-project-bed14d2bb1b31b28
[Oct 11 2023 15:21:43 IST (QA Tests)] INFO  -- clicking :action_dropdown
[Oct 11 2023 15:21:43 IST (QA Tests)] INFO  -- clicking :webide_menu_item
[Oct 11 2023 15:21:44 IST (QA Tests)] WARN  -- Potentially Slow Code 'wait_for_requests ' took 0.965s
[Oct 11 2023 15:21:44 IST (QA Tests)] WARN  -- Potentially Slow Code 'click_element webide_menu_item' took 1.016s
[Oct 11 2023 15:21:45 IST (QA Tests)] WARN  -- Potentially Slow Code 'has_element? broadcast-notification-container' took 0.701s
[Oct 11 2023 15:21:45 IST (QA Tests)] INFO  -- clicking :close-button
[Oct 11 2023 15:21:46 IST (QA Tests)] WARN  -- Potentially Slow Code 'has_element? div[aria-label="Files Explorer"]' took 0.818s
[Oct 11 2023 15:21:46 IST (QA Tests)] INFO  -- clicking :div[aria-label='new_file.rb']
[Oct 11 2023 15:21:49 IST (QA Tests)] WARN  -- Potentially Slow Code 'click_element div[aria-label='new_file.rb']' took 3.157s
[Oct 11 2023 15:21:49 IST (QA Tests)] INFO  -- clicking :.monaco-editor
[Oct 11 2023 15:21:50 IST (QA Tests)] WARN  -- Potentially Slow Code 'click_element .monaco-editor' took 1.133s
    adds text into a file and verifies code suggestions appear

Top 1 slowest examples (34.23 seconds, 100.0% of total time):
  Create Code Suggestions in Web IDE adds text into a file and verifies code suggestions appear
    34.23 seconds ./qa/specs/features/ee/browser_ui/3_create/web_ide/code_suggestions_in_web_ide_spec.rb:38

Finished in 34.24 seconds (files took 2.72 seconds to load)
1 example, 0 failures

Randomized with seed 64505

How to set up and validate locally

You can run the tests against staging.gitlab.com using the gitlab-qa user as the tests do, or by using your own user. If you use gitlab-qa you can skip below to running the tests, otherwise enable the Code Suggestions user preference (see https://docs.gitlab.com/ee/user/project/repository/code_suggestions.html#enable-code-suggestions-for-an-individual-user)

To run the tests, from the qa directory:

export GITLAB_USERNAME=gitlab-qa # or your own username if you have Code Suggestions enabled in your preferences and via the feature flag
export GITLAB_PASSWORD=<from 1Password>
export GITLAB_QA_ACCESS_TOKEN=<from 1Password> # or your own access token
export GITLAB_QA_USER_AGENT=<from 1Password>
bundle install
bundle exec bin/qa Test::Instance::All https://staging.gitlab.com qa/specs/features/ee/browser_ui/3_create/web_ide/code_suggestions_in_web_ide_spec.rb

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nivetha Prabakaran

Merge request reports