Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] : In Mobile Screen Navbar icon not working & not responsible #4331

Open
harshal050 opened this issue Dec 17, 2024 · 1 comment
Open

Comments

@harshal050
Copy link

Description of the bug/issue

When I open the site on a mobile screen, I notice that the navbar is not working properly. I expected it to be responsive, but it fails to adapt to the mobile screen as it should.

issue : fixed

Screenshot 2024-12-17 153109

Steps to reproduce

Go to https://nightwatchjs.org/api/.
Click on the 'Navbar icon'.
Notice that the navbar is not working and is not responsive.

Sample test

module.exports = {
  'Navbar Responsiveness Test': function (browser) {
    const url = 'https://nightwatchjs.org/api/';

    browser
      .url(url) // Open the URL
      .resizeWindow(375, 667) // Set screen size to simulate a mobile device
      .waitForElementVisible('body', 5000) // Ensure the page loads
      .click('.navbar-icon') // Replace '.navbar-icon' with the actual selector for the navbar icon
      .pause(1000) // Wait for navbar to respond
      .assert.visible('.navbar-menu', 'Navbar menu is visible') // Verify the menu appears
      .end();
  }
};

Command to run

npx nightwatch tests/navbarResponsivenessTest.js

Verbose Output

[Sample Test] Test Suite
────────────────────────────────────────────────────────
⠋ Starting ChromeDriver on port 9515...
  Request POST /session
  {
    desiredCapabilities: {
      browserName: 'chrome',
      'goog:chromeOptions': { w3c: true, args: [] },
      name: 'Sample Test'
    },
    capabilities: {
      alwaysMatch: {
        browserName: 'chrome',
        'goog:chromeOptions': { w3c: true, args: [] }
      }
    }
  }

Nightwatch Configuration

module.exports = {
  src_folders: ['tests'], // Path to your test scripts folder
  page_objects_path: ['page-objects'], // Path for page object files
  custom_commands_path: ['custom-commands'], // Custom command files
  custom_assertions_path: ['custom-assertions'], // Custom assertion files
  plugins: [],
  globals_path: 'globals.js', // Global configuration file
  
  webdriver: {
    start_process: true, // Starts the WebDriver process
    server_path: require('chromedriver').path, // ChromeDriver path
    port: 9515, // Default ChromeDriver port
    cli_args: ['--verbose'] // Verbose WebDriver logs
  },

  test_settings: {
    default: {
      launch_url: 'https://nightwatchjs.org/api/',
      globals: {
        waitForConditionTimeout: 5000 // Default timeout for waitForElement
      },
      desiredCapabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          w3c: true, // W3C WebDriver compatibility
          args: ['--headless', '--disable-gpu', '--window-size=375,667'] // Headless mode & mobile dimensions
        }
      }
    }
  }
};

Nightwatch.js Version

3.9.0

Node Version

v20.11.1

Browser

Chrome 104.0.0

Operating System

Windows 11

Additional Information

It should also be responsive on mobile screens.

@Tanishq67m
Copy link

Can I work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants