forked from mozilla/testpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added install and enable test (mozilla#2842)
- Loading branch information
Showing
15 changed files
with
178 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
#!/bin/bash | ||
set -ex | ||
if [[ $CIRCLE_BRANCH == 'master' ]]; then | ||
NODE_ENV=production ENABLE_PONTOON=1 ENABLE_DEV_CONTENT=1 ENABLE_DEV_LOCALES=1 npm run static | ||
else | ||
NODE_ENV=production ENABLE_PONTOON=0 ENABLE_DEV_CONTENT=0 ENABLE_DEV_LOCALES=0 npm run static | ||
fi | ||
NODE_ENV=production ENABLE_PONTOON=1 ENABLE_DEV_CONTENT=1 ENABLE_DEV_LOCALES=1 npm run static | ||
zip -r $CIRCLE_ARTIFACTS/frontend.zip frontend/build |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from pypom import Region | ||
from selenium.webdriver.common.by import By | ||
|
||
from pages.desktop.base import Base | ||
|
||
|
||
class Experiments(Base): | ||
"""Represents the experiments page""" | ||
|
||
_experiment_locator = (By.CLASS_NAME, 'experiment-summary') | ||
|
||
@property | ||
def welcome_popup(self): | ||
return self.WelcomePopup(self) | ||
|
||
@property | ||
def list(self): | ||
"""Return list of experiments on experiments page.""" | ||
experiments = self.find_elements(*self._experiment_locator) | ||
return [self.ExperimentsPreview(self, el) for el in experiments] | ||
|
||
def find_experiment(self, experiment=None): | ||
"""Locate experiment given. | ||
Args: | ||
str: Experiment name. | ||
Returns: | ||
obj: Experiment Detail object. | ||
""" | ||
for item in self.list: | ||
if experiment in item.name: | ||
item.click() | ||
from pages.desktop.detail import Detail | ||
return Detail(self.selenium, self.base_url) | ||
else: | ||
continue | ||
raise AttributeError('Experiment: {0}, not found.'.format(experiment)) | ||
|
||
class WelcomePopup(Region): | ||
_root_locator = (By.ID, 'first-page') | ||
_close_button_locator = (By.CSS_SELECTOR, '.modal-cancel') | ||
_popup_locator_title = (By.CSS_SELECTOR, '.modal-header-wrapper h3') | ||
|
||
def wait_for_region_to_load(self): | ||
self.wait.until(lambda _: 'Welcome to Test Pilot!' in self.title) | ||
|
||
def close(self): | ||
"""Close welcome popup using the close button.""" | ||
self.find_element(*self._close_button_locator).click() | ||
|
||
@property | ||
def title(self): | ||
"""Return title text of popup.""" | ||
return self.find_element(*self._popup_locator_title).text | ||
|
||
class ExperimentsPreview(Region): | ||
"""Represents the experiments region.""" | ||
_name_locator = (By.CSS_SELECTOR, '.experiment-information > \ | ||
header > div > h3') | ||
|
||
@property | ||
def name(self): | ||
"""Returns the experiments name.""" | ||
return self.find_element(*self._name_locator).text | ||
|
||
def click(self): | ||
"""Clicks on the experiment.""" | ||
self.root.click() | ||
from pages.desktop.detail import Detail | ||
return Detail(self.selenium, self.page.base_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from pages.desktop.home import Home | ||
from pages.desktop.detail import Detail | ||
|
||
|
||
@pytest.mark.nondestructive | ||
@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None, | ||
reason='Skip install on Release and Beta Firefox.') | ||
def test_install_of_test_pilot_addon( | ||
base_url, selenium, firefox, notifications): | ||
"""Check that the testpilot addon is installable and installs.""" | ||
page = Home(selenium, base_url).open() | ||
experiments = page.header.click_install_button() | ||
firefox.browser.wait_for_notification(notifications.AddOnInstallComplete) | ||
assert 'Welcome to Test Pilot!' in experiments.welcome_popup.title | ||
|
||
|
||
@pytest.mark.nondestructive | ||
@pytest.mark.skipif(os.environ.get('SKIP_INSTALL_TEST') is not None, | ||
reason='Skip install on Release and Beta Firefox.') | ||
def test_enable_experiment(base_url, selenium, firefox, notifications): | ||
"""Test enabling of an experiment.""" | ||
page = Home(selenium, base_url).open() | ||
experiments = page.header.click_install_button() | ||
experiments.welcome_popup.close() | ||
experiment = experiments.find_experiment(experiment='Dev Example') | ||
experiment.enable() | ||
firefox.browser.wait_for_notification( | ||
notifications.AddOnInstallComplete).close() | ||
firefox.browser.wait_for_notification( | ||
notifications.AddOnInstallConfirmation).install() | ||
firefox.browser.wait_for_notification( | ||
notifications.AddOnInstallComplete).close() | ||
assert Detail(selenium, base_url).enabled_popup.is_popup_displayed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters