Skip to content

E2E test for Code Suggestion in web ide

Nivetha Prabakaran requested to merge np-codesugg-webide into master

Description of the test

E2E for Testing Code suggestions in Web ide against staging and prod environments. Related #424979 (closed)

  • These tests require several feature flags, user settings, and instance configuration that will require substantial effort to fully automate. In the meantime the following were done manually so we can run the tests against staging.gitlab.com and gitlab.com with the gitlab-qa user:
  1. Enable the code_suggestions_completion_api feature flag /chatops run feature set --user=gitlab-qa code_suggestions_completion_api true /chatops run feature set --user=gitlab-qa code_suggestions_completion_api true --staging
  2. 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

Steps of the test:

  1. Open a file in the web ide and adds prompt text 'def reverse_string'
  2. After few seconds, code suggestions for the above prompt would appear, once the suggestions appears, Accepts it
  3. Verifies if there is more text added to the initial text 'def reverse_string'
Run against staging from my local machine

I cut most of the log messages so it just shows the test ran successfully

nivethaprabakaran@Nivetha qa % bundle exec rspec qa/specs/features/ee/browser_ui/3_create/web_ide/code_suggestions_in_web_ide_spec.rb
2023-09-20 15:23:20 / CONF	:: 
      ==> Base URL: https://staging.gitlab.com
      ==> Browser: #<Selenium::WebDriver::Chrome::Driver:0x0000000104a816a0>
      ==> Libraries: Chemlab::Vendor

Randomized with seed 53762

Create
  Code Suggestions in Web IDE
[Sep 20 2023 15:23:21 IST (QA Tests)] INFO  -- Starting test: Create Code Suggestions in Web IDE adds text into a file and verifies code suggestions appear
    adds text into a file and verifies code suggestions appear

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

Finished in 36.9 seconds (files took 3.81 seconds to load)
1 example, 0 failures

Randomized with seed 53762

Screen_Recording_2023-09-20_at_3.46.18_PM

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

Checklist

  • Confirm the test has a testcase: tag linking to an existing test case in the test case project.
  • Note if the test is intended to run in specific scenarios. If a scenario is new, add a link to the MR that adds the new scenario.
  • Follow the end-to-end tests style guide and best practices.
  • Use the appropriate RSpec metadata tag(s).
  • Most resources will be cleaned up via the general cleanup task. Check that is successful, or ensure resources are cleaned up in the test:
    • New resources have api_get_path and api_delete_path implemented if possible.
    • If any resource cannot be deleted in the general delete task, make sure it is ignored.
    • If any resource cannot be deleted in the general delete task, remove it in the test (e.g., in an after block).
  • Ensure that no transient bugs are hidden accidentally due to the usage of waits and reloads.
  • Verify the tags to ensure it runs on the desired test environments.
  • If this MR has a dependency on another MR, such as a GitLab QA MR, specify the order in which the MRs should be merged.
  • (If applicable) Create a follow-up issue to document the special setup necessary to run the test: ISSUE_LINK
  • If the test requires an admin's personal access token, ensure that the test passes on your local environment with and without the GITLAB_QA_ADMIN_ACCESS_TOKEN provided.
Edited by Nivetha Prabakaran

Merge request reports