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

Speedup integration tests #850

Merged
merged 3 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ class LoginPage {
logout() {
describe('Logout', function logout() {
it('Click the logout link', function clickLogout() {
browser.pause(1000);
$('#logout_link').waitForVisible();
$('#logout_link').click();
browser.waitAndClick('#logout_link');
});
it('Display Logged out State', function clickLogout() {
browser.waitForInvisible('.ext-el-mask-msg');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ public function testEnumTargetAddresses(array $options)
$testData
);

$this->helper->authenticateDashboard('mgr');
$helper = $options['helper'];

$response = $this->helper->post("internal_dashboard/controllers/mailer.php", null, $data);
$response = $helper->post("internal_dashboard/controllers/mailer.php", null, $data);

$this->assertEquals($expectedContentType, $response[1]['content_type']);
$this->assertEquals($expectedHttpCode, $response[1]['http_code']);
Expand All @@ -560,7 +560,9 @@ public function testEnumTargetAddresses(array $options)

$this->assertEquals($expected, $actual);

$this->helper->logoutDashboard();
if (isset($options['last'])) {
$helper->logoutDashboard();
}
}

/**
Expand All @@ -570,11 +572,18 @@ public function testEnumTargetAddresses(array $options)
public function provideEnumTargetAddresses()
{
$data = JSON::loadFile($this->getTestFiles()->getFile('controllers', 'enum_target_addresses-update_enum_user_types_and_roles', 'input'));

$helper = new XdmodTestHelper();
$helper->authenticateDashboard('mgr');

foreach($data as $key => $test) {
foreach($test[0]['data'] as $dataKey => $value) {
$data[$key][0]['data'][$dataKey] = TestParameterHelper::processParam($value);
}
$data[$key][0]['helper'] = $helper;
}
$data[count($data) -1][0]['last'] = true;

return $data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,12 @@ public function testFilterIdLookup($options)
{
$user = $options['user'];
$data = $options['data'];
$helper = $options['helper'];

$expectedValue = $options['expected']['value'];
$expectedXpath = isset($options['expected']['xpath']) ? $options['expected']['xpath'] : null;

if ($user !== 'pub') {
$this->helper->authenticate($user);
}

$results = $this->helper->post('controllers/user_interface.php', null, $data);
$results = $helper->post('controllers/user_interface.php', null, $data);

if ($expectedXpath !== null) {
$xml = simplexml_load_string($results[0]);
Expand Down Expand Up @@ -533,8 +530,8 @@ public function testFilterIdLookup($options)
}
}

if ($user !== 'pub') {
$this->helper->logout();
if (isset($options['last']) && $user !== 'pub') {
$helper->logout();
}
}

Expand Down Expand Up @@ -787,6 +784,10 @@ function ($carry, $item) {

$results = array();
foreach($users as $user) {
$helper = new \TestHarness\XdmodTestHelper();
if ($user !== 'pub') {
$helper->authenticate($user);
}
foreach($realmData as $realmDatum) {
$realm = $realmDatum['realm'];
$filterCombos = generateCombinations($realmDatum['filters']);
Expand All @@ -803,12 +804,13 @@ function ($carry, $item) {

$results[] = array(array(
'user' => $user,
'helper' => $helper,
'data' => $requestData,
'expected' => $realmDatum['expected']
));

}
}
$results[count($results) - 1]['last'] = true;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ public function testGetUserVisits(array $options)
$testData = $options['data'];
$expectedOutput = $options['output'];
$expectedContentType = $options['content_type'];

$this->helper->authenticateDashboard('mgr');
$helper = $options['helper'];

$data = array_merge(
array(
Expand All @@ -476,7 +475,7 @@ public function testGetUserVisits(array $options)
$testData
);

$response = $this->helper->post("internal_dashboard/controllers/controller.php", null, $data);
$response = $helper->post("internal_dashboard/controllers/controller.php", null, $data);

$this->validateResponse($response, 200, $expectedContentType);

Expand Down Expand Up @@ -531,7 +530,9 @@ function ($key, $value) use ($expectedStat, $expectedDifferences) {
$this->assertTrue(false, "No idea how to evaluate the data for this test.");
}

$this->helper->logoutDashboard();
if (isset($options['last'])) {
$helper->logoutDashboard();
}
}

/**
Expand Down Expand Up @@ -591,8 +592,7 @@ public function testGetUserVisitsExport(array $options)
$testData = $options['data'];
$expectedOutput = $options['output'];
$expectedSuccess = $options['success'];

$this->helper->authenticateDashboard('mgr');
$helper = $options['helper'];

$data = array_merge(
array(
Expand All @@ -601,7 +601,7 @@ public function testGetUserVisitsExport(array $options)
$testData
);

$response = $this->helper->post("internal_dashboard/controllers/controller.php", null, $data);
$response = $helper->post("internal_dashboard/controllers/controller.php", null, $data);
$expectedContentType = $expectedSuccess ? 'application/xls' : 'text/html; charset=UTF-8';
$this->validateResponse($response, 200, $expectedContentType);

Expand Down Expand Up @@ -729,7 +729,9 @@ function ($key, $expectedRow) use ($actualRow, $ignoredColumns) {
$this->assertEquals($expected, $actual);
}

$this->helper->logoutDashboard();
if (isset($options['last'])) {
$helper->logoutDashboard();
}
}

/**
Expand All @@ -738,9 +740,19 @@ function ($key, $expectedRow) use ($actualRow, $ignoredColumns) {
*/
public function provideGetUserVisits()
{
return JSON::loadFile(
$data = JSON::loadFile(
$this->getTestFiles()->getFile('user_admin', 'get_user_visits', 'input')
);

$helper = new \TestHarness\XdmodTestHelper();
$helper->authenticateDashboard('mgr');

foreach($data as &$datum) {
$datum[0]['helper'] = $helper;
}
$data[count($data) - 1][0]['last'] = true;

return $data;
}

/**
Expand Down