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

test behaves differently on different system #12

Open
zhenyulin opened this issue Aug 10, 2017 · 2 comments
Open

test behaves differently on different system #12

zhenyulin opened this issue Aug 10, 2017 · 2 comments

Comments

@zhenyulin
Copy link

I have an sample test code like below

test('send a message and reset the form afterwards', async t => {
  await t
    .typeText(Selector('.field input[name="name"]'), 'John Williams')
    .typeText(
      Selector('.field input[name="_replyto"]'),
      '[email protected]',
    )
    .typeText(Selector('.field input[name="_subject"]'), 'E2E Test')
    .typeText(Selector('.field textarea[name="message"]'), 'E2E Test Message')
    .click(Selector('form button[type="submit"]'))
    .expect(Selector('form button[type="reset"]').textContent)
    .match(/^(Message Sent|Sent Message Failed)$/)
    .expect(Selector('form button[type="submit"]').textContent)
    .contains('Send Message');
});

while it passes all good locally as in
- Electron 1.7.5 / Mac OS X 10.12.6

It goes errors like

1) Cannot obtain information about the node because the specified
      selector does not match any node in the DOM tree.

      Browser: Electron 1.7.5 / Linux 0.0.0

         17 |    )
         18 |    .typeText(Selector('.field input[name="_subject"]'), 'E2E
      Test')
         19 |    .typeText(Selector('.field textarea[name="message"]'), 'E2E
      Test Message')
         20 |    .click(Selector('form button[type="submit"]'))
         21 |    .expect(Selector('form button[type="reset"]').textContent)
       > 22 |    .match(/^(Message Sent|Sent Message Failed)$/)
         23 |    .expect(Selector('form button[type="submit"]').textContent)
         24 |    .contains('Send Message');
         25 |});
         26 |

         at <anonymous>
      (/tmp/build/88394182/src/features/pages/contact.js:22:6)
         at test (/tmp/build/88394182/src/features/pages/contact.js:11:1)

on the CI environment, which is inside a docker container based on Node:8.2

@AlexanderMoskovkin
Copy link

Hi @zhenyulin,

It can be related to different browser window sizes on different systems. We've faced with such site behavior in another issue.
You can try to use the same approach - add a resizeWindow command in the start of the test (or before each test):

await t.resizeWindow(1600, 800);

@zhenyulin
Copy link
Author

@AlexanderMoskovkin thanks, changed the running script to
DEBUG=nightmare xvfb-run --server-args="-screen 0 1024x768x24" yarn staging
and it works fine;

Previously when using nightmare directly and doing xvfb-run yarn staging works directly.

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