Project

General

Profile

« Previous | Next » 

Revision ad69f9c8

Added by koszko over 1 year ago

add support for testing with other browsers (especially Abrowser and Librewolf)

There are still some spurious failures when running under those newer browsers. Those will be systematically investigated and fixed.

View differences:

test/unit/test_item_list.py
217 217
        assert f'item{i}' in text
218 218
        assert f'Item {i}' in text
219 219

  
220
    # Check that file preview link works.
221
    window0 = driver.window_handles[0]
222
    driver.find_element_by_link_text('report.spdx').click()
223
    WebDriverWait(driver, 10).until(lambda _: len(driver.window_handles) == 2)
224
    window1 = next(filter(lambda w: w != window0, driver.window_handles))
225
    driver.switch_to.window(window1)
226
    assert 'dummy report' in driver.page_source
227

  
228
    driver.close()
229
    driver.switch_to.window(window0)
230

  
231 220
    # Check that item removal confirmation dialog is displayed correctly.
232 221
    execute_in_page('list_ctx.remove_but.click();')
233 222
    WebDriverWait(driver, 10).until(lambda _: dialog_container.is_displayed())
......
271 260

  
272 261
    execute_in_page('list_ctx.ul.children[1].click();')
273 262

  
274
    # Check that missing file causes the right error dialog to appear.
275
    execute_in_page(
276
        '''{
277
        async function steal_file(hash_key)
278
        {
279
            const db = await haketilodb.get();
280
            const transaction = db.transaction("files", "readwrite");
281
            transaction.objectStore("files").delete(hash_key);
282
        }
283
        returnval(steal_file(arguments[0]));
284
        }''',
285
        sample_files['LICENSES/CC0-1.0.txt']['hash_key'])
286
    driver.find_element_by_link_text('LICENSES/CC0-1.0.txt').click()
287
    WebDriverWait(driver, 10).until(lambda _: dialog_container.is_displayed())
288
    assert 'list_disabled' in ul.get_attribute('class')
289
    assert not preview_container.is_displayed()
290

  
291
    msg = execute_in_page('returnval(list_ctx.dialog_ctx.msg.textContent);')
292
    assert msg == "File missing from Haketilo's internal database :("
293

  
294
    execute_in_page('returnval(list_ctx.dialog_ctx.ok_but.click());')
295
    WebDriverWait(driver, 10).until(lambda _: preview_container.is_displayed())
296

  
297 263
    # Check that item removal failure causes the right error dialog to appear.
298 264
    execute_in_page('haketilodb.finalize_transaction = () => {throw "sth";};')
299 265
    remove_current_item()

Also available in: Unified diff