Project

General

Profile

Actions

action #56756

closed

[functional][y] Improve ruby gem library to operate controls in the UI

Added by JERiveraMoya over 4 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Enhancement to existing tests
Target version:
-
Start date:
2019-08-27
Due date:
2019-09-24
% Done:

0%

Estimated time:
Difficulty:

Description

Description

I as a YaST developer want to write integration tests for the module

Based on the code implemented by Ladi: https://github.com/lslezak/cucumber-yast, after #56009 we already have a gem able to operate a few controls in the UI:
https://github.com/jknphy/libyui_client

Ladi provides with 3 suggestions. See (1)(2)(3) below.
We should also (4) format the code and (5) extend the library trying with other users controls.

1) the "it" describes a single test, each test should be independent (i.e. do not
depend on the result of any previous test). RSpec even supports randomizing the order
of the tests using the "rspec --order random" option, this can help to find the
dependencies between the tests.

Moreover rspec can optionally run only a specified test, not the whole file. Example:
"rspec spec/libyui_client_spec.rb:38", that will start the test at line 38, ignoring
the other tests.

So there should be one big: it "writes the entered IP address to the /etc/hosts" do ...

test which does all the steps inside.

We need to print the progress messages by yourselves,
We might use "rainbow" gem or similar to print the colored output (or maybe rspec provides some API)

2) The test is destructive, it really modifies the /etc/hosts on the machine.
That's OK when running it in a testing environment (like openQA) but it's not
acceptable if you want to run the same test on your machine during development.

Ideally there should be a way to run the read-only and the read/write tests
separately. E.g. the read-only tests would simply press "Abort" button in the
end to avoid writing the changes to the system.

Or we could pass the read/write mode via the environment and depending on that the
"write" part would be skipped or not, that would avoid duplicating the tests.

We definitely need a way to safely run the tests (at least some safe subset) during the development.

3) Use the "aruba" gem for testing the file content, file existence,
file permissions, command STDOUT or STDERR, etc...

We do not need to reinvent the wheel in
https://github.com/jknphy/libyui_client/blob/master/spec/libyui_client_spec.rb#L39

So far Lady has used aruba only from cucumber tests, but it seems it provides some
helpers also for rspec.

See https://relishapp.com/cucumber/aruba/v/0-11-0/docs/file/check-if-file-has-content

Or maybe there is some other rspec extension for that, but as this is a really common problem,
some library (gem) must already exist...

4) Format the code with rubocop.
5) Extend the libray interacting with other controls.

Acceptance criteria

  1. There is ruby gem which provides easy to use methods to operate on buttons
Actions #1

Updated by JERiveraMoya over 4 years ago

  • Copied from action #56009: [functional][y] Develop ruby gem library to operate controls in the UI added
Actions #2

Updated by JERiveraMoya over 4 years ago

  • Copied from deleted (action #56009: [functional][y] Develop ruby gem library to operate controls in the UI)
Actions #3

Updated by JERiveraMoya over 4 years ago

Code formatted with rubocop.

Actions #4

Updated by JERiveraMoya over 4 years ago

  • Description updated (diff)
Actions #5

Updated by JERiveraMoya over 4 years ago

  • Description updated (diff)
Actions #6

Updated by JERiveraMoya over 4 years ago

  • Status changed from New to Rejected

Duplicated by: #56786

Actions

Also available in: Atom PDF