Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 12 15:57
    TuHuynhVan commented #7006
  • Jun 12 15:28
    TuHuynhVan edited #7006
  • Jun 12 15:25
    TuHuynhVan edited #7006
  • Jun 12 15:25
    TuHuynhVan opened #7006
  • Jun 12 12:16
    christian-bromann labeled #7001
  • Jun 12 12:16
    christian-bromann labeled #7001
  • Jun 12 12:16
    christian-bromann commented #7001
  • Jun 12 12:14
    christian-bromann commented #7002
  • Jun 11 21:25
    NIBOSAP opened #7005
  • Jun 11 17:06
    srikanthgurram opened #7002
  • Jun 11 16:38
    jlipps commented #6999
  • Jun 11 16:25
    shime commented #1638
  • Jun 11 15:55
    db798 edited #7001
  • Jun 11 15:51
    db798 edited #7001
  • Jun 11 15:50
    db798 opened #7001
  • Jun 11 15:38
    coda-nsit commented #1638
  • Jun 11 15:37
    coda-nsit commented #1638
  • Jun 11 14:27
    mgrybyk commented #7000
  • Jun 11 13:17
    mgrybyk commented #6954
  • Jun 11 12:39
    christian-bromann commented #6954
vdrulerz
@vdrulerz
like this ??
if yes, then still it's not working and it's skipping to all those step definitions steps which are in this common library :(
does that mean after the compilation and publishing that common library in the node_modules .....it will not be supported from V7 onwards ??
If you think this is a missing piece with V7 (after typescript support) then I am happy to open a defect
with more details
Christian Bromann
@christian-bromann
I don’t think this is a defect in webdriverio, it is a typescript configuration
all WebdriverIO is doing is triggering the compile step with your configuration
vdrulerz
@vdrulerz

Any thing you recommend me at this point in time to solve it ?? what configuration am I missing ....because with 6.12 version where you introduced autoCompile feature where we dint require ts-node & that time it was working fine

But with V7 it is not detecting any step definition of node module common library

Christian Bromann
@christian-bromann
I am not a TS expert, all I can say is that it might be a configuration issue
vdrulerz
@vdrulerz

Sure @christian-bromann will dig into this more ....one last comment from my side

Are we certain that there is no such issue if we add .ts and .js both in the require of cucumberOpts

['./test/Features//.ts', './node_modules/common-qa-ui/dist/lib/StepDef/.js']

only this seems to be broken with V7 .....in V6 it was working fine

Steps of *.js it is skipping in V7

Christian Bromann
@christian-bromann
there were some changes on the autocompile functionality but I am not aware that this could have changed the compiling
Nick Christenson
@newtewt

Hello, I'm implementing webdriverio and trying to use procedurally written page objects. When I run a test using npx wdio run ./tests/webdriver-e2e/wdio.conf.js --spec /home/newt/dev/cht-core/tests/webdriver-e2e/tests/login.spec.js it generates Error: ReferenceError: $ is not defined. Looking through the wdio code those get added to global after mocha inits the project. I assume I'm missing a step somewhere or is it not possible to write page objects procedurally?

My page object that fails

const hamburgerMenu = $('#header-dropdown-link');
const logoutButton = $('.fa-power-off');
const modalBody = $('div.modal-body');
const yesButton = $('a.btn.submit.btn-danger');

const logout = async () => {
  await hamburgerMenu.click();
  await logoutButton.click();
  await modalBody.waitForDisplayed();
  const warning = await modalBody.getText();
  await yesButton.click();
  return warning;
};


module.exports = {
  logout
};

My test

const loginPage = require('../page-objects/login.page');
const commonPage = require('../page-objects/common.page');

describe('Login and logout tests', () => {
  beforeEach(async () => {
    await loginPage.cookieLogin('medic','Secret_1');
  });

  it('should show a warning before log out', async () => {
    const warning = await commonPage.logout();
    expect(warning).toBe('Are you sure you want to log out?'); 
  });
});

Full error

Spec file(s): /home/newt/dev/cht-core/tests/webdriver-e2e/tests/login.spec.js
[0-0] Error: ReferenceError: $ is not defined
[0-0]     at Object.<anonymous> (/home/newt/dev/cht-core/tests/webdriver-e2e/page-objects/common.page.js:21:23)
[0-0]     at Module._compile (internal/modules/cjs/loader.js:999:30)
[0-0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
[0-0]     at Module.load (internal/modules/cjs/loader.js:863:32)
[0-0]     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
[0-0]     at Module.require (internal/modules/cjs/loader.js:887:19)
[0-0]     at require (internal/modules/cjs/helpers.js:74:18)
[0-0]     at Object.<anonymous> (/home/newt/dev/cht-core/tests/webdriver-e2e/tests/login.spec.js:2:20)
[0-0]     at Module._compile (internal/modules/cjs/loader.js:999:30)
[0-0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Christian Bromann
@christian-bromann
@newtewt you can only call webdriverio commands within a test context
also it is not a good idea to define elements like that
because you would do 100 of element calls at the beginning of the test for now reason
I recommend to follow this structure: https://webdriver.io/docs/pageobjects
Nick Christenson
@newtewt
Thanks @christian-bromann, I've changed the structure a bit to fall in line with our styles.
const hamburgerMenu = () => $('#header-dropdown-link');
const logoutButton =  () => $('.fa-power-off');
const modalBody = () => $('div.modal-body');
const yesButton = () => $('a.btn.submit.btn-danger');

const logout = async () => {
  await (await hamburgerMenu()).click();
  await (await logoutButton()).click();
  await (await modalBody()).waitForDisplayed();
  const warning = await (await modalBody()).getText();
  await (await yesButton()).click();
  return warning;
};

module.exports = {
  logout
};
I don't believe this would make the unnecessary calls as you mentioned.
Christian Bromann
@christian-bromann
this works
I am not sure if this still works
Yanela-ipsy
@Yanela-ipsy
Hi Does "extendedDebugging: true" works on mobile capabilities? Because this is not working for me:
 capabilities: [
    {
      browserName: 'Chrome',
      deviceName: 'Samsung Galaxy S9 WQHD GoogleAPI Emulator',
      deviceOrientation: 'portrait',
      platformVersion: '9.0',
      platformName: 'Android',
      appiumVersion: '1.16.0',
      build: `Google Samsung Galaxy S9 - build - ${new Date().getTime()}`,
      'sauce:options': {
        extendedDebugging: true,
  }     
    },
  ],
JulieLaursen
@laursen_julie_twitter

Trying to get webdriverio to just select this button. Why is it so hard to click on a button with just xpath (most of the code only has xpath locators):
locator is "//span[text()='Login']", or even "//button[@type='button']" or '//button/span' works
but none of these work when i try to put them here:
await (await $("//button/span")).click();
Why is clicking this simple button so difficult for webdriverio? "[chrome 91.0.4472.77 mac os x #0-0] Can't call click on element with selector "//button/span" because element wasn't found"

Also, chrome opens two browser windows: one empty one with just //data in the url and one that is the correct browser. Is that the problem? Can I close this localhost on port 9515 and how?

[0-0] 2021-06-10T16:00:35.140Z INFO webdriver: COMMAND findElements("xpath", "//button/span") [0-0] 2021-06-10T16:00:35.141Z INFO webdriver: [POST] http://localhost:9515/session/dc2466470e3607a1ec5de1c6c32d6162/elements [0-0] 2021-06-10T16:00:35.141Z INFO webdriver: DATA { using: 'xpath', value: '//button/span' }

Christian Bromann
@christian-bromann
@Yanela-ipsy probably not anymore, please reach out to SL support
1 reply
Oumaima BEN AHMED
@oumaima_ben_ahmed:matrix.org
[m]
Hello,
I have a problem that : the page changes when running the scenario. Normally, the Webdriver io opens the page :
https://hub.recette.hub-score.com/#/dmp/databases/contacts But it directs me to https://hub.recette.hub-score.com/#
Could you please help me?
3 replies
Kirstin Walsh
@pyxis828

Has anyone been able to get the video reporter to work on V7? I just keep getting an error that the reporter is not synced
@wdio/runner: Error: Some reporters are still unsynced: Video at Timeout.<anonymous> (C:\Workspace\webdriverio-test\updates\node_modules\@wdio\runner\build\reporter.js:87:35) at listOnTimeout (internal/timers.js:555:17) at processTimers (internal/timers.js:498:7)
in my config I have (note that I have increased the timeouts):

```reporters: ['spec',
    [video, {
        saveAllVideos: false,
        recordAllActions: false,
        videoSlowdownMultiplier: 10, // Higher to get slower videos, lower for faster videos [value 1-100]
        videoRenderTimeout: 90
    }],
    ['allure', {
    outputDir: './reports/allure-results',
    disableWebdriverStepsReporting: true,
    disableWebdriverScreenshotsReporting: false,
    useCucumberStepReporter: true
    }]
],

//default 5000
reporterSyncTimeout: 90000,
reporterSyncInterval: 30000,

```

JulieLaursen
@laursen_julie_twitter
was hoping to get some help today on either why i can't select an xpath or why a second screen is popping up with no url when i only have one test (maybe the cause of why i can't select an xpath?)
What can i share that would be helpful?
I only have one test in my test/specs
4 replies
James
@jamesmortensen
@pyxis828 I see those errors all the time in the log, but the videos still attach to the specs in the report regardless. Are you also not seeing the videos in the report?
Here is our configuration with latest WebdriverIO v7.x.x:
reporters: [
        [video, {
            saveAllVideos: false,       // If true, also saves videos for successful test cases
            videoSlowdownMultiplier: 3, // Higher to get slower videos, lower for faster videos [Value 1-100]
        }],
        ['allure', {
            outputDir: 'allure-results',
            disableWebdriverStepsReporting: true,
            /* 
             * No screenshots recorded if false. If true and video reporter is added, 
             * saves screenshots for every frame of the video, even if saveAllVideos is false.
             */
            disableWebdriverScreenshotsReporting: true,
        }], 'spec'
    ],
2 replies
James
@jamesmortensen
@laursen_julie_twitter you would need to share the error messages you're getting when starting the cli. That will help show what is happening. Also, you could share the test. Does it have a browser.url?
2 replies
vivekpandey123
@vivekpandey123

Hi , I wanted to know how does driver instance knows that the configuration is for mobile

so if I run my code with mobile device capabilities, and i run the following :
console.log(driver.isMobile);
it prints : true

so does it refer to "device"and "deviceName" capability variable or is it something else which helps driver to identify that it is running over mobile ?

Christian Bromann
@christian-bromann
yeah I think deviceName property is an indicator
vivekpandey123
@vivekpandey123
thank you @christian-bromann :)
Amank-qasource
@Amank-qasource
Screenshot 2021-06-11 at 5.58.38 PM.png
Hi Team, I am looking for a solution to handle iOS native alerts, available json wire protocol in webdriverio is not working for me to switch to this native alerts, could anybody help me on to fix this. I am using: WebdriverIO: 7.7.2
@wdio/cli: 7.6.0
npm: 6.14.12
Node: v14.16.1
JulieLaursen
@laursen_julie_twitter

@jamesmortensen so i shared that the error was [chrome 91.0.4472.101 mac os x #0-0] Can't call click on element with selector "//button/span" because element wasn't found but also shared that it seemed to be looking on [0-0] 2021-06-11T14:02:57.934Z INFO webdriver: [POST] http://localhost:9515/session/f08329be10256f3c6f0fd9a81fcb1381/elements and two chrome windows were popping up, one with my actual website and one blank one with just //data. I think my webdriverio framework is looking at the blank one

EDIT: I removed some code so now only the one browser window is opening and getting this error: : AssertionError [ERR_ASSERTION]: An instantiated WebdriverIO client greater than v5 is required

I remember unsuccessfully trying to fix this last week with npm update/install type commands
but my webdriver is already on "webdriverio": "^6.12.1"

I totally forgot about that, this is the second time i've tried to set up an aXe project. I remember googling that v5 error all day and not getting anywhere

vivekpandey123
@vivekpandey123

Hi ,
Does anyone knows the difference between host name while making connection browserstack automate execution.
where host is:
1) 'hub.browserstack.com';

link where i see above host - https://www.browserstack.com/docs/automate/selenium/getting-started/nodejs/webdriverio#integrating-your-tests-with-browserstack

2) 'hub-cloud.browserstack.com/wd/hub'

link where i see above host - https://www.browserstack.com/docs/automate/selenium/migrate-existing-test-suites#overview

for me both of these works, but i am not sure which one is a good practice to use.

JulieLaursen
@laursen_julie_twitter

My file is this, it was working before when i was passing webdriver.io as the url and not my company's url:

`describe("My axe application", () => {
it("should login with valid credentials and check aXe", async () => {
const AxeBuilder = require("@axe-core/webdriverio").default;
const { remote } = require("webdriverio");

const browser = await remote({
  services: ["chromedriver"],
  capabilities: {
    browserName: "chrome",
  },
});
await browser.url("https://webdriver.io");
await browser.pause(5000);

//await (await $("//button/span")).click();

const builder = new AxeBuilder({ browser });
try {
  const results = await builder
    .withTags(["wcag2a", "wcag2aa", "wcag2aa"])
    .analyze()
    .then(function (results) {
      axeViolations = results.value.violations.length;
      report = results.value.violations;
      console.log(results);
    });
} catch (e) {
  console.error(e);
}
const x = await client.deleteSession();
return x;

console.log(y);

});
});
`

This was working before :( I'm super lost

AssertionError [ERR_ASSERTION]: An instantiated WebdriverIO client greater than v5 is required still has no google results

Oumaima BEN AHMED
@oumaima_ben_ahmed:matrix.org
[m]
I tried the solution but it didn't work
JulieLaursen
@laursen_julie_twitter

Gave up and forked from : https://github.com/klamping/wdio-axe-example

with code:

`// load the axe-core script
const axeSource = require("axe-core").source;
const assert = require("assert");

describe("axe test", function () {
it("should return results", function () {
browser.url("./");

// inject the script
browser.execute(axeSource);
// browser.debug();
var theOptions;
theOptions = { runOnly: { type: "rule", values: ["link-name"] } };
// run inside browser and get results
let results = browser.executeAsync(function (options, done) {
  axeSource.run(options, function (err, results) {
    if (err) done(err);
    done(results);
  });
}, theOptions);

//assert there are no violations
console.log(results.value);
console.log("Number of violations: ");
numberOfViolations = results.violations.length();
assert.equal(
  results.value.violations.length(),
  0,
  "Expected no a11y violations"
);

});
});
`

[chrome 91.0.4472.101 mac os x #0-0] Cannot read property 'length' of undefined :( I don't get it, it worked in the video for that github project

I don't know why gitter's markdowns for code are leaving out the top and bottom sorry

JulieLaursen
@laursen_julie_twitter
maybe someone could at least tell me how to figure out why i'm getting this? I've been trying to set up this project hours a day for at least a week straight
[0-0] 2021-06-11T16:35:31.598Z ERROR webdriver: Request failed with status 404 due to invalid session id: invalid session id
I feel like i'm just throwing spaghetti at a wall and going further and further in the wrong direction with no clue how to right it and that i'm just going to fail completely and never be able to deliver this POC
Kirstin Walsh
@pyxis828
image.png
I am having issues with allure reporter on V7...it attaches all of these substeps, which create literally thousands of attachments on every report. Is there some way to get rid of these? Additionally, when I run my tests in my gitlab pipeline, I see this error allure-js-commons: Unexpected endStep(). There are no any steps running happening all over the place, but it doesn't happen when I run my tests locally. Anyone know what causes this, or how I can fix it - using "@wdio/allure-reporter": "^7.0.7"
SivaPrakash
@KiThoSivaPrakash

Hi,

Previously in WDIO V6, I used a code snippet in beforeScenario hook to fetch the list of tags in a scenario and if particular tag is present It will source a mysql dump file
But the same code is not working after migrating to WDIO V7.7.0

config.beforeScenario = function (url, feature, scenario, sourceLocation) {
  console.log("Scenario name :: " +scenario.name );
  console.log("Tags in Scenario :: " + scenario.tags);
 /**
 * Logic to source sql dump based on certain tags 
 */
}

I am getting scenario.name as : : undefined

Kindly let me know what I am doing wrong here.

4 replies
JulieLaursen
@laursen_julie_twitter

still here. been trying to get this script running since 8am, it's 3pm. No luck. no idea what this error means "Request failed with status 404 due to invalid session id: invalid session id'

I am making the absolute smallest most basic framework and script possible. I have followed three tutorials from the beginning and created four different framework projects. I have googled this error and stack overflowed this error to death, nothing. I either get errors or my assertion that expect = 0 works whether 0 matches 0 or 0 matches 1000. I just keep starting over and starting over and I'm just so completely stuck and confused

Mr-Star29
@Mr-Star29
Hi All, which will be the best reporting for WDIO (cucumber-HTML-repoeter/Allure/ any other ) and any source to start config will be helpfull. thanks in advance
Mr-Star29
@Mr-Star29
hi, i was converting my Protractor framework to Wdio-cucumber framework, but my browser is not restarting between each tests in wdio, prev in protractor i was using restartBrowserBetweenTests: true, in Conf file, PLz can anyone share what needs to be used in WDIO
James
@jamesmortensen

@laursen_julie_twitter -
I'm wondering if maybe some of your dependencies are mixed and matched. Some examples rely on wdio v4 while others rely on v5 and above. You mentioned you were working with wdio-axe-example, which relies on webdriverio v4 standalone.

Regarding the AssertionError. It says an instantiated WebdriverIO client is required. Generally we see webdriverio instantiated by the test runner outside of describe/it blocks, not within them. Not sure if that's the problem but you could try instantiating outside the describe block instead and see if that helps.

This will help you with your code formatting in gitter: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

Seeing an example, with the dependencies, would be helpful. Can you share your package.json.

Hope this helps.

Tu Huynh
@TuHuynhVan
Seems we have a bug in webdriverio v7
webdriverio/webdriverio#7006
MD SADAB SAQIB
@sadabnepal
Hey Everyone, I am trying to contribute to codes in webdriverio #6979 . Need guidance to write Unit Test for config file changes
Christian Bromann
@christian-bromann
@sadabnepal maybe it will be already enough if you just update the snapshots via npx jest -u